Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to boost 1.84 #123

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Update to boost 1.84 #123

wants to merge 2 commits into from

Conversation

o01eg
Copy link
Contributor

@o01eg o01eg commented Dec 26, 2024

No description provided.

@o01eg o01eg changed the title Update to boost 1.84 Update to boost 1.85 Dec 26, 2024
@geoffthemedio
Copy link
Member

SDK builds OK, but building FreeOrion with the MSVC project files gives me a bunch of Boost log linker errors.

Small sampling of 10k+ errors:

unresolved external symbol "__declspec(dllimport) class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl boost::log::v2_mt_nt62::aux::operator<<<char,struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,class boost::log::v2_mt_nt62::aux::id<struct boost::log::v2_mt_nt62::aux::thread> const &)" (__imp_??$?6DU?$char_traits@D@std@@@aux@v2_mt_nt62@log@boost@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AEAV45@AEBV?$id@Uthread@aux@v2_mt_nt62@log@boost@@@0123@@Z)
unresolved external symbol "__declspec(dllimport) void __cdecl boost::log::v2_mt_nt62::register_filter_factory<char>(class boost::log::v2_mt_nt62::attribute_name const &,class boost::shared_ptr<struct boost::log::v2_mt_nt62::filter_factory<char> > const &)" (__imp_??$register_filter_factory@D@v2_mt_nt62@log@boost@@YAXAEBVattribute_name@012@AEBV?$shared_ptr@U?$filter_factory@D@v2_mt_nt62@log@boost@@@2@@Z)
unresolved external symbol "__declspec(dllimport) void __cdecl boost::log::v2_mt_nt62::aux::parse_date_time_format<char>(char const *,char const *,struct boost::log::v2_mt_nt62::aux::date_time_format_parser_callback<char> &)" (__imp_??$parse_date_time_format@D@aux@v2_mt_nt62@log@boost@@YAXPEBD0AEAU?$date_time_format_parser_callback@D@0123@@Z)

@o01eg
Copy link
Contributor Author

o01eg commented Dec 27, 2024

@geoffthemedio is it for 1.84 or 1.85?

@o01eg
Copy link
Contributor Author

o01eg commented Dec 27, 2024

I've tried to build SDK with boost 1.84 https://github.com/o01eg/freeorion-sdk/releases/tag/v15 and started CI for FreeOrion with it https://github.com/o01eg/freeorion/actions/runs/12511698599

@geoffthemedio
Copy link
Member

geoffthemedio commented Dec 27, 2024

@geoffthemedio is it for 1.84 or 1.85?

1.85

Trying again with 1.84...

@geoffthemedio
Copy link
Member

geoffthemedio commented Dec 27, 2024

With 1.84 I also get similar boost log linker errors.

Googling suggests the issue might be different versions of Windows being targeted due to defines of _WIN32_WINNT being inconsistent between the Boost build and the project files.

(previous edit of this comment about other linker errors was due to using the wrong config (Win32/x64) in MSVC)

@o01eg o01eg changed the title Update to boost 1.85 Update to boost 1.84 Dec 27, 2024
@geoffthemedio
Copy link
Member

Tried adding _WIN32_WINNT=0x0A00 to the x64 configs in win32.dependency.props but still get Boost Log linker errors...

@o01eg
Copy link
Contributor Author

o01eg commented Dec 27, 2024

Boost definitely changed something https://www.boost.org/users/history/version_1_84_0.html

FreeOrion on CI builds correctly. Maybe some local modifications?

    if("${_VS_PLATFORM_TOOLSET_TARGET}" STREQUAL "_xp")
        list(APPEND BOOST_CONFIGURE_FLAGS define=BOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_WINXP) # 0x0501
    else()
        list(APPEND BOOST_CONFIGURE_FLAGS define=BOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_VISTA) # 0x0600
    endif()

XP looks unactual, as both 32 and 64 builds in CI ouputs

-- Boost toolset is msvc-14.3 for v143

@o01eg
Copy link
Contributor Author

o01eg commented Dec 27, 2024

In FreeOrion's CMakeLists.txt it looks like:

   # Set minimum Windows target version to WindowsXP or Vista depending on toolset
        # https://msdn.microsoft.com/en-us/library/aa383745.aspx
        # Use numeric to correctly compare it in <boost\log\detail\config.hpp>
        $<$<PLATFORM_ID:Windows>:_WIN32_WINNT=$<IF:$<STREQUAL:${_VS_PLATFORM_TOOLSET_TARGET},_xp>,0x0501,0x0600>>

@geoffthemedio
Copy link
Member

I've been trying to get it to build for a couple hours now... There are a bunch of different .props files, as well as the project files themselves, with settings sprinkled randomly throughout with no obvious way to tell where I can specify what. Half the time it tells me that I need to install the version of Visual Studio I'm using because its own toolset version isn't found...

@o01eg
Copy link
Contributor Author

o01eg commented Dec 27, 2024

I suppose there should be some single point where to put that definition. Still it's strange in builds in CI but not locally. What MS VS version do you use?

CI shows msbuild version MSBuild version 17.12.12+1cce77968 for .NET Framework and still uses v142 toolset

Copy link
Member

@Vezzra Vezzra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can build the SDK, can build FO, but it crashes on startup. Apparently libSDL2.dylib can't be found (again 😉), maybe I need to build a adapted test version of FO like before? I've built current master.

Here is the crash report:

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               FreeOrion [38165]
Path:                  /Volumes/VOLUME/FreeOrion.app/Contents/MacOS/FreeOrion
Identifier:            org.freeorion.FreeOrion
Version:               0.5.1+ (build 2024-12-22.ce66e2b) (0.5.1+ (build 2024-12-22.ce66e2b))
Code Type:             X86-64 (Native)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2024-12-27 12:28:18.9759 +0100
OS Version:            macOS 12.6 (21G115)
Report Version:        12
Bridge OS Version:     6.6 (19P6067)
Anonymous UUID:        DBE14CFB-5083-F51E-3D62-E711C220B917


Time Awake Since Boot: 14000 seconds

System Integrity Protection: enabled

Crashed Thread:        0

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: '@rpath/libSDL2.dylib'
Referenced from: '/Volumes/VOLUME/FreeOrion.app/Contents/MacOS/FreeOrion'
Reason: tried: '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file), '' (no such file)
(terminated at launch; ignore backtrace)

Thread 0 Crashed:
0   dyld                          	       0x110c6c98e __abort_with_payload + 10
1   dyld                          	       0x110c82a72 abort_with_payload_wrapper_internal + 80
2   dyld                          	       0x110c82aa4 abort_with_payload + 9
3   dyld                          	       0x110c30699 dyld4::halt(char const*) + 615
4   dyld                          	       0x110c2c5b5 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 3995
5   dyld                          	       0x110c2b4e4 start + 388


Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000002000209  rbx: 0x0000000000000000  rcx: 0x00007ff7bae2d668  rdx: 0x00007ff7bae2dad0
  rdi: 0x0000000000000006  rsi: 0x0000000000000001  rbp: 0x00007ff7bae2d6b0  rsp: 0x00007ff7bae2d668
   r8: 0x00007ff7bae2d6d0   r9: 0x0000000000000000  r10: 0x0000000000000063  r11: 0x0000000000000246
  r12: 0x0000000000000063  r13: 0x00007ff7bae2dad0  r14: 0x0000000000000001  r15: 0x0000000000000006
  rip: 0x0000000110c6c98e  rfl: 0x0000000000000246  cr2: 0x0000000105fba000
  
Logical CPU:     0
Error Code:      0x02000209 
Trap Number:     133


Binary Images:
       0x110c26000 -        0x110c91fff dyld (*) <71febccd-d9dc-3599-9971-2b3407c588a8> /usr/lib/dyld

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=47.2M resident=0K(0%) swapped_out_or_unallocated=47.2M(100%)
Writable regions: Total=9412K written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=9412K(100%)

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
STACK GUARD                       56.0M        1 
Stack                             8192K        1 
VM_ALLOCATE                         12K        3 
__DATA                             576K        9 
__DATA_CONST                       944K        5 
__LINKEDIT                        21.5M        6 
__TEXT                            25.7M        5 
dyld private memory               1024K        1 
===========                     =======  ======= 
TOTAL                            113.7M       31 

@o01eg
Copy link
Contributor Author

o01eg commented Dec 27, 2024

@Vezzra yes, it's still need updated FreeOrion's CMakeLists.txt to put libSDL2.dylib to SharedSupport folder

@o01eg o01eg requested a review from Vezzra December 27, 2024 12:46
@geoffthemedio
Copy link
Member

I suppose there should be some single point where to put that definition.

There are a bunch of .props files that set various options for the projects, and then you can also set the same things in the project files themselves to override the .props files. But there's no obvious logic about where in the props files things should go. Some entries that appear together in the UI will work and others not when placed together in the .props files.

Still it's strange in builds in CI but not locally. What MS VS version do you use?

Visual Studio 2022 latest update. I had 2019 also installed, but I've just removed that and done a Repair on 2022 to hopefully get whatever problematic environment variables fixed that were causing problems.

CI shows msbuild version MSBuild version 17.12.12+1cce77968 for .NET Framework and still uses v142 toolset

I can try building the SDK with the v142 toolset, I suppose.

@Vezzra
Copy link
Member

Vezzra commented Dec 27, 2024

@Vezzra yes, it's still need updated FreeOrion's CMakeLists.txt to put libSDL2.dylib to SharedSupport folder

@o01eg , what exactly do I need to add? There is already this line in CMakeLists.txt:

        COMMAND
           ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:SDL::SDL>" "$<TARGET_FILE_DIR:freeorion>/../SharedSupport"

@geoffthemedio
Copy link
Member

geoffthemedio commented Dec 27, 2024

I can try building the SDK with the v142 toolset, I suppose.

Built with toolset v142 and v143 and it gives the same Boost log linker errors.

I think the issue is that Boost has changed the .lib files to include the exact version of Windows for which it was compiled, as determined by the _WIN32_WINNT define that was used. The SDK currently seems to build with _WIN32_WINNT=0x0602 due to the line in CMakeLists.txt:
$<$<PLATFORM_ID:Windows>:_WIN32_WINNT=$<IF:$<STREQUAL:${_VS_PLATFORM_TOOLSET_TARGET},_xp>,0x0501,0x0602>>
which means that it wants to link against a Boost log that exposes symbols in the boost::log::v2_mt_nt62 namespace. That corresponds to Windows 8. I had set that define to 0x0A00 for Windows 10.

I think at this point we can move to assuming most people are on 10, rather than 8 for default building the SDK.

@o01eg
Copy link
Contributor Author

o01eg commented Dec 27, 2024

@Vezzra yes, it's still need updated FreeOrion's CMakeLists.txt to put libSDL2.dylib to SharedSupport folder

@o01eg , what exactly do I need to add? There is already this line in CMakeLists.txt:

        COMMAND
           ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:SDL::SDL>" "$<TARGET_FILE_DIR:freeorion>/../SharedSupport"

Wait, there shouldn't be such line in master version 0.5.1+ (build 2024-12-22.ce66e2b) (0.5.1+ (build 2024-12-22.ce66e2b))

@o01eg
Copy link
Contributor Author

o01eg commented Dec 27, 2024

I think at this point we can move to assuming most people are on 10, rather than 8 for default building the SDK.

I can try to raise it.

@geoffthemedio
Copy link
Member

I think at this point we can move to assuming most people are on 10, rather than 8 for default building the SDK.

I can try to raise it.

I guess:

list(APPEND BOOST_CONFIGURE_FLAGS define=BOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_WIN10)

@Vezzra
Copy link
Member

Vezzra commented Dec 27, 2024

Wait, there shouldn't be such line in master version 0.5.1+ (build 2024-12-22.ce66e2b) (0.5.1+ (build 2024-12-22.ce66e2b))

Ah, right, my bad - when I looked at CMakeLists.txt, I was on your master branch. 🤦‍♂️

@geoffthemedio
Copy link
Member

geoffthemedio commented Dec 27, 2024

f2a4e28
and
freeorion/freeorion@1f96bd4
work together to build and link

Copy link
Member

@Vezzra Vezzra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, now it worked.

@o01eg
Copy link
Contributor Author

o01eg commented Dec 27, 2024

f2a4e28
and
freeorion/freeorion@1f96bd4
work together to build and link

Looks like XP was dropped in 11th SDK.

@o01eg
Copy link
Contributor Author

o01eg commented Dec 27, 2024

Trying to build FreeOrion with toolset v143 and Windows10 in https://github.com/o01eg/freeorion/actions/runs/12520222621 with SDK https://github.com/o01eg/freeorion-sdk/releases/tag/v16

@geoffthemedio
Copy link
Member

888d96c works with freeorion/freeorion@1f96bd4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants