boost icon indicating copy to clipboard operation
boost copied to clipboard

Windows on ARM64 (aarch64-w64-mingw32) winfib build using MinGW-w64 fails (undefined jump_fcontext)

Open brechtsanders opened this issue 1 year ago • 5 comments

When trying to build a aarch64-w64-mingw32 build (native on Windows on ARM using this LLVM/CLang) with -DBOOST_CONTEXT_IMPLEMENTATION:STRING=winfib there the following error occcurs:

undefined symbol: __declspec(dllimport) jump_fcontext

This only happens with a shared build. A static build works fine (-DBUILD_SHARED_LIBS:BOOL=OFF -DBOOST_RUNTIME_LINK:STRING=static).

Full error output:

ld.lld: error: undefined symbol: __declspec(dllimport) make_fcontext
>>> referenced by libs/coroutine/CMakeFiles/boost_coroutine.dir/src/detail/coroutine_context.cpp.obj:(boost::coroutines::detail::coroutine_context::coroutine_context(void (*)(boost::context::detail::transfer_t), boost::coroutines::detail::preallocated const&))
>>> referenced by libs/coroutine/CMakeFiles/boost_coroutine.dir/src/detail/coroutine_context.cpp.obj:(boost::coroutines::detail::coroutine_context::coroutine_context(void (*)(boost::context::detail::transfer_t), boost::coroutines::detail::preallocated const&))

ld.lld: error: undefined symbol: __declspec(dllimport) jump_fcontext
>>> referenced by libs/coroutine/CMakeFiles/boost_coroutine.dir/src/detail/coroutine_context.cpp.obj:(boost::coroutines::detail::coroutine_context::jump(boost::coroutines::detail::coroutine_context&, void*))
>>> referenced by libs/coroutine/CMakeFiles/boost_coroutine.dir/src/detail/coroutine_context.cpp.obj:(boost::coroutines::detail::coroutine_context::jump(boost::coroutines::detail::coroutine_context&, void*))
clang-19: error: linker command failed with exit code 1 (use -v to see invocation)
[79/435] Building CXX object libs/serialization/CMakeFiles/boost_serialization.dir/src/xml_grammar.cpp.obj
ninja: build stopped: subcommand failed.

As mentioned in #982 builds with -DBOOST_CONTEXT_IMPLEMENTATION:STRING=fcontext also fail, so I don't seem to have a proper MinGW-w64 build of Boost for Windows on ARM64 (aarch64-w64-mingw32).

brechtsanders avatar Nov 17 '24 10:11 brechtsanders

@brechtsanders can you try with MSVC by pulling out latest dev branch and try to reproduce this?

Greenie0701 avatar Aug 12 '25 05:08 Greenie0701

The goal of winlibs.com is not to use MSVC, only MinGW-w64. So I don't even have MSVC on my systems.

brechtsanders avatar Aug 12 '25 06:08 brechtsanders

I was hitting a similar issue with Boost even with MSVC too, the only fix I was able to find is to exclude coroutine targets of boost and the build was successful with cmake.

-DBOOST_EXCLUDE_LIBRARIES='mpi;graph_parallel;coroutine'

Greenie0701 avatar Aug 12 '25 06:08 Greenie0701

I think the issue is due to poor identification/compilation of corresponding assembly implementation of context sources which is causing this issue. Probably due to some CMake bugs or compiler config bug causing this issue.

Greenie0701 avatar Aug 12 '25 06:08 Greenie0701

I was hitting a similar issue with Boost even with MSVC too, the only fix I was able to find is to exclude coroutine targets of boost and the build was successful with cmake.

-DBOOST_EXCLUDE_LIBRARIES='mpi;graph_parallel;coroutine'

@brechtsanders did you try this?

Greenie0701 avatar Aug 14 '25 11:08 Greenie0701