[cfe-dev] Linking with clang in gcc mode on Windows
Edward Diener
eldlistmailingz at tropicsoft.com
Fri Jul 11 15:53:47 PDT 2014
I built the latest clang on Windows in gcc mode using Cmake and Ninja.
When I compile a source file all the gcc header files are found and the
compilation succeeds but when I link none of the gcc libraries appear to
be found. Here is the compilation output for a single source file:
> clang-linux.compile.c++.without-pth ..\..\..\bin.v2\libs\mpl\test\bool.test\clang-linux-3.5.0\debug\bool.obj
>
> "C:/Programming/VersionControl/bninja_installed_clang/bin/clang.exe" -c -x c++ -O0 -g -fno-inline -Wall -g -DBOOST_ALL_NO_LIB=1 -I"..\..\.." -o "..\..\..\bin.v2\libs\mpl\test\bool.test\clang-linux-3.5.0\debug\bool.obj" "bool.cpp"
>
Here is the error output for the link step:
> clang-linux.link ..\..\..\bin.v2\libs\mpl\test\bool.test\clang-linux-3.5.0\debug\bool.exe
>
> "C:/Programming/VersionControl/bninja_installed_clang/bin/clang.exe" -o "..\..\..\bin.v2\libs\mpl\test\bool.test\clang-linux-3.5.0\debug\bool.exe" -Wl,--start-group "..\..\..\bin.v2\libs\mpl\test\bool.test\clang-linux-3.5.0\debug\bool.obj" -Wl,-Bstatic -Wl,-Bdynamic -Wl,--end-group -g
>
> ..\..\..\bin.v2\libs\mpl\test\bool.test\clang-linux-3.5.0\debug\bool.obj: In function `_cxx_global_var_init':
> c:/MinGW/lib/gcc/mingw32/4.8.1/include/c++/iostream:74: undefined reference to `std::ios_base::Init::Init()'
> ..\..\..\bin.v2\libs\mpl\test\bool.test\clang-linux-3.5.0\debug\bool.obj: In function `_dtor__ZStL8__ioinit':
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/bool.cpp:74: undefined reference to `std::ios_base::Init::~Init()'
> ..\..\..\bin.v2\libs\mpl\test\bool.test\clang-linux-3.5.0\debug\bool.obj: In function `ZN5boost13report_errorsEv':
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:130: undefined reference to `std::cerr'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:132: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:132: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:132: undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:138: undefined reference to `std::cerr'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:138: undefined reference to `std::ostream::operator<<(int)'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:138: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:138: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:138: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:138: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:138: undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
> ..\..\..\bin.v2\libs\mpl\test\bool.test\clang-linux-3.5.0\debug\bool.obj: In function `ZN5boost6detail16test_failed_implEPKcS2_iS2_':
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:65: undefined reference to `std::cerr'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:66: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:66: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:66: undefined reference to `std::ostream::operator<<(int)'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:66: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:66: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:66: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:66: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:66: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:66: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:66: undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
> ..\..\..\bin.v2\libs\mpl\test\bool.test\clang-linux-3.5.0\debug\bool.obj: In function `ZN5boost6detail20report_errors_remindEv':
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:53: undefined reference to `__cxa_guard_acquire'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:53: undefined reference to `__cxa_guard_release'
> C:\Programming\VersionControl\modular-boost\libs\mpl\test/..\..\..\boost/core/lightweight_test.hpp:55: undefined reference to `__cxa_guard_abort'
> ..\..\..\bin.v2\libs\mpl\test\bool.test\clang-linux-3.5.0\debug\bool.obj:(.eh_frame+0x12b): undefined reference to `__gxx_personality_v0'
> collect2.exe: error: ld returned 1 exit status
> clang.exe: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)
Anybody have any idea why the link is failing ? It looks like clang is
not searching any library paths but maybe it is something else.
More information about the cfe-dev
mailing list