Boost logo

Boost :

From: Martin Vejbora (mvejbora_at_[hidden])
Date: 2024-09-25 17:03:16


Hello,

we're working on a new target for MinGW compiler, we're intending to have a
cross-compiler from Linux Arm64 to Windows Arm64.

We want to have Boost library as a benchmark of how complete our C++ compiler is
and gradually improve it to support more features. I'm struggling though to get
the cross-compilation and subsequent testing working.

1) I'm having troubles to set up cross-building of Boost with MinGW (even
standard MinGW from package manager Linux x64 -> Windows x64). I'm getting
errors while building Context, Process and Stacktrace modules. (I added to the
respective error messages to the end of the email or full logs can be found
here: https://github.com/user-attachments/files/17133738/x64_boost_build.log)

My build commands:

git clone --recursive https://github.com/boostorg/boost.git boost-build
cd boost-build
git checkout develop
git submodule update --init --recursive

echo "using gcc : : x86_64-w64-mingw32-g++ ;" > "user-config-x64.jam"
./bootstrap.sh
./b2 --user-config=./user-config-x64.jam --prefix=./boost-x64
--debug-configuration target-os=windows address-model=64
variant=debug install > x64_boost_build.log

>From the error messages, it seems like I'm doing something essential wrong as
for example Process module tries to build assembler for ELF format and SYSV ABI
and not Window's PE format and MS ABI.

2) Subsequently, I didn't have much luck finding resources for cross-testing of
Boost. Currently, I'm building and running tests in Ubuntu 22.04 in WSL on
Windows machine. In general, this approach seems to work decently, Boost itself
and its tests are built on Ubuntu as Windows binaries and when test executables
are run, WSL automatically propagates it to run those executables on underlaying
Windows. But a lot of tests are failing. I'm gradually investigating them and finding
issues like missing dlls because b2 uses LD_LIBRARY_PATH and Windows doesn't
understand it. I'm workarounding these issues but it's a slow process, so I wanted
to ask, is the cross-testing of Boost library supported, are you aware of some
examples where it's being used?

Thank you and kind regards,
Martin

-------------------------------------------------------------------------------

a) Context errors:
(similar also for jump_x86_64_sysv_elf_gas.S and ontop_x86_64_sysv_elf_gas.S)

gcc.compile.asm bin.v2/libs/context/build/gcc-10/debug/x86_64/link-static/
    target-os-windows/threadapi-win32/threading-multi/visibility-hidden/
    asm/make_x86_64_sysv_elf_gas.o
make_x86_64_sysv_elf_gas.S: Assembler messages:
make_x86_64_sysv_elf_gas.S:47: Warning: .type pseudo-op used outside of .def/.endef: ignored.
make_x86_64_sysv_elf_gas.S:47: Error: junk at end of line, first unrecognized character is `m'
/home/vejby/boost-build/libs/context/src/asm/make_x86_64_sysv_elf_gas.S:157:
    Warning: .size pseudo-op used outside of .def/.endef: ignored.
/home/vejby/boost-build/libs/context/src/asm/make_x86_64_sysv_elf_gas.S:157:
    Error: junk at end of line, first unrecognized character is `m'
/home/vejby/boost-build/libs/context/src/asm/make_x86_64_sysv_elf_gas.S:160:
    Error: junk at end of line, first unrecognized character is `-'

    "x86_64-w64-mingw32-g++" -x assembler-with-cpp -m64 -O0 -fno-inline -Wall -g
    -fvisibility=hidden -DBOOST_ALL_NO_LIB=1 -DBOOST_CONTEXT_NO_LIB=1
    -DBOOST_CONTEXT_SOURCE -D_WIN32_WINNT=0x0601 -I"."
    -I"/home/vejby/boost-build/libs/assert/include"
    -I"/home/vejby/boost-build/libs/context/include"
    -I"/home/vejby/boost-build/libs/core/include"
    -I"/home/vejby/boost-build/libs/move/include"
    -I"/home/vejby/boost-build/libs/mp11/include"
    -I"/home/vejby/boost-build/libs/predef/include"
    -I"/home/vejby/boost-build/libs/smart_ptr/include"
    -I"/home/vejby/boost-build/libs/throw_exception/include"
    -I"/home/vejby/boost-build/libs/type_traits/include" -c -o
    "bin.v2/libs/context/build/gcc-10/debug/x86_64/link-static/target-os-windows/
        threadapi-win32/threading-multi/visibility-hidden/asm/make_x86_64_sysv_elf_gas.o"
    "/home/vejby/boost-build/libs/context/src/asm/make_x86_64_sysv_elf_gas.S"

...failed gcc.compile.asm
bin.v2/libs/context/build/gcc-10/debug/x86_64/link-static/target-os-windows/
    threadapi-win32/threading-multi/visibility-hidden/asm/make_x86_64_sysv_elf_gas.o...

-------------------------------------------------------------------------------

b) Process errors:

gcc.compile.c++ bin.v2/libs/process/build/gcc-10/debug/x86_64/
    boost.process.fs-boost/link-static/target-os-windows/threadapi-win32/
    threading-multi/visibility-hidden/ext/exe.o
/home/vejby/boost-build/libs/process/src/ext/exe.cpp: In function
    ‘boost::filesystem::path boost::process::v2::ext::exe
    (HANDLE, boost::system::error_code&)’:
/home/vejby/boost-build/libs/process/src/ext/exe.cpp:78:9: error:
    ‘QueryFullProcessImageNameW’ was not declared in this scope
   78 | if (QueryFullProcessImageNameW(proc, 0, buffer, &size))
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~

    "x86_64-w64-mingw32-g++" -fvisibility-inlines-hidden -m64 -O0 -fno-inline
    -Wall -g -fvisibility=hidden -DBOOST_ALL_NO_LIB=1
    -DBOOST_ASIO_NO_DEPRECATED -DBOOST_ATOMIC_STATIC_LINK=1
    -DBOOST_FILESYSTEM_NO_LIB=1 -DBOOST_FILESYSTEM_STATIC_LINK=1
    -DBOOST_PROCESS_SOURCE=1 -DBOOST_REGEX_NO_LIB=1 -DBOOST_SYSTEM_NO_LIB=1
    -DBOOST_SYSTEM_STATIC_LINK=1 -DWIN32_LEAN_AND_MEAN -I"."
    -I"/home/vejby/boost-build/libs/algorithm/include"
    -I"/home/vejby/boost-build/libs/assert/include"
    -I"/home/vejby/boost-build/libs/bind/include"
    -I"/home/vejby/boost-build/libs/container_hash/include"
    -I"/home/vejby/boost-build/libs/core/include"
    -I"/home/vejby/boost-build/libs/describe/include"
    -I"/home/vejby/boost-build/libs/detail/include"
    -I"/home/vejby/boost-build/libs/filesystem/include"
    -I"/home/vejby/boost-build/libs/function/include"
    -I"/home/vejby/boost-build/libs/function_types/include"
    -I"/home/vejby/boost-build/libs/fusion/include"
    -I"/home/vejby/boost-build/libs/iterator/include"
    -I"/home/vejby/boost-build/libs/move/include"
    -I"/home/vejby/boost-build/libs/mp11/include"
    -I"/home/vejby/boost-build/libs/optional/include"
    -I"/home/vejby/boost-build/libs/predef/include"
    -I"/home/vejby/boost-build/libs/process/include"
    -I"/home/vejby/boost-build/libs/regex/include"
    -I"/home/vejby/boost-build/libs/scope/include"
    -I"/home/vejby/boost-build/libs/smart_ptr/include"
    -I"/home/vejby/boost-build/libs/system/include"
    -I"/home/vejby/boost-build/libs/throw_exception/include"
    -I"/home/vejby/boost-build/libs/tuple/include"
    -I"/home/vejby/boost-build/libs/type_index/include"
    -I"/home/vejby/boost-build/libs/type_traits/include"
    -I"/home/vejby/boost-build/libs/unordered/include"
    -I"/home/vejby/boost-build/libs/variant2/include"
    -I"/home/vejby/boost-build/libs/winapi/include" -c -o
    "bin.v2/libs/process/build/gcc-10/debug/x86_64/boost.process.fs-boost/
        link-static/target-os-windows/threadapi-win32/threading-multi/
        visibility-hidden/ext/exe.o"
    "/home/vejby/boost-build/libs/process/src/ext/exe.cpp"

...failed gcc.compile.c++
bin.v2/libs/process/build/gcc-10/debug/x86_64/boost.process.fs-boost/
    link-static/target-os-windows/threadapi-win32/threading-multi/
    visibility-hidden/ext/exe.o...

-------------------------------------------------------------------------------

gcc.compile.c++ bin.v2/libs/process/build/gcc-10/debug/x86_64/
    boost.process.fs-boost/link-static/target-os-windows/threadapi-win32/
    threading-multi/visibility-hidden/windows/default_launcher.o
In file included from /home/vejby/boost-build/libs/process/src/windows/
    default_launcher.cpp:16:
./boost/process/v2/windows/default_launcher.hpp:220:3: error:
    ‘STARTUPINFOEXW’ does not name a type; did you mean ‘STARTUPINFOW’?
  220 | STARTUPINFOEXW startup_info{{sizeof(STARTUPINFOEXW), nullptr, nullptr, nullptr,
      | ^~~~~~~~~~~~~~
      | STARTUPINFOW
./boost/process/v2/windows/default_launcher.hpp: In member function
    ‘boost::process::v2::windows::default_launcher::enable_init
    <Executor, Inits ...> boost::process::v2::windows::default_launcher::
    operator()(Executor, boost::system::error_code&,
    const typename std::enable_if<(
        boost::asio::execution::is_executor<T>::value ||
        boost::asio::is_executor<Executor>::value
    ), boost::filesystem::path>::type&, Args&&, Inits&& ...)’:
./boost/process/v2/windows/default_launcher.hpp:312:10: error:
    ‘startup_info’ was not declared in this scope
  312 | &startup_info.StartupInfo,
      | ^~~~~~~~~~~~
/home/vejby/boost-build/libs/process/src/windows/default_launcher.cpp:
    In static member function ‘static std::size_t boost::process::v2::windows::
    default_launcher::escape_argv_string(wchar_t*, std::size_t,
    boost::basic_string_view<wchar_t, std::char_traits<wchar_t> >)’:
/home/vejby/boost-build/libs/process/src/windows/default_launcher.cpp:64:16:
    warning: unused variable ‘end’ [-Wunused-variable]
   64 | const auto end = itr + sz;
      | ^~~

    "x86_64-w64-mingw32-g++" -fvisibility-inlines-hidden -m64 -O0 -fno-inline
    -Wall -g -fvisibility=hidden -DBOOST_ALL_NO_LIB=1
    -DBOOST_ASIO_NO_DEPRECATED -DBOOST_ATOMIC_STATIC_LINK=1
    -DBOOST_FILESYSTEM_NO_LIB=1 -DBOOST_FILESYSTEM_STATIC_LINK=1
    -DBOOST_PROCESS_SOURCE=1 -DBOOST_REGEX_NO_LIB=1 -DBOOST_SYSTEM_NO_LIB=1
    -DBOOST_SYSTEM_STATIC_LINK=1 -DWIN32_LEAN_AND_MEAN -I"."
    -I"/home/vejby/boost-build/libs/algorithm/include"
    -I"/home/vejby/boost-build/libs/assert/include"
    -I"/home/vejby/boost-build/libs/bind/include"
    -I"/home/vejby/boost-build/libs/container_hash/include"
    -I"/home/vejby/boost-build/libs/core/include"
    -I"/home/vejby/boost-build/libs/describe/include"
    -I"/home/vejby/boost-build/libs/detail/include"
    -I"/home/vejby/boost-build/libs/filesystem/include"
    -I"/home/vejby/boost-build/libs/function/include"
    -I"/home/vejby/boost-build/libs/function_types/include"
    -I"/home/vejby/boost-build/libs/fusion/include"
    -I"/home/vejby/boost-build/libs/iterator/include"
    -I"/home/vejby/boost-build/libs/move/include"
    -I"/home/vejby/boost-build/libs/mp11/include"
    -I"/home/vejby/boost-build/libs/optional/include"
    -I"/home/vejby/boost-build/libs/predef/include"
    -I"/home/vejby/boost-build/libs/process/include"
    -I"/home/vejby/boost-build/libs/regex/include"
    -I"/home/vejby/boost-build/libs/scope/include"
    -I"/home/vejby/boost-build/libs/smart_ptr/include"
    -I"/home/vejby/boost-build/libs/system/include"
    -I"/home/vejby/boost-build/libs/throw_exception/include"
    -I"/home/vejby/boost-build/libs/tuple/include"
    -I"/home/vejby/boost-build/libs/type_index/include"
    -I"/home/vejby/boost-build/libs/type_traits/include"
    -I"/home/vejby/boost-build/libs/unordered/include"
    -I"/home/vejby/boost-build/libs/variant2/include"
    -I"/home/vejby/boost-build/libs/winapi/include" -c -o
    "bin.v2/libs/process/build/gcc-10/debug/x86_64/boost.process.fs-boost/
        link-static/target-os-windows/threadapi-win32/threading-multi/
        visibility-hidden/windows/default_launcher.o"
    "/home/vejby/boost-build/libs/process/src/windows/default_launcher.cpp"

...failed gcc.compile.c++
bin.v2/libs/process/build/gcc-10/debug/x86_64/boost.process.fs-boost/
link-static/target-os-windows/threadapi-win32/threading-multi/
visibility-hidden/windows/default_launcher.o...

-------------------------------------------------------------------------------

gcc.compile.c++ bin.v2/libs/process/build/gcc-10/debug/x86_64
    boost.process.fs-boost/link-static/target-os-windows/threadapi-win32/
    threading-multi/visibility-hidden/environment.o
In file included from ./boost/process/v2/default_launcher.hpp:17,
                 from /home/vejby/boost-build/libs/process/src/environment.cpp:13:
./boost/process/v2/windows/default_launcher.hpp:220:3: error:
    ‘STARTUPINFOEXW’ does not name a type; did you mean ‘STARTUPINFOW’?
  220 | STARTUPINFOEXW startup_info{{sizeof(STARTUPINFOEXW), nullptr, nullptr, nullptr,
      | ^~~~~~~~~~~~~~
      | STARTUPINFOW
./boost/process/v2/windows/default_launcher.hpp: In member function
    ‘boost::process::v2::windows::default_launcher::enable_init<Executor, Inits ...>
    boost::process::v2::windows::default_launcher::operator()(Executor,
    boost::system::error_code&, const typename std::enable_if<(
        boost::asio::execution::is_executor<T>::value ||
        boost::asio::is_executor<Executor>::value
    ), boost::filesystem::path>::type&, Args&&, Inits&& ...)’:
./boost/process/v2/windows/default_launcher.hpp:312:10: error:
    ‘startup_info’ was not declared in this scope
  312 | &startup_info.StartupInfo,
      | ^~~~~~~~~~~~

    "x86_64-w64-mingw32-g++" -fvisibility-inlines-hidden -m64 -O0 -fno-inline
    -Wall -g -fvisibility=hidden -DBOOST_ALL_NO_LIB=1
    -DBOOST_ASIO_NO_DEPRECATED -DBOOST_ATOMIC_STATIC_LINK=1
    -DBOOST_FILESYSTEM_NO_LIB=1 -DBOOST_FILESYSTEM_STATIC_LINK=1
    -DBOOST_PROCESS_SOURCE=1 -DBOOST_REGEX_NO_LIB=1 -DBOOST_SYSTEM_NO_LIB=1
    -DBOOST_SYSTEM_STATIC_LINK=1 -DWIN32_LEAN_AND_MEAN -I"."
    -I"/home/vejby/boost-build/libs/algorithm/include"
    -I"/home/vejby/boost-build/libs/assert/include"
    -I"/home/vejby/boost-build/libs/bind/include"
    -I"/home/vejby/boost-build/libs/container_hash/include"
    -I"/home/vejby/boost-build/libs/core/include"
    -I"/home/vejby/boost-build/libs/describe/include"
    -I"/home/vejby/boost-build/libs/detail/include"
    -I"/home/vejby/boost-build/libs/filesystem/include"
    -I"/home/vejby/boost-build/libs/function/include"
    -I"/home/vejby/boost-build/libs/function_types/include"
    -I"/home/vejby/boost-build/libs/fusion/include"
    -I"/home/vejby/boost-build/libs/iterator/include"
    -I"/home/vejby/boost-build/libs/move/include"
    -I"/home/vejby/boost-build/libs/mp11/include"
    -I"/home/vejby/boost-build/libs/optional/include"
    -I"/home/vejby/boost-build/libs/predef/include"
    -I"/home/vejby/boost-build/libs/process/include"
    -I"/home/vejby/boost-build/libs/regex/include"
    -I"/home/vejby/boost-build/libs/scope/include"
    -I"/home/vejby/boost-build/libs/smart_ptr/include"
    -I"/home/vejby/boost-build/libs/system/include"
    -I"/home/vejby/boost-build/libs/throw_exception/include"
    -I"/home/vejby/boost-build/libs/tuple/include"
    -I"/home/vejby/boost-build/libs/type_index/include"
    -I"/home/vejby/boost-build/libs/type_traits/include"
    -I"/home/vejby/boost-build/libs/unordered/include"
    -I"/home/vejby/boost-build/libs/variant2/include"
    -I"/home/vejby/boost-build/libs/winapi/include" -c -o
    "bin.v2/libs/process/build/gcc-10/debug/x86_64/boost.process.fs-boost/
        link-static/target-os-windows/threadapi-win32/threading-multi/
        visibility-hidden/environment.o"
    "/home/vejby/boost-build/libs/process/src/environment.cpp"

...failed gcc.compile.c++
bin.v2/libs/process/build/gcc-10/debug/x86_64/boost.process.fs-boost/
    link-static/target-os-windows/threadapi-win32/threading-multi/
    visibility-hidden/environment.o...

-------------------------------------------------------------------------------

c) Stacktrace error:

gcc.compile.c++ bin.v2/libs/stacktrace/build/gcc-10/debug/x86_64/link-static/
    target-os-windows/threadapi-win32/threading-multi/visibility-hidden/
    from_exception.o
/home/vejby/boost-build/libs/stacktrace/build/../src/from_exception.cpp:161:10:
    fatal error: dlfcn.h: No such file or directory
  161 | #include <dlfcn.h>
      | ^~~~~~~~~
compilation terminated.

    "x86_64-w64-mingw32-g++" -fvisibility-inlines-hidden -m64 -O0 -fno-inline
    -Wall -g -fvisibility=hidden -DBOOST_ALL_NO_LIB=1 -I"."
    -I"/home/vejby/boost-build/libs/assert/include"
    -I"/home/vejby/boost-build/libs/container_hash/include"
    -I"/home/vejby/boost-build/libs/core/include"
    -I"/home/vejby/boost-build/libs/describe/include"
    -I"/home/vejby/boost-build/libs/mp11/include"
    -I"/home/vejby/boost-build/libs/predef/include"
    -I"/home/vejby/boost-build/libs/stacktrace/include"
    -I"/home/vejby/boost-build/libs/throw_exception/include"
    -I"/home/vejby/boost-build/libs/winapi/include" -c -o
    "bin.v2/libs/stacktrace/build/gcc-10/debug/x86_64/link-static/
        target-os-windows/threadapi-win32/threading-multi/visibility-hidden/
        from_exception.o"
    "/home/vejby/boost-build/libs/stacktrace/build/../src/from_exception.cpp"

...failed gcc.compile.c++
bin.v2/libs/stacktrace/build/gcc-10/debug/x86_64/link-static/target-os-windows/
    threadapi-win32/threading-multi/visibility-hidden/from_exception.o...


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk