I am trying to build C++ code using GCC 4.3.4 on SLES-15 and getting below error.
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: /lib/libc.so.6:
(*IND*+0x0): multiple definition of __umoddi3
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: /lib/libc.so.6:
(*IND*+0x0): multiple definition of __udivdi3
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: LicenseFile.o: in function `remove_dots(char const*)':
LicenseFile.cpp:(.text+0x16a8): undefined reference to `__gnu_cxx::__exchange_and_add(int*, int)'
I believe these both error a linked to same root cause, as same works on SLES-11 with GCC 4.3.4.
The default gcc version on SLES-15 is gcc 7 and I have installed gcc 4.3.4 and created softlink for g++-4.3.4 and gcc-4.3.4 as g++ and gcc respectively.
Below is the linker command
/usr/bin/g++ -m32 -pipe -O3 -fPIC -shared -Wl,-soname -Wl,libmgutil.so.5.6.4 -Wl,--no-undefined LicenseFile.o projectException.o projectResource.o projectServiceBase.o MessageStoreUtils.o OpenSSLInitializer.o ServiceConfigBase.o SmartHeapInit.o TimezoneManager.o Utils.o PriorityUtils.o stats_utils.o unix/projectService.o unix/projectLog.o unix/projectTrace.o unix/ServiceConfig.o -L/home/build/builds/project/build/Linux-i686-SLES11/Release -L/home/build/builds/project/ivy-dist/Linux-i686-SLES11-Release/lib -L/home/build/builds/project/ivy-dist/Linux-i686-SLES11/lib -L/home/build/builds/project/ivy-dist/Linux-i686-SLES11-Release/lib -L/home/build/builds/project/ivy-dist/Linux-i686-SLES11/lib -L/home/build/builds/project/projectSDK/proto/Linux-i686-SLES11-opt/lib -L/home/build/builds/project/build/Linux-i686-SLES11-opt/license/4.0.0-nightly/lib -L/home/build/builds/project/Shared/C/licensing/build/Linux-i686-SLES11/Release -L/home/build/builds/project/project/proto/Linux-i686-SLES11-opt/lib -Wl,--start-group -lCore -lssl -lcrypto -lmysqlclient -lboris -lapplic -llicense -lhermes -lpthread -lospace -ldl -Wl,--end-group -o /home/build/builds/project/build/Linux-i686-SLES11/Release/libmgutil.so.5.6.4
and the code from LicenseFile.cpp is (see the bold line where I believe it needs the _exchange_and_add() )
std::string td::string remove_dots(const char* host_id)
{
std::string output;
std::string str(host_id);
for (size_t i = 0; i < str.size(); ++i) {
if (str[i] != ':') **output += str[i];**
}
return output;
}