ceres-solver / ceres-solver

A large scale non-linear optimization library

Home Page:http://ceres-solver.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MinGW Compilation fails in debug mode - file too big

CCInc opened this issue · comments

Ceres fails to compile in debug mode on mingw due to "too many sections", but it compiles fine in release mode.

To reproduce using MinGW UCRT64:

mkdir bin
cd bin
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Debug "-DSUITESPARSE=OFF" "-DCXSPARSE=OFF" "-DLAPACK=OFF" "-DEIGENSPARSE=OFF" "-DGFLAGS=OFF" "-DCUDA=OFF" "-DEXPORT_BUILD_DIR=ON" "-DBUILD_BENCHMARKS=OFF" "-DBUILD_EXAMPLES=OFF" "-DBUILD_TESTING=OFF" "-DBUILD_BENCHMARKS=OFF"
ninja -v

Failure message:

[152/153] C:\msys64\ucrt64\bin\c++.exe -DEIGEN_MPL2_ONLY -DGFLAGS_IS_A_DLL=1 -DGLOG_CUSTOM_PREFIX_SUPPORT -DGLOG_NO_ABBREVIATED_SEVERITIES -DNOMINMAX -Dceres_EXPORTS -IC:/Users/Chris/ceres-solver/include -IC:/Users/Chris/ceres-solver/internal -IC:/Users/Chris/ceres-solver/bin/include -IC:/msys64/ucrt64/include/eigen3 -g -fvisibility=hidden -fno-keep-inline-dllexport -Wno-deprecated-declarations -MD -MT internal/ceres/CMakeFiles/ceres_internal.dir/covariance_impl.cc.obj -MF internal\ceres\CMakeFiles\ceres_internal.dir\covariance_impl.cc.obj.d -o internal/ceres/CMakeFiles/ceres_internal.dir/covariance_impl.cc.obj -c C:/Users/Chris/ceres-solver/internal/ceres/covariance_impl.cc
FAILED: internal/ceres/CMakeFiles/ceres_internal.dir/covariance_impl.cc.obj
C:\msys64\ucrt64\bin\c++.exe -DEIGEN_MPL2_ONLY -DGFLAGS_IS_A_DLL=1 -DGLOG_CUSTOM_PREFIX_SUPPORT -DGLOG_NO_ABBREVIATED_SEVERITIES -DNOMINMAX -Dceres_EXPORTS -IC:/Users/Chris/ceres-solver/include -IC:/Users/Chris/ceres-solver/internal -IC:/Users/Chris/ceres-solver/bin/include -IC:/msys64/ucrt64/include/eigen3 -g -fvisibility=hidden -fno-keep-inline-dllexport -Wno-deprecated-declarations -MD -MT internal/ceres/CMakeFiles/ceres_internal.dir/covariance_impl.cc.obj -MF internal\ceres\CMakeFiles\ceres_internal.dir\covariance_impl.cc.obj.d -o internal/ceres/CMakeFiles/ceres_internal.dir/covariance_impl.cc.obj -c C:/Users/Chris/ceres-solver/internal/ceres/covariance_impl.cc
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/as.exe: internal/ceres/CMakeFiles/ceres_internal.dir/covariance_impl.cc.obj: too many sections (72977)
C:\msys64\tmp\ccJD5Fmj.s: Assembler messages:
C:\msys64\tmp\ccJD5Fmj.s: Fatal error: can't write 19 bytes to section .text of internal/ceres/CMakeFiles/ceres_internal.dir/covariance_impl.cc.obj: 'file too big'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/as.exe: internal/ceres/CMakeFiles/ceres_internal.dir/covariance_impl.cc.obj: too many sections (72977)
C:\msys64\tmp\ccJD5Fmj.s: Fatal error: internal/ceres/CMakeFiles/ceres_internal.dir/covariance_impl.cc.obj: file too big
ninja: build stopped: subcommand failed.

The -Wa,-mbig-obj flags may be needed to be added to the cmake toolchain to properly build in debug mode.

Related to #797, microsoft/vcpkg#34829

It looks like you are using Ceres Solver 2.1.0. Does the problem actually occur in 2.2.0?

Hi, I was able to replicate the error on 2.2.0 and the latest master as well.

[3/4] C:\msys64\ucrt64\bin\c++.exe -DEIGEN_MPL2_ONLY -DGFLAGS_IS_A_DLL=1 -DGLOG_CUSTOM_PREFIX_SUPPORT -DGLOG_NO_ABBREVIATED_SEVERITIES -DNOMINMAX -Dceres_EXPORTS -IC:/Users/Chris/ceres-solver/include -IC:/Users/Chris/ceres-solver/internal -IC:/Users/Chris/ceres-solver/bin/include -IC:/msys64/ucrt64/include/eigen3 -g -fvisibility=hidden -fno-keep-inline-dllexport -MD -MT internal/ceres/CMakeFiles/ceres_internal.dir/covariance_impl.cc.obj -MF internal\ceres\CMakeFiles\ceres_internal.dir\covariance_impl.cc.obj.d -o internal/ceres/CMakeFiles/ceres_internal.dir/covariance_impl.cc.obj -c C:/Users/Chris/ceres-solver/internal/ceres/covariance_impl.cc
FAILED: internal/ceres/CMakeFiles/ceres_internal.dir/covariance_impl.cc.obj
C:\msys64\ucrt64\bin\c++.exe -DEIGEN_MPL2_ONLY -DGFLAGS_IS_A_DLL=1 -DGLOG_CUSTOM_PREFIX_SUPPORT -DGLOG_NO_ABBREVIATED_SEVERITIES -DNOMINMAX -Dceres_EXPORTS -IC:/Users/Chris/ceres-solver/include -IC:/Users/Chris/ceres-solver/internal -IC:/Users/Chris/ceres-solver/bin/include -IC:/msys64/ucrt64/include/eigen3 -g -fvisibility=hidden -fno-keep-inline-dllexport -MD -MT internal/ceres/CMakeFiles/ceres_internal.dir/covariance_impl.cc.obj -MF internal\ceres\CMakeFiles\ceres_internal.dir\covariance_impl.cc.obj.d -o internal/ceres/CMakeFiles/ceres_internal.dir/covariance_impl.cc.obj -c C:/Users/Chris/ceres-solver/internal/ceres/covariance_impl.cc
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/as.exe: internal/ceres/CMakeFiles/ceres_internal.dir/covariance_impl.cc.obj: too many sections (73340)
C:\msys64\tmp\ccvkUfJv.s: Assembler messages:
C:\msys64\tmp\ccvkUfJv.s: Fatal error: can't write 37 bytes to section .text of internal/ceres/CMakeFiles/ceres_internal.dir/covariance_impl.cc.obj: 'file too big'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/as.exe: internal/ceres/CMakeFiles/ceres_internal.dir/covariance_impl.cc.obj: too many sections (73340)
C:\msys64\tmp\ccvkUfJv.s: Fatal error: internal/ceres/CMakeFiles/ceres_internal.dir/covariance_impl.cc.obj: file too big
ninja: build stopped: subcommand failed.