I try to build hydra on Win 8.1 with cygwin but I get this build error when running make:
-DHAVE_MATH_H
hydra-pop3.o:hydra-pop3.c:(.text+0x697): undefined reference to `MD5_Init'
hydra-pop3.o:hydra-pop3.c:(.text+0x697): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `MD5_Init'
hydra-pop3.o:hydra-pop3.c:(.text+0x6f2): undefined reference to `MD5_Update'
hydra-pop3.o:hydra-pop3.c:(.text+0x6f2): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `MD5_Update'
hydra-pop3.o:hydra-pop3.c:(.text+0x70d): undefined reference to `MD5_Update'
hydra-pop3.o:hydra-pop3.c:(.text+0x70d): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `MD5_Update'
hydra-pop3.o:hydra-pop3.c:(.text+0x71e): undefined reference to `MD5_Final'
hydra-pop3.o:hydra-pop3.c:(.text+0x71e): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `MD5_Final'
/usr/lib/gcc/x86_64-pc-cygwin/4.8.2/../../../../x86_64-pc-cygwin/bin/ld: hydra-pop3.o: bad reloc address 0x0 in section `.pdata'
/usr/lib/gcc/x86_64-pc-cygwin/4.8.2/../../../../x86_64-pc-cygwin/bin/ld: final link failed: Invalid operation
collect2: error: ld returned 1 exit status
Makefile:51: recipe for target 'hydra' failed
make: *** [hydra] Error 1
What can be done? I could run ./configure without error, but then it failed running make.
check LIB_PATH, you need to include lib file exported "MD5_Init" function.
Related
I'm encoutering a Relocation truncated to fit: secrel32 against `.debug_frame$_......... issue in my C++ project.
I have already seen the links below but it doesn't seem to match the behavior of the build issue :
What does this GCC error "... relocation truncated to fit..." mean?
https://www.technovelty.org/c/relocation-truncated-to-fit-wtf.html
This issue only appears in debug mode. My project builds with no error in release mode.
Also commenting random portion of code in the main function "solves" the build issue.
My project is configured in a Qt environment using a msys2-mingw64 toolchain and gcc version 10.2.0 (Rev6, Built by MSYS2 project).
Compilation logs output :
g++ -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high -Wl,-subsystem,console -mthreads -o debug\program.exe #object_script.program.Debug -LC:\Users\user\Desktop\build-project-Qt_5_15_0_MinGW_64_bit_msys2-Debug\src\libs\common\debug -lcommon C:\msys64\mingw64\lib\libQt5Core.dll.a
debug/main.o:main.cpp:(.debug_frame$_ZSt13__invoke_implIvRZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS3_6entityENS3_9exclude_tIJEEEK4CellK8PositionK18GeographicPositionEE13view_iteratorESF_ZN28SatelliteBeamSelectionSystem6systemERNS0_7SubflowERNS3_14basic_registryIS5_EEEUlS5_E_iEENS0_4TaskEOT_OT0_OT1_OT2_EUlSI_E_JSI_EESO_St14__invoke_otherSR_DpOT1_+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZSt13__invoke_implIvRZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS3_6entityENS3_9exclude_tIJEEEK4CellK8PositionK18GeographicPositionEE13view_iteratorESF_ZN28SatelliteBeamSelectionSystem6systemERNS0_7SubflowERNS3_14basic_registryIS5_EEEUlS5_E_iEENS0_4TaskEOT_OT0_OT1_OT2_EUlSI_E_JSI_EESO_St14__invoke_otherSR_DpOT1_'
debug/main.o:main.cpp:(.debug_frame$_ZNSt14_Function_base13_Base_managerIZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK4CellK8PositionK18GeographicPositionEE13view_iteratorESG_ZN28SatelliteBeamSelectionSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_EUlSJ_E_E8_M_cloneERSt9_Any_dataRKSZ_St17integral_constantIbLb0EE+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZNSt14_Function_base13_Base_managerIZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK4CellK8PositionK18GeographicPositionEE13view_iteratorESG_ZN28SatelliteBeamSelectionSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_EUlSJ_E_E8_M_cloneERSt9_Any_dataRKSZ_St17integral_constantIbLb0EE'
debug/main.o:main.cpp:(.debug_frame$_ZNSt14_Function_base13_Base_managerIZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK4CellK8PositionK18GeographicPositionEE13view_iteratorESG_ZN28SatelliteBeamSelectionSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_EUlSJ_E_E10_M_destroyERSt9_Any_dataSt17integral_constantIbLb0EE+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZNSt14_Function_base13_Base_managerIZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK4CellK8PositionK18GeographicPositionEE13view_iteratorESG_ZN28SatelliteBeamSelectionSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_EUlSJ_E_E10_M_destroyERSt9_Any_dataSt17integral_constantIbLb0EE'
debug/main.o:main.cpp:(.debug_frame$_ZNKSt9_Any_data9_M_accessIPZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESF_ZN29SatelliteMobilityUpdateSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_ENUlSI_E_clESI_EUlvE_EERKSO_v+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZNKSt9_Any_data9_M_accessIPZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESF_ZN29SatelliteMobilityUpdateSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_ENUlSI_E_clESI_EUlvE_EERKSO_v'
debug/main.o:main.cpp:(.debug_frame$_ZSt7forwardIRZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS3_6entityENS3_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESE_ZN29SatelliteMobilityUpdateSystem6systemERNS0_7SubflowERNS3_14basic_registryIS5_EEEUlS5_E_iEENS0_4TaskEOT_OT0_OT1_OT2_ENUlSH_E_clESH_EUlvE_ESO_RNSt16remove_referenceISN_E4typeE+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZSt7forwardIRZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS3_6entityENS3_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESE_ZN29SatelliteMobilityUpdateSystem6systemERNS0_7SubflowERNS3_14basic_registryIS5_EEEUlS5_E_iEENS0_4TaskEOT_OT0_OT1_OT2_ENUlSH_E_clESH_EUlvE_ESO_RNSt16remove_referenceISN_E4typeE'
debug/main.o:main.cpp:(.debug_frame$_ZSt13__invoke_implIvRZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS3_6entityENS3_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESE_ZN29SatelliteMobilityUpdateSystem6systemERNS0_7SubflowERNS3_14basic_registryIS5_EEEUlS5_E_iEENS0_4TaskEOT_OT0_OT1_OT2_ENUlSH_E_clESH_EUlvE_JEESN_St14__invoke_otherSQ_DpOT1_+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZSt13__invoke_implIvRZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS3_6entityENS3_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESE_ZN29SatelliteMobilityUpdateSystem6systemERNS0_7SubflowERNS3_14basic_registryIS5_EEEUlS5_E_iEENS0_4TaskEOT_OT0_OT1_OT2_ENUlSH_E_clESH_EUlvE_JEESN_St14__invoke_otherSQ_DpOT1_'
debug/main.o:main.cpp:(.debug_frame$_ZNSt14_Function_base13_Base_managerIZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESF_ZN29SatelliteMobilityUpdateSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_ENUlSI_E_clESI_EUlvE_E8_M_cloneERSt9_Any_dataRKSZ_St17integral_constantIbLb0EE+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZNSt14_Function_base13_Base_managerIZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESF_ZN29SatelliteMobilityUpdateSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_ENUlSI_E_clESI_EUlvE_E8_M_cloneERSt9_Any_dataRKSZ_St17integral_constantIbLb0EE'
debug/main.o:main.cpp:(.debug_frame$_ZNSt14_Function_base13_Base_managerIZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESF_ZN29SatelliteMobilityUpdateSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_ENUlSI_E_clESI_EUlvE_E10_M_destroyERSt9_Any_dataSt17integral_constantIbLb0EE+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZNSt14_Function_base13_Base_managerIZZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESF_ZN29SatelliteMobilityUpdateSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_ENUlSI_E_clESI_EUlvE_E10_M_destroyERSt9_Any_dataSt17integral_constantIbLb0EE'
debug/main.o:main.cpp:(.debug_frame$_ZNKSt9_Any_data9_M_accessIPZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESF_ZN29SatelliteMobilityUpdateSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_EUlSI_E_EERKSO_v+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZNKSt9_Any_data9_M_accessIPZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS4_6entityENS4_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESF_ZN29SatelliteMobilityUpdateSystem6systemERNS1_7SubflowERNS4_14basic_registryIS6_EEEUlS6_E_iEENS1_4TaskEOT_OT0_OT1_OT2_EUlSI_E_EERKSO_v'
debug/main.o:main.cpp:(.debug_frame$_ZSt7forwardIRZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS3_6entityENS3_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESE_ZN29SatelliteMobilityUpdateSystem6systemERNS0_7SubflowERNS3_14basic_registryIS5_EEEUlS5_E_iEENS0_4TaskEOT_OT0_OT1_OT2_EUlSH_E_ESO_RNSt16remove_referenceISN_E4typeE+0x1c): relocation truncated to fit: secrel32 against `.debug_frame$_ZSt7forwardIRZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS3_6entityENS3_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESE_ZN29SatelliteMobilityUpdateSystem6systemERNS0_7SubflowERNS3_14basic_registryIS5_EEEUlS5_E_iEENS0_4TaskEOT_OT0_OT1_OT2_EUlSH_E_ESO_RNSt16remove_referenceISN_E4typeE'
debug/main.o:main.cpp:(.debug_frame$_ZSt13__invoke_implIvRZN2tf11FlowBuilder15for_each_guidedIN4entt10basic_viewIJNS3_6entityENS3_9exclude_tIJEEEK9Satellite8Position18GeographicPosition8VelocityEE13view_iteratorESE_ZN29SatelliteMobilityUpdateSystem6systemERNS0_7SubflowERNS3_14basic_registryIS5_EEEUlS5_E_iEENS0_4TaskEOT_OT0_OT1_OT2_EUlSH_E_JSH_EESN_St14__invoke_otherSQ_DpOT1_+0x1c): additional relocation overflows omitted from the output
collect2.exe: error: ld returned 1 exit status
I checked section sizes of the main object with GNU size tool. I added the "-fstack-usage" flag to check stack usage. I added the "fPIC" flag to the common library. It didn't fix the issue.
I am looking for some hints.
Thank you by advance !
I'm currently trying to build a simple IceCast supplier using libshout.
Unfortunately, I am unable to resolve some linker errors:
Invoking: Cygwin C++ Linker
g++ -L"D:\Programme\Cygwin\usr\x86_64-w64-mingw32\sys-root\mingw\include\ogg" -L"D:\Programme\Cygwin\usr\x86_64-w64-mingw32\sys-root\mingw\include" -L"D:\Programme\Cygwin\usr\x86_64-w64-mingw32\sys-root\mingw\include\vorbis" -o "LibshoutJavaAdapter.exe" ./src/LibshoutJavaAdapter.o -lshout -lvorbis -logg -lssl -lcrypto
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../lib/libshout.a(tls.o): In function `tls_setup_process':
/cygdrive/d/Programme/utility/libshout-2.4.1/src/tls.c:200: undefined reference to `SSL_is_init_finished'
/cygdrive/d/Programme/utility/libshout-2.4.1/src/tls.c:200:(.text+0x74): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `SSL_is_init_finished'
/cygdrive/d/Programme/utility/libshout-2.4.1/src/tls.c:203: undefined reference to `SSL_is_init_finished'
/cygdrive/d/Programme/utility/libshout-2.4.1/src/tls.c:203:(.text+0x8f): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `SSL_is_init_finished'
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../lib/libshout.a(tls.o): In function `tls_setup':
/cygdrive/d/Programme/utility/libshout-2.4.1/src/tls.c:66: undefined reference to `OPENSSL_init_ssl'
/cygdrive/d/Programme/utility/libshout-2.4.1/src/tls.c:66:(.text+0x4ad): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `OPENSSL_init_ssl'
/cygdrive/d/Programme/utility/libshout-2.4.1/src/tls.c:67: undefined reference to `OPENSSL_init_ssl'
/cygdrive/d/Programme/utility/libshout-2.4.1/src/tls.c:67:(.text+0x4b9): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `OPENSSL_init_ssl'
/cygdrive/d/Programme/utility/libshout-2.4.1/src/tls.c:68: undefined reference to `SSLeay_add_all_algorithms'
/cygdrive/d/Programme/utility/libshout-2.4.1/src/tls.c:68:(.text+0x4be): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `SSLeay_add_all_algorithms'
/cygdrive/d/Programme/utility/libshout-2.4.1/src/tls.c:69: undefined reference to `OPENSSL_init_ssl'
/cygdrive/d/Programme/utility/libshout-2.4.1/src/tls.c:69:(.text+0x4c7): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `OPENSSL_init_ssl'
collect2: error: ld returned 1 exit status
I'm using CygWin's GCC 64 bit version, butalso got a 32 version to compile with if needed.
The build is triggered using make
My actual code up to now is pretty basic (I'm only just getting started with this library)
#include <iostream>
#include <shout/shout.h>
int main() {
shout_init();
std::cout << "!!!Hello World!!!" << std::endl; // prints !!!Hello World!!!
return 0;
}
I use the following libraries for the linker in this Order(-l):
shout -> the actual library i try to use
vorbis
ogg
ssl
crypto
From the look of the error I suppose, that this is related to ssl somehow, but i did include those didn't I ?
I already tried rotating the order, but that only created more errors, so I suppose the order is correct ...
Edit 1:
As nnovich-OK suggested, I altered my code like this to check OpenSSL:
#include <iostream>
//#include <shout/shout.h>
#include <ctype.h>
#include <openssl/ssl.h>
int main() {
//shout_init();
OPENSSL_init();
OPENSSL_INIT_SETTINGS * test = NULL;
OPENSSL_init_ssl(0,test);
//SSL_is_init_finished();
std::cout << "!!!Hello World!!!" << std::endl; // prints !!!Hello World!!!
return 0;
}
There resulting Linking error looks like this:
g++ -L"D:\Programme\Cygwin\usr\x86_64-w64-mingw32\sys-root\mingw\include\ogg" -L"D:\Programme\Cygwin\usr\x86_64-w64-mingw32\sys-root\mingw\include" -L"D:\Programme\Cygwin\usr\x86_64-w64-mingw32\sys-root\mingw\include\vorbis" -o "LibshoutJavaAdapter.exe" ./src/LibshoutJavaAdapter.o -lshout -lvorbis -logg -lssl -lcrypto
./src/LibshoutJavaAdapter.o: In function `main':
/cygdrive/d/Install und andere Sachen/Eclipse/C++/LibshoutJavaAdapter/Debug/../src/LibshoutJavaAdapter.cpp:18: undefined reference to `OPENSSL_init_ssl'
/cygdrive/d/Install und andere Sachen/Eclipse/C++/LibshoutJavaAdapter/Debug/../src/LibshoutJavaAdapter.cpp:18:(.text+0x27): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `OPENSSL_init_ssl'
collect2: error: ld returned 1 exit status
I see that there is a problem with OPENSSL_init_ssl from ssl.h but not with OPENSSL_init from crypto.h (witch intern is included by ssl.h)
Does that gives anyone any idea?
Any hints to resolving this Problem appreciated
I don't have the same setup to try, but provided info seems clear enough. Linker can't find functions from ssl library, so you need to focus on linking ssl. I think, issue scenario can be reduced to simple main function calling OPENSSL_init_ssl() (parameters doesn't matter, since you aren't going to execute it) and build process involving linking only openssl. Resolving this linking failure will help to resolve your current case. So let the Google and SO be with you :)
PS I'd rather put all this into comment, but SO newcomers aren't allowed to.
Edit:
Subsequent troubleshooting (check comments below) revealed actual root cause. System has several libssl instances (e.g. some app installation brought another version) and linker used instance not suitable for current build (e.g. 32bit version in building 64bit app). So the solution was to put linker into verbose mode and to check whether library paths are as expected.
My setup is the following: I have a CMake based C++ project on Windows. As compiler I use the MinGW 32 Bit compiler which is delivered by the Qt 5.7 release for Windows (MinGW 5.3.0). I use this compiler since it works with the generated Makefiles. The generator is "MinGW Makefiles". Other compilers like Clang for Windows were not able to compile the generated Makefiles, probably because a Windows version of Make was missing?
Since the manual compilation of Boost Libraries takes a long time I use the prebuild binaries (https://sourceforge.net/projects/boost/files/boost-binaries/1.62.0_b2/) for msvc14.0-32. I've setup the CMake variables etc. and the libraries for Boost Release are found. Strangely the debug libraries are not found, so I have to use the build type "Release" with CMake.
Here are some variables:
CMAKE_BUILD_TYPE is "Release"
CMAKE_CXX_COMPILER is "C:/Qt/Tools/mingw530_32/bin/g++.exe".
CMAKE_GENERATOR is "MinGW Makefiles"
CMAKE_MAKE_PROGRAM is "C:/Qt/Tools/mingw530_32/bin/mingw32-make.exe"
BOOST_ROOT is "C:/local/boost_1_62_0_b2"
BOOST_LIBRARYDIR is "C:/local/boost_1_62_0_b2/lib32-msvc-14.0", Boost_COMPILER is "-vc140"
Boost_LIBRARY_DIR_DEBUG is "C:/local/boost_1_61_0/lib64-msvc-14.0"
Boost_LIBRARY_DIR_RELEASE is "C:/local/boost_1_61_0/lib64-msvc-14.0"
Boost_FILESYSTEM_LIBRARY_DEBUG is "Boost_FILESYSTEM_LIBRARY_DEBUG-NOTFOUND"
Boost_FILESYSTEM_LIBRARY_RELEASE is "C:/local/boost_1_61_0/lib64-msvc-14.0/libboost_filesystem-vc140-mt-1_61.lib"
When I compile my project it generates many undefined references errors:
CMakeFiles\wc3libmpq.dir/objects.a(hash.cpp.obj):hash.cpp:(.text+0x559): undefined reference to `boost::filesystem::path::codecvt()'
CMakeFiles\wc3libmpq.dir/objects.a(hash.cpp.obj):hash.cpp:(.text+0x571): undefined reference to `boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::codecvt<wchar_t, char, int> const&)'
CMakeFiles\wc3libmpq.dir/objects.a(hash.cpp.obj):hash.cpp:(.text+0x586): undefined reference to `boost::filesystem::path::codecvt()'
CMakeFiles\wc3libmpq.dir/objects.a(hash.cpp.obj):hash.cpp:(.text+0x59e): undefined reference to `boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::codecvt<wchar_t, char, int> const&)'
CMakeFiles\wc3libmpq.dir/objects.a(hash.cpp.obj):hash.cpp:(.text+0x78b): undefined reference to `boost::filesystem::path::codecvt()'
CMakeFiles\wc3libmpq.dir/objects.a(hash.cpp.obj):hash.cpp:(.text+0x7a7): undefined reference to `boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::codecvt<wchar_t, char, int> const&)'
These are some of them. I guess it does not work since they were compiled with a different compiler (vc140) and not the MinGW 32 from Qt but I did not find any prebuild Boost Libraries with MinGW32 for Windows.
Ideally, I'd like to setup the build with Clang 64 Bit but as I wrote the Generator "MinGW Makefiles" of CMake and the specified Make tool CMAKE_MAKE_PROGRAM with the value "C:/Qt/Tools/mingw530_32/bin/mingw32-make.exe" do not work with the CLang build for Windows. Qt 5 does not offer any MinGW 64 version. Besides the undefined references error might occur as well since Boost has been built with msvc.
So my questions are:
Is there a MinGW32 based build of the Boost Libraries for Windows somewhere which works with Qt's MinGW32 compiler?
OR which would be even more useful
Is there a CMake Generator and Make tool which work together with the 64 Bit CLang on Windows AND a build of the Boost Libraries for Windows which does also work with CLang? In this case I'd also need a Qt 5.7 Windows build which works with CLang and is 64 bit since the MinGW build of Qt 5.7 is 32 bit.
I would like to avoid any effort to compile any dependency libraries myself on Windows.
edit:
After compiling the Boost Libraries by myself with Cygwin (GCC) I still get undefined references to the Boost Libraries. I link to the static libraries (.a) files:
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0x8d4): undefined reference to `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0x8d4): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0x964): undefined reference to `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0x964): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0xae8): undefined reference to `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0xae8): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0xb08): undefined reference to `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0xb08): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0xb22): undefined reference to `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0xb22): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0xf19): more undefined references to `boost::system::system_category()' follow
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0xf19): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0xf40): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0x1019): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0x1040): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0x1119): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0x1140): additional relocation overflows omitted from the output
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0x47bc): undefined reference to `boost::system::generic_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0x4bcb): undefined reference to `boost::system::generic_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0x4d69): undefined reference to `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0x4d92): undefined reference to `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0x4db5): undefined reference to `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0x4e9c): undefined reference to `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0x4ef6): undefined reference to `boost::system::system_category()'
E:/Projekte/boost_1_61_0/stage/lib/libboost_filesystem.a(operations.o):operations.cpp:(.text+0x4f38): more undefined references to `boost::system::system_category()' follow
E:/Projekte/boost_1_61_0/stage/lib/libboost_iostreams.a(bzip2.o):bzip2.cpp:(.text+0x327): undefined reference to `BZ2_bzDecompressEnd'
E:/Projekte/boost_1_61_0/stage/lib/libboost_iostreams.a(bzip2.o):bzip2.cpp:(.text+0x341): undefined reference to `BZ2_bzCompressEnd'
E:/Projekte/boost_1_61_0/stage/lib/libboost_iostreams.a(bzip2.o):bzip2.cpp:(.text+0x390): undefined reference to `BZ2_bzDecompressInit'
E:/Projekte/boost_1_61_0/stage/lib/libboost_iostreams.a(bzip2.o):bzip2.cpp:(.text+0x3af): undefined reference to `BZ2_bzCompressInit'
E:/Projekte/boost_1_61_0/stage/lib/libboost_iostreams.a(bzip2.o):bzip2.cpp:(.text+0x145): undefined reference to `BZ2_bzCompress'
E:/Projekte/boost_1_61_0/stage/lib/libboost_iostreams.a(bzip2.o):bzip2.cpp:(.text+0x155): undefined reference to `BZ2_bzDecompress'
E:/Projekte/boost_1_61_0/stage/lib/libboost_iostreams.a(zlib.o):zlib.cpp:(.text+0x12c): undefined reference to `crc32'
E:/Projekte/boost_1_61_0/stage/lib/libboost_iostreams.a(zlib.o):zlib.cpp:(.text+0x1a5): undefined reference to `deflateReset'
E:/Projekte/boost_1_61_0/stage/lib/libboost_iostreams.a(zlib.o):zlib.cpp:(.text+0x1c5): undefined reference to `inflateEnd'
E:/Projekte/boost_1_61_0/stage/lib/libboost_iostreams.a(zlib.o):zlib.cpp:(.text+0x1e1): undefined reference to `inflateReset'
E:/Projekte/boost_1_61_0/stage/lib/libboost_iostreams.a(zlib.o):zlib.cpp:(.text+0x1f3): undefined reference to `deflateEnd'
E:/Projekte/boost_1_61_0/stage/lib/libboost_iostreams.a(zlib.o):zlib.cpp:(.text+0x407): undefined reference to `inflateInit2_'
E:/Projekte/boost_1_61_0/stage/lib/libboost_iostreams.a(zlib.o):zlib.cpp:(.text+0x450): undefined reference to `deflateInit2_'
E:/Projekte/boost_1_61_0/stage/lib/libboost_iostreams.a(zlib.o):zlib.cpp:(.text+0x174): undefined reference to `deflate'
E:/Projekte/boost_1_61_0/stage/lib/libboost_iostreams.a(zlib.o):zlib.cpp:(.text+0x184): undefined reference to `inflate'
collect2: error: ld returned 1 exit status
mingw32-make.exe[2]: *** [src/mpq/libwc3libmpq.dll] Error 1
mingw32-make.exe[1]: *** [src/mpq/CMakeFiles/wc3libmpq.dir/all] Error 2
mingw32-make.exe: *** [all] Error 2
Strangely I don't get any undefined references for the unit test library of Boost. I have compiled the libraries using Cygwin's GCC and my library paths to Boost look like:
E:/Projekte/boost_1_61_0/stage/lib/libboost_unit_test_framework.a
First I have compiled the iostreams library with cygwin:
./b2.exe -j4 toolset=gcc --with-iostreams -s BZIP2_SOURCE=E:/Projekte/wc3lib/windows/bzip2-1.0.6 -s ZLIB_SOURCE=E:/Projekte/wc3lib/windows/zlib-1.2.8 stage
The I compiled all other libraries:
./b2.exe -j4 toolset=gcc stage
These are my search instructions in CMake:
if (WIN32)
add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED=1)
set(Boost_USE_STATIC_LIBS ON)
include_directories("C:/Program Files/GnuWin32/include")
endif ()
find_package(Boost COMPONENTS system filesystem serialization program_options iostreams regex REQUIRED)
I'm trying to use gtest in my cpp project, and there's probably a linkage error.
It also does not recognize the main that is in test folder.
Building target: MovieSystem
Invoking: Cross G++ Linker
g++ -o "MovieSystem" ./src/Actor.o ./src/Director.o ./src/Menu.o ./src/Movie.o ./src/Producer.o ./src/Professional.o ./src/ScreenWriter.o ./src/System.o ./src/factorial.o -lpthread
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 3 has invalid symbol index 2
...
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_line): relocation 0 has invalid symbol index 2
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [MovieSystem] Error 1
Just to mention, I followed the instructions in here completely:
http://www.codeproject.com/Articles/811934/Cplusplus-unit-test-start-guide-how-to-set-up-Goog
So what did I do wrong?
Thank you!
I'm trying to build a C++ program for the Renesas RL78/G13 series of MCUs. I was previously using the IAR toolchain without a problem but now I want to use the GNU RL78 toolchain so I can use some Renesas libraries.
My problem is that I now cannot get the program to link, seemingly because of missing symbols. Any advice would be really appreciated.
Here's the console output from the linker:
'Invoking: Linker'
'Building target:'
rl78-elf-ld -o "firmware_2.x" -T"C:\Projects\ms_monitor\firmware_2\HardwareDebug\firmware_2_HardwareDebug_auto.gsi" -T"C:\Projects\ms_monitor\firmware_2\HardwareDebug\LinkerSubCommand.tmp" libfirmware_2.a -M=firmware_2.map -e_PowerON_Reset -L"C:\Projects\ms_monitor\firmware_2\lib" -L"C:\Projects\ms_monitor\firmware_2\HardwareDebug" -L"C:\Renesas\e2studio\GNURL7~1.01-\rl78-elf\rl78-elf\lib" -L"C:\Renesas\e2studio\GNURL7~1.01-\rl78-elf\lib\gcc\rl78-elf\4.8-GNURL78_v13.01" --start-group -lstdc++ -lfirmware_2 -lgcc --end-group
rl78-elf-ld: section .vects loaded at [00000004,0000007f] overlaps section .vec loaded at [00000000,00000005]
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x2): undefined reference to `_stack'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x9): undefined reference to `_datastart'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0xc): undefined reference to `_romdatastart'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x11): undefined reference to `_romdatacopysize'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x29): undefined reference to `_bssstart'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x31): undefined reference to `_bsssize'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x4c): undefined reference to `etext'
libfirmware_2.a(gcrt0.o): In function `start':
(.text+0x65): undefined reference to `exit'
libfirmware_2.a(gcrt0.o): In function `rl78_run_preinit_array':
(.text+0x69): undefined reference to `_preinit_array_start'
libfirmware_2.a(gcrt0.o): In function `rl78_run_preinit_array':
(.text+0x6c): undefined reference to `_preinit_array_end'
libfirmware_2.a(gcrt0.o): In function `rl78_run_init_array':
(.text+0x74): undefined reference to `_init_array_start'
libfirmware_2.a(gcrt0.o): In function `rl78_run_init_array':
(.text+0x77): undefined reference to `_init_array_end'
libfirmware_2.a(gcrt0.o): In function `rl78_run_fini_array':
(.text+0x7f): undefined reference to `_fini_array_start'
libfirmware_2.a(gcrt0.o): In function `rl78_run_fini_array':
(.text+0x82): undefined reference to `_fini_array_end'
./src/utilities/csv_loader.o: In function `CsvLoader_Create':
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:75:(.text+0xe): relocation truncated to fit: R_RL78_DIR16S against `.LC0'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:75:(.text+0x18): relocation truncated to fit: R_RL78_DIR16S against `CsvLoader_Create::__PRETTY_FUNCTION__'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:75:(.text+0x1d): relocation truncated to fit: R_RL78_DIR16S against `.LC1'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:76:(.text+0x31): relocation truncated to fit: R_RL78_DIR16S against `.LC0'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:76:(.text+0x3b): relocation truncated to fit: R_RL78_DIR16S against `CsvLoader_Create::__PRETTY_FUNCTION__'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:76:(.text+0x40): relocation truncated to fit: R_RL78_DIR16S against `.LC2'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:77:(.text+0x56): relocation truncated to fit: R_RL78_DIR16S against `.LC0'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:77:(.text+0x60): relocation truncated to fit: R_RL78_DIR16S against `CsvLoader_Create::__PRETTY_FUNCTION__'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:77:(.text+0x65): relocation truncated to fit: R_RL78_DIR16S against `.LC3'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:78:(.text+0x79): relocation truncated to fit: R_RL78_DIR16S against `.LC0'
C:\Projects\ms_monitor\firmware_2\HardwareDebug/../src/utilities/csv_loader.cpp:78:(.text+0x83): additional relocation overflows omitted from the output
libfirmware_2.a(mcount.o): In function `_monstartup':
(.text+0x67b): undefined reference to `ffs'
libfirmware_2.a(printf.o): In function `_printf_r':
(.text+0x30): undefined reference to `_vfprintf_r'
libfirmware_2.a(printf.o): In function `printf':
(.text+0x75): undefined reference to `_vfprintf_r'
libfirmware_2.a(snprintf.o): In function `_snprintf_r':
(.text+0x8d): undefined reference to `_svfprintf_r'
libfirmware_2.a(snprintf.o): In function `snprintf':
(.text+0x165): undefined reference to `_svfprintf_r'
libfirmware_2.a(sprintf.o): In function `_sprintf_r':
(.text+0x4f): undefined reference to `_svfprintf_r'
libfirmware_2.a(sprintf.o): In function `sprintf':
(.text+0xbf): undefined reference to `_svfprintf_r'
libfirmware_2.a(vfiprintf.o): In function `_vfiprintf_r':
(.text+0x1bed): undefined reference to `_free_r'
libfirmware_2.a(vfiprintf.o): In function `_vfiprintf_r':
(.text+0x1c83): undefined reference to `_free_r'
libfirmware_2.a(wsetup.o): In function `__swsetup_r':
(.text+0xf8): undefined reference to `_free_r'
libfirmware_2.a(calloc.o): In function `calloc':
(.text+0x16): undefined reference to `_calloc_r'
libfirmware_2.a(fflush.o): In function `__sflush_r':
(.text+0x324): undefined reference to `_free_r'
libfirmware_2.a(findfp.o): In function `__sfmoreglue':
(.text+0xf2): undefined reference to `_malloc_r'
libfirmware_2.a(fvwrite.o): In function `__sfvwrite_r':
(.text+0x25e): undefined reference to `_malloc_r'
libfirmware_2.a(fvwrite.o): In function `__sfvwrite_r':
(.text+0x2de): undefined reference to `_realloc_r'
libfirmware_2.a(fvwrite.o): In function `__sfvwrite_r':
(.text+0x2ff): undefined reference to `_free_r'
libfirmware_2.a(makebuf.o): In function `__smakebuf_r':
(.text+0x1a2): undefined reference to `_malloc_r'
libfirmware_2.a(malloc.o): In function `malloc':
(.text+0x10): undefined reference to `_malloc_r'
libfirmware_2.a(malloc.o): In function `free':
(.text+0x26): undefined reference to `_free_r'
libfirmware_2.a(reent.o): In function `cleanup_glue':
(.text+0x3c): undefined reference to `_free_r'
libfirmware_2.a(reent.o): In function `_reclaim_reent':
(.text+0xb1): undefined reference to `_free_r'
libfirmware_2.a(reent.o): In function `_reclaim_reent':
(.text+0xe6): undefined reference to `_free_r'
libfirmware_2.a(reent.o): In function `_reclaim_reent':
(.text+0x111): undefined reference to `_free_r'
libfirmware_2.a(reent.o):(.text+0x172): more undefined references to `_free_r' follow
C:\Projects\ms_monitor\firmware_2\HardwareDebug\libfirmware_2.a(realloc.o): In function `realloc':
(.text+0x16): undefined reference to `_realloc_r'
make: *** [firmware_2.x] Error 1
This question was answered after a lot of support from the KPIT GNU team.
I had incorrect linker files for the processor that I was trying to compile for (as in, the linker file was correct but its contents not). Not only that, some missing symbols depended on how the workspace was configured.
If you see this problem yourself, the first step is to contact KPIT GNU, as I would not have known that there was a problem with the files without asking them.