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

[ boost-math ] build failure: cross-compile from mingw to arm-linux #17440

Closed
fairlyblank opened this issue Apr 22, 2021 · 1 comment
Closed
Labels
category:community-triplet A PR or issue related to community triplets not officially validated by the vcpkg team.

Comments

@fairlyblank
Copy link
Contributor

fairlyblank commented Apr 22, 2021

Host Environment

  • OS: Windows10 & MingW64
  • Compiler:
    • Vcpkg version: 2021-01-13-d67989bce1043b98092ac45996a8230a059a2d7e
    • cross compiler: linaro-gcc-10.2.1

To Reproduce
Steps to reproduce the behavior:

I'm using my own triplet, almost same as community/arm-linux.cmake except passing throgh some env and chainloading toolchain file, locating linaro gcc compilers.
vcpkg install boost --triplet=arm-linux --host-triplet=x64-mingw-dynamic --overlay-triplets=[path-to-my-triplets]

Most boost packages building successed , until boost-math.

Failure logs

    Building package boost-filesystem[core]:arm-linux... done
    Installing package boost-filesystem[core]:arm-linux...
    Installing package boost-filesystem[core]:arm-linux... done
    Elapsed time for package boost-filesystem:arm-linux: 21.52 s
    Starting package 4/101: boost-math:arm-linux
    Building package boost-math[core]:arm-linux...
    -- [OVERLAY] Loading triplet configuration from: [path-to-my-triplets]\arm-linux.cmake
    -- Using cached E:/vcpkg/downloads/boostorg-math-boost-1.75.0.tar.gz
    -- Cleaning sources at E:/vcpkg/buildtrees/boost-math/src/ost-1.75.0-eaa6889798.clean. Use --editable to skip cleaning for the packages you specify.
    -- Extracting source E:/vcpkg/downloads/boostorg-math-boost-1.75.0.tar.gz
    -- Using source at E:/vcpkg/buildtrees/boost-math/src/ost-1.75.0-eaa6889798.clean
    -- Building release...
    -- Configuring arm-linux
    -- Building arm-linux-rel
    CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:146 (message):
        Command failed: D:/msys64/mingw64/bin/cmake.exe --build . --config Release --target install -- -v -j9
        Working Directory: E:/vcpkg/buildtrees/boost-math/arm-linux-rel
        See logs for more information:
          E:\vcpkg\buildtrees\boost-math\install-arm-linux-rel-out.log
    
    Call Stack (most recent call first):
      scripts/cmake/vcpkg_build_cmake.cmake:105 (vcpkg_execute_build_process)
      scripts/cmake/vcpkg_install_cmake.cmake:45 (vcpkg_build_cmake)
      installed/x64-mingw-dynamic/share/boost-build/boost-modular-build.cmake:99 (vcpkg_install_cmake)
      installed/x64-mingw-dynamic/share/boost-build/boost-modular-build.cmake:110 (unix_build)
      ports/boost-math/portfile.cmake:15 (boost_modular_build)
      scripts/ports.cmake:142 (include)

      Error: Building package boost-math:arm-linux failed with: BUILD_FAILED
      Please ensure you're using the latest portfiles with `.\vcpkg update`, then
      submit an issue at https://github.com/Microsoft/vcpkg/issues including:
        Package: boost-math:arm-linux
        Vcpkg version: 2021-01-13-d67989bce1043b98092ac45996a8230a059a2d7e
      
      Additionally, attach any relevant sections from the log files above.

install-arm-linux-rel-out.log:

      [1/2] cmd.exe /C "cd /D E:\vcpkg\buildtrees\boost-math\src\ost-1.75.0-eaa6889798.clean\build && E:\vcpkg\installed\x64-mingw-dynamic\tools\boost-build\b2.exe --user-config=E:/vcpkg/buildtrees/boost-math/arm-linux-rel/user-config.jam --stagedir=E:/vcpkg/buildtrees/boost-math/arm-linux-rel/stage --build-dir=E:/vcpkg/buildtrees/boost-math/arm-linux-rel runtime-link=static link=static address-model=32 architecture=arm target-os=linux toolset=gcc threadapi=pthread -sZLIB_BINARY=z -sZLIB_LIBPATH="D:/msys64/mingw64/lib/libz.a" -sBZIP2_BINARY=bz2 -sBZIP2_LIBPATH="D:/msys64/mingw64/lib/libbz2.a" variant=release --layout=system --with-atomic --with-random --with-date_time --with-filesystem --with-system --with-thread --with-chrono -sZLIB_INCLUDE="D:/msys64/mingw64/include" -sBZIP2_INCLUDE="D:/msys64/mingw64/include" -sICU_PATH="D:/msys64/mingw64" -j8 -sBOOST_ROOT=E:/vcpkg/installed/x64-mingw-dynamic/tools/boost-build -sBOOST_BUILD_PATH=E:/vcpkg/installed/x64-mingw-dynamic/tools/boost-build --debug-configuration --ignore-site-config --hash -q threading=multi debug-symbols=on stage"
      FAILED: CMakeFiles/boost 
      cmd.exe /C "cd /D E:\vcpkg\buildtrees\boost-math\src\ost-1.75.0-eaa6889798.clean\build && E:\vcpkg\installed\x64-mingw-dynamic\tools\boost-build\b2.exe --user-config=E:/vcpkg/buildtrees/boost-math/arm-linux-rel/user-config.jam --stagedir=E:/vcpkg/buildtrees/boost-math/arm-linux-rel/stage --build-dir=E:/vcpkg/buildtrees/boost-math/arm-linux-rel runtime-link=static link=static address-model=32 architecture=arm target-os=linux toolset=gcc threadapi=pthread -sZLIB_BINARY=z -sZLIB_LIBPATH="D:/msys64/mingw64/lib/libz.a" -sBZIP2_BINARY=bz2 -sBZIP2_LIBPATH="D:/msys64/mingw64/lib/libbz2.a" variant=release --layout=system --with-atomic --with-random --with-date_time --with-filesystem --with-system --with-thread --with-chrono -sZLIB_INCLUDE="D:/msys64/mingw64/include" -sBZIP2_INCLUDE="D:/msys64/mingw64/include" -sICU_PATH="D:/msys64/mingw64" -j8 -sBOOST_ROOT=E:/vcpkg/installed/x64-mingw-dynamic/tools/boost-build -sBOOST_BUILD_PATH=E:/vcpkg/installed/x64-mingw-dynamic/tools/boost-build --debug-configuration --ignore-site-config --hash -q threading=multi debug-symbols=on stage"
      notice: found boost-build.jam at E:/vcpkg/installed/x64-mingw-dynamic/tools/boost-build/boost-build.jam
      notice: loading B2 from E:/vcpkg/installed/x64-mingw-dynamic/tools/boost-build/src/kernel/bootstrap.jam
      notice: Site configuration files will be ignored due to the
      notice: --ignore-site-config command-line option.
      notice: Loading explicitly specified user configuration file:
          E:\vcpkg\buildtrees\boost-math\arm-linux-rel\user-config.jam
      notice: Searching 'E:\vcpkg\buildtrees\boost-math\arm-linux-rel' for user-config configuration file 'user-config.jam'.
      notice: Loading user-config configuration file 'user-config.jam' from 'E:/vcpkg/buildtrees/boost-math/arm-linux-rel'.
      notice: will use 'd:/linaro-10.2/arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-g++.exe' for gcc, condition <toolset>gcc-5.4.1
      notice: using gcc libraries :: <toolset>gcc-5.4.1 :: d:/linaro-10.2/arm-none-linux-gnueabihf/bin d:/linaro-10.2/arm-none-linux-gnueabihf/lib d:/linaro-10.2/arm-none-linux-gnueabihf/lib32 d:/linaro-10.2/arm-none-linux-gnueabihf/lib64
      notice: using gcc archiver :: <toolset>gcc-5.4.1 :: D:/linaro-10.2/arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-ar.exe
      notice: using gcc ranlib :: <toolset>gcc-5.4.1 :: D:/msys64/mingw64/bin/ranlib.exe
      notice: using rc compiler :: <toolset>gcc-5.4.1 :: windres
      Performing configuration checks
      
          - gcc visibility           : yes
          - long double support      : yes
      ...patience...
      ...patience...
      ...found 1898 targets...
      ...updating 156 targets...
      gcc.compile.c++ E:\vcpkg\buildtrees\boost-math\arm-linux-rel\boost\config\c189199268d8528b6f5906a315de5673\has_long_double_support.o
      gcc.compile.c++.pch E:\vcpkg\buildtrees\boost-math\arm-linux-rel\boost\build\pch\c189199268d8528b6f5906a315de5673\..\src\tr1\pch.hpp.gch
      gcc.compile.c++ E:\vcpkg\buildtrees\boost-math\arm-linux-rel\boost\build\c189199268d8528b6f5906a315de5673\acosh.o
      
      
           "d:/linaro-10.2/arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-g++.exe"   -fPIC -O3 -DNDEBUG -pthread 
      -O3 -finline-functions -Wno-inline -Wall -g -fvisibility=hidden -Winvalid-pch -DBOOST_ALL_NO_LIB=1 -DBOOST_BUILD_PCH_ENABLED -DNDEBUG 
      -I"E:\vcpkg\buildtrees\boost-math\arm-linux-rel\boost\build\pch\c189199268d8528b6f5906a315de5673\..\src\tr1" 
      -I"..\include" -I"E:\vcpkg\installed\arm-linux\include" -I"..\src\tr1"  -c 
      -o "E:\vcpkg\buildtrees\boost-math\arm-linux-rel\boost\build\c189199268d8528b6f5906a315de5673\acosh.o" 
      "..\build\..\src\tr1\acosh.cpp"
      
      ...failed gcc.compile.c++ E:\vcpkg\buildtrees\boost-math\arm-linux-rel\boost\build\c189199268d8528b6f5906a315de5673\acosh.o...
      gcc.compile.c++ E:\vcpkg\buildtrees\boost-math\arm-linux-rel\boost\build\c189199268d8528b6f5906a315de5673\asinh.o
      
      
            "d:/linaro-10.2/arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-g++.exe"   -fPIC -O3 -DNDEBUG -pthread 
      -O3 -finline-functions -Wno-inline -Wall -g -fvisibility=hidden -Winvalid-pch -DBOOST_ALL_NO_LIB=1 -DBOOST_BUILD_PCH_ENABLED -DNDEBUG 
      -I"E:\vcpkg\buildtrees\boost-math\arm-linux-rel\boost\build\pch\c189199268d8528b6f5906a315de5673\..\src\tr1" 
      -I"..\include" -I"E:\vcpkg\installed\arm-linux\include" -I"..\src\tr1"  -c 
      -o "E:\vcpkg\buildtrees\boost-math\arm-linux-rel\boost\build\c189199268d8528b6f5906a315de5673\asinh.o" 
      "..\build\..\src\tr1\asinh.cpp"
      
      ...failed gcc.compile.c++ E:\vcpkg\buildtrees\boost-math\arm-linux-rel\boost\build\c189199268d8528b6f5906a315de5673\asinh.o...
      gcc.compile.c++ E:\vcpkg\buildtrees\boost-math\arm-linux-rel\boost\build\c189199268d8528b6f5906a315de5673\cbrt.o
      ......
      ......  [many same errors from other source files]

Additional context
Errors raised in this command:

            "d:/linaro-10.2/arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-g++.exe"   -fPIC -O3 -DNDEBUG -pthread 
      -O3 -finline-functions -Wno-inline -Wall -g -fvisibility=hidden -Winvalid-pch -DBOOST_ALL_NO_LIB=1 -DBOOST_BUILD_PCH_ENABLED -DNDEBUG 
      -I"E:\vcpkg\buildtrees\boost-math\arm-linux-rel\boost\build\pch\c189199268d8528b6f5906a315de5673\..\src\tr1" 
      -I"..\include" -I"E:\vcpkg\installed\arm-linux\include" -I"..\src\tr1"  -c 
      -o "E:\vcpkg\buildtrees\boost-math\arm-linux-rel\boost\build\c189199268d8528b6f5906a315de5673\asinh.o" 
      "..\build\..\src\tr1\asinh.cpp"

I tried to execute this command manually, object file was not generated (gcc also didn't print any error messages), and error no returned was 1.

After some research, failures should be releated to pch.hpp.gch in this include path E:\vcpkg\buildtrees\boost-math\arm-linux-rel\boost\build\pch\c189199268d8528b6f5906a315de5673\..\src\tr1.
If I delete pch.hpp.gch manually and run previous commad, object file was successfully generated with no error.

Google says pch file size matters(my file size is 148396772B), maybe boost-math pch files was not right generated by my compiler?

I also tried to pass -DBOOST_BUILD_PCH_ENABLED=0 to VCPKG_CXX_FLAGS, trying to disable precompiled header option of boost-math , but it comes before auto generated -DBOOST_BUILD_PCH_ENABLED, that makes no changes.

@JonLiu1993 JonLiu1993 added the category:community-triplet A PR or issue related to community triplets not officially validated by the vcpkg team. label Apr 23, 2021
@fairlyblank
Copy link
Contributor Author

ok, fix it by disable pch in b2's configuration:

diff --git a/ports/boost-modular-build-helper/CMakeLists.txt b/ports/boost-modular-build-helper/CMakeLists.txt
index c97158e48..cb634c123 100644
--- a/ports/boost-modular-build-helper/CMakeLists.txt
+++ b/ports/boost-modular-build-helper/CMakeLists.txt
@@ -180,6 +180,7 @@ add_custom_target(boost ALL

         threading=multi
         debug-symbols=on
+        pch=off

         stage
     WORKING_DIRECTORY ${SOURCE_PATH}/build

It seems like a gcc pch bug.
reference:
https://github.com/boostorg/build/issues/269
https://devblogs.microsoft.com/cppblog/precompiled-header-pch-issues-and-recommendations/
https://stackoverflow.com/questions/65750889/why-is-my-generated-precompiled-file-so-big-when-using-a-boost-based-library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:community-triplet A PR or issue related to community triplets not officially validated by the vcpkg team.
Projects
None yet
Development

No branches or pull requests

2 participants