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

Cannot build tests with cross-compiler (Ubuntu/MXE) #1684

Closed
ambitslix opened this issue May 15, 2020 · 3 comments
Closed

Cannot build tests with cross-compiler (Ubuntu/MXE) #1684

ambitslix opened this issue May 15, 2020 · 3 comments

Comments

@ambitslix
Copy link
Contributor

ambitslix commented May 15, 2020

Trying to build under MXE shared:

Linking CXX executable ../bin/os-test.exe
cd /build/Linux_x86_64_Debug_x86_64-w64-mingw32.shared-cross-compiler/submodules/fmt/test && /mxe/usr/x86_64-pc-linux-gnu/bin/cmake -E cmake_link_script CMakeFiles/os-test.dir/link.txt --verbose=1
/mxe/usr/x86_64-pc-linux-gnu/bin/cmake -E remove -f CMakeFiles/os-test.dir/objects.a
/mxe/usr/bin/x86_64-w64-mingw32.shared-ar cr CMakeFiles/os-test.dir/objects.a @CMakeFiles/os-test.dir/objects1.rsp
/mxe/usr/x86_64-pc-linux-gnu/bin/x86_64-w64-mingw32.shared-g++ -g   -Wl,--whole-archive CMakeFiles/os-test.dir/objects.a -Wl,--no-whole-archive  -o ../bin/os-test.exe -Wl,--out-implib,libos-test.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles/os-test.dir/linklibs.rsp
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj): In function `fmt::v6::internal::count_digits(unsigned long long)':
/submodules/fmt/include/fmt/format.h:762: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE23zero_or_powers_of_10_64E'
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj): In function `fmt::v6::internal::count_digits(unsigned int)':
/submodules/fmt/include/fmt/format.h:820: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE23zero_or_powers_of_10_32E'
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj): In function `void fmt::v6::internal::basic_writer<fmt::v6::buffer_range<char> >::write<float, 0>(float, fmt::v6::basic_format_specs<char>)':
/submodules/fmt/include/fmt/format.h:1708: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE5signsE'
/submodules/fmt/include/fmt/format.h:1717: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE5signsE'
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj): In function `void fmt::v6::internal::basic_writer<fmt::v6::buffer_range<char> >::write<double, 0>(double, fmt::v6::basic_format_specs<char>)':
/submodules/fmt/include/fmt/format.h:1708: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE5signsE'
/submodules/fmt/include/fmt/format.h:1717: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE5signsE'
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj): In function `void fmt::v6::internal::basic_writer<fmt::v6::buffer_range<char> >::write<long double, 0>(long double, fmt::v6::basic_format_specs<char>)':
/submodules/fmt/include/fmt/format.h:1708: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE5signsE'
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj):/submodules/fmt/include/fmt/format.h:1717: more undefined references to `__imp__ZN3fmt2v68internal10basic_dataIvE5signsE' follow
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj): In function `fmt::v6::internal::counting_iterator fmt::v6::internal::write_exponent<char, fmt::v6::internal::counting_iterator>(int, fmt::v6::internal::counting_iterator)':
/submodules/fmt/include/fmt/format.h:1061: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE6digitsE'
/submodules/fmt/include/fmt/format.h:1066: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE6digitsE'
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj): In function `char* fmt::v6::internal::format_uint<4u, char, unsigned long long>(char*, unsigned long long, int, bool)':
/submodules/fmt/include/fmt/format.h:907: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE10hex_digitsE'
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj): In function `char* fmt::v6::internal::format_decimal<unsigned int, char, char* fmt::v6::internal::format_decimal<char, char*, unsigned int>(char*, unsigned int, int)::{lambda(char*)#1}>(char* fmt::v6::internal::format_decimal<char, char*, unsigned int>(char*, unsigned int, int)::{lambda(char*)#1}, unsigned int, int, char* fmt::v6::internal::format_decimal<char, char*, unsigned int>(char*, unsigned int, int)::{lambda(char*)#1})':
/submodules/fmt/include/fmt/format.h:863: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE6digitsE'
/submodules/fmt/include/fmt/format.h:865: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE6digitsE'
/submodules/fmt/include/fmt/format.h:873: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE6digitsE'
/submodules/fmt/include/fmt/format.h:875: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE6digitsE'
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj): In function `char* fmt::v6::internal::format_decimal<unsigned long long, char, char* fmt::v6::internal::format_decimal<char, char*, unsigned long long>(char*, unsigned long long, int)::{lambda(char*)#1}>(char* fmt::v6::internal::format_decimal<char, char*, unsigned long long>(char*, unsigned long long, int)::{lambda(char*)#1}, unsigned long long, int, char* fmt::v6::internal::format_decimal<char, char*, unsigned long long>(char*, unsigned long long, int)::{lambda(char*)#1})':
/submodules/fmt/include/fmt/format.h:863: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE6digitsE'
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj):/submodules/fmt/include/fmt/format.h:865: more undefined references to `__imp__ZN3fmt2v68internal10basic_dataIvE6digitsE' follow
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj): In function `char* fmt::v6::internal::format_uint<4u, char, unsigned int>(char*, unsigned int, int, bool)':
/submodules/fmt/include/fmt/format.h:907: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE10hex_digitsE'
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj): In function `char* fmt::v6::internal::format_uint<1u, char, unsigned int>(char*, unsigned int, int, bool)':
/submodules/fmt/include/fmt/format.h:907: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE10hex_digitsE'
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj): In function `char* fmt::v6::internal::format_uint<3u, char, unsigned int>(char*, unsigned int, int, bool)':
/submodules/fmt/include/fmt/format.h:907: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE10hex_digitsE'
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj): In function `char* fmt::v6::internal::format_uint<1u, char, unsigned long long>(char*, unsigned long long, int, bool)':
/submodules/fmt/include/fmt/format.h:907: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE10hex_digitsE'
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj): In function `char* fmt::v6::internal::format_uint<3u, char, unsigned long long>(char*, unsigned long long, int, bool)':
/submodules/fmt/include/fmt/format.h:907: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE10hex_digitsE'
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj):/submodules/fmt/include/fmt/format.h:907: more undefined references to `__imp__ZN3fmt2v68internal10basic_dataIvE10hex_digitsE' follow
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj): In function `char* fmt::v6::internal::format_decimal<unsigned int, char, void fmt::v6::internal::basic_writer<fmt::v6::buffer_range<char> >::int_writer<int, fmt::v6::basic_format_specs<char> >::num_writer::operator()<char*&>(char*&) const::{lambda(char*&)#1}>(char, unsigned int, int, void fmt::v6::internal::basic_writer<fmt::v6::buffer_range<char> >::int_writer<int, fmt::v6::basic_format_specs<char> >::num_writer::operator()<char*&>(char*&) const::{lambda(char*&)#1})':
/submodules/fmt/include/fmt/format.h:863: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE6digitsE'
/submodules/fmt/include/fmt/format.h:865: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE6digitsE'
/submodules/fmt/include/fmt/format.h:873: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE6digitsE'
/submodules/fmt/include/fmt/format.h:875: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE6digitsE'
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj): In function `char* fmt::v6::internal::format_decimal<unsigned int, char, void fmt::v6::internal::basic_writer<fmt::v6::buffer_range<char> >::int_writer<unsigned int, fmt::v6::basic_format_specs<char> >::num_writer::operator()<char*&>(char*&) const::{lambda(char*&)#1}>(char, unsigned int, int, void fmt::v6::internal::basic_writer<fmt::v6::buffer_range<char> >::int_writer<unsigned int, fmt::v6::basic_format_specs<char> >::num_writer::operator()<char*&>(char*&) const::{lambda(char*&)#1})':
/submodules/fmt/include/fmt/format.h:863: undefined reference to `__imp__ZN3fmt2v68internal10basic_dataIvE6digitsE'
CMakeFiles/os-test.dir/objects.a(os-test.cc.obj):/submodules/fmt/include/fmt/format.h:865: more undefined references to `__imp__ZN3fmt2v68internal10basic_dataIvE6digitsE' follow
collect2: error: ld returned 1 exit status
make[3]: *** [test/CMakeFiles/os-test.dir/build.make:90: bin/os-test.exe] Error 1
make[3]: Leaving directory '/build/Linux_x86_64_Debug_x86_64-w64-mingw32.shared-cross-compiler/submodules/fmt'
make[2]: *** [CMakeFiles/Makefile2:213: test/CMakeFiles/os-test.dir/all] Error 2
make[2]: Leaving directory '/build/Linux_x86_64_Debug_x86_64-w64-mingw32.shared-cross-compiler/submodules/fmt'
make[1]: *** [CMakeFiles/Makefile2:225: test/CMakeFiles/os-test.dir/rule] Error 2
make[1]: Leaving directory '/build/Linux_x86_64_Debug_x86_64-w64-mingw32.shared-cross-compiler/submodules/fmt'
make: *** [Makefile:223: os-test] Error 2

cat test/CMakeFiles/os-test.dir/linklibs.rsp 
-static-libgcc -static-libstdc++ libtest-main.a libgmock.a ../libfmtd.dll.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32

It builds with static with adding to CMakeLists.txt:

add_definitions("-Wa,-mbig-obj")

Any clues?

@vitaut
Copy link
Contributor

vitaut commented May 15, 2020

Any clues?

No but I recommend using a static library.

@vitaut
Copy link
Contributor

vitaut commented Jun 4, 2020

Closing as there are no plans to support this build configuration but a PR would be welcome.

@VasiliPupkin256
Copy link
Contributor

@ambitslix interesting that -mbig-obj helped in your case, usually it is used to overcome 'File too big' error like described here assimp/assimp#2067 for example. Are you sure that it was -mbig-obj that solved the issue? This switch is conflicting with -flto switch and in turns cause problems compiling projects using link time/whole program optimization. I am considering to remove -mbig-obj from the default compilation switches again and do not want to break anything.

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

No branches or pull requests

3 participants