I have a "CMakified" version of CryptoPP and I am using CMake-GUI to create a MakeFile which ming-make could process as shown in the image below.
The "MakeFile" creation was successful but when I executed mingw32-make.exe I got below errors at the very end.
Linking CXX executable cryptest.exe
CMakeFiles\cryptest.dir/objects.a(test.cpp.obj):test.cpp:(.text+0x8e82): undefined reference to `setsockopt#20'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x5cb): undefined reference to `socket#12'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x643): undefined reference to `closesocket#4'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x6f0): undefined reference to `htonl#4'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x70a): undefined reference to `inet_addr#4'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x759): undefined reference to `htons#4'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x7f4): undefined reference to `bind#12'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x85b): undefined reference to `listen#8'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x909): undefined reference to `inet_addr#4'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x922): undefined reference to `gethostbyname#4'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x978): undefined reference to `htons#4'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0xa18): undefined reference to `connect#12'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0xaac): undefined reference to `accept#12'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0xb58): undefined reference to `getsockname#12'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0xbc6): undefined reference to `getpeername#12'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0xc87): undefined reference to `send#16'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0xd83): undefined reference to `recv#16'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0xe25): undefined reference to `shutdown#8'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0xe96): undefined reference to `ioctlsocket#12'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0xfbb): undefined reference to `select#20'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x1010): undefined reference to `select#20'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x11a1): undefined reference to `select#20'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x11f6): undefined reference to `select#20'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x133f): undefined reference to `getservbyname#8'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x1407): undefined reference to `ntohs#4'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x1526): undefined reference to `WSAStartup#8'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x16cf): undefined reference to `WSACleanup#0'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x17fb): undefined reference to `WSAGetLastError#0'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x180f): undefined reference to `WSASetLastError#4'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x1cfc): undefined reference to `WSARecv#28'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x1d27): undefined reference to `WSAGetLastError#0'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x1f61): undefined reference to `WSAGetOverlappedResult#20'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x1f8c): undefined reference to `WSAGetLastError#0'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x2397): undefined reference to `WSASend#28'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x23c1): undefined reference to `WSAGetLastError#0'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x24cc): undefined reference to `WSAEventSelect#12'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x2587): undefined reference to `WSAEnumNetworkEvents#12'
libcryptopp.a(socketft.cpp.obj):socketft.cpp:(.text+0x2a01): undefined reference to `WSAGetOverlappedResult#20'
collect2.exe: error: ld returned 1 exit status
mingw32-make[2]: *** [cryptest.exe] Error 1
mingw32-make[1]: *** [CMakeFiles/cryptest.dir/all] Error 2
mingw32-make: *** [all] Error 2
I tried adding LDLIBS += -lws2_32 to the very end of the make file but this didn't help. I guess these errors are because the target link libraries are not mentioned in the make file but I am not sure how to do this.
CMakeLists.txt should call
target_link_libraries(cryptopp ws2_32)
after command ADD_LIBRARY to resolve undefined references.
After following Kieth's comments above I figured out that neither LIBS nor LDLIBS are honoured by CMAKE. The variable to use is CXX_STANDARD_LIBRARIES. I did the below change in the CMAKE Advanced options:
I added -lws2_32 at the very end and then generated the "MakeFile" .
This solved the issue.
Related
I have build the gst-build Gstreamer 1.18 version, after installing libsoup2.4-dev and I can see that the dependency is detected:
|Dependency libsoup-2.4 found: YES 2.62.1 (cached).
Later on, compiling the project that I am developing related with WebRTC I have the following issue. How can I solve it?
undefined reference to `soup_websocket_connection_close'
undefined reference to `soup_logger_new'
undefined reference to `soup_websocket_connection_get_state'
undefined reference to `soup_message_new'
undefined reference to `soup_session_websocket_connect_async'
undefined reference to `soup_session_new_with_options'
undefined reference to `soup_session_websocket_connect_finish'
undefined reference to `soup_session_add_feature'
undefined reference to `_SOUP_METHOD_GET'
undefined reference to `soup_websocket_connection_send_text'
undefined reference to `soup_session_feature_get_type
collect2: error: ld returned 1 exit status
I'm trying to install FluentBit on Centos.
While running make it fails at 83% and I'm unable to understand the error. Cannot find anything in the web relating to this. Can someone please help me.
[ 83%] Building C object src/CMakeFiles/fluent-bit-bin.dir/fluent-bit.c.o
[ 83%] Building C object src/CMakeFiles/fluent-bit-bin.dir/flb_dump.c.o
Linking C executable ../bin/fluent-bit
../library/libflb-plugin-filter_grep.a(grep.c.o): In function `delete_rules':
grep.c:(.text+0x4e3): undefined reference to `flb_ra_destroy'
../library/libflb-plugin-filter_grep.a(grep.c.o): In function `set_rules':
grep.c:(.text+0x861): undefined reference to `flb_ra_create'
../library/libflb-plugin-filter_grep.a(grep.c.o): In function `grep_filter_data':
grep.c:(.text+0xa6a): undefined reference to `flb_ra_regex_match'
../library/libflb-plugin-filter_rewrite_tag.a(rewrite_tag.c.o): In function `process_config':
rewrite_tag.c:(.text+0x9b5): undefined reference to `flb_ra_create'
rewrite_tag.c:(.text+0xa9c): undefined reference to `flb_ra_destroy'
rewrite_tag.c:(.text+0xade): undefined reference to `flb_ra_create'
rewrite_tag.c:(.text+0xb3b): undefined reference to `flb_ra_destroy'
../library/libflb-plugin-filter_rewrite_tag.a(rewrite_tag.c.o): In function `process_record':
rewrite_tag.c:(.text+0xf6a): undefined reference to `flb_ra_regex_match'
rewrite_tag.c:(.text+0xfe2): undefined reference to `flb_ra_translate'
../library/libflb-plugin-filter_rewrite_tag.a(rewrite_tag.c.o): In function `destroy_rules':
rewrite_tag.c:(.text+0x12a3): undefined reference to `flb_ra_destroy'
rewrite_tag.c:(.text+0x12b3): undefined reference to `flb_ra_destroy'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/fluent-bit] Error 1
make[1]: *** [src/CMakeFiles/fluent-bit-bin.dir/all] Error 2
make: *** [all] Error 2
There are several posts citing this (or similar) undefined references, but none of those was of help.
I have code which compiles nicely on gentoo 4.14.83, with both gcc-7.3.0 and gcc-8.2.0.
On CentOS 7 (CentOS Linux release 7.6.1810 (Core)), however, the linker of g++-7.3.1 says:
/home/jody/progs/multi_spc_QHG3/kernel/Geography.cpp:68: undefined reference to `__cxa_throw_bad_array_new_length'
/home/jody/progs/multi_spc_QHG3/kernel/Geography.cpp:69: undefined reference to `__cxa_throw_bad_array_new_length'
/home/jody/progs/multi_spc_QHG3/kernel/Geography.cpp:70: undefined reference to `__cxa_throw_bad_array_new_length'
/home/jody/progs/multi_spc_QHG3/kernel/Geography.cpp:71: undefined reference to `__cxa_throw_bad_array_new_length'
The referenced lines in Geography.cpp have simple new statements:
m_adLatitude = new geonumber[m_iNumCells];
m_adLongitude = new geonumber[m_iNumCells];
m_adAltitude = new geonumber[m_iNumCells];
m_adDistances = new geonumber[m_iNumCells*m_iMaxNeighbors];
(the type geonumber is actually double, m_iNumCells and m_iMaxNeighbors have type int)
Because i need g++ version 7, i use the compiler from devtoolset-7-gcc.x86_64.
Some of the posts i found stated that this error is caused by missing libstdc++, but this is not the case here.
What causes this error, and how can it be fixed?
I am trying to follow this simple guide https://www.polymer-project.org/3.0/docs/tools/create-element-polymer-cli
I pasted bellow the whole exception:
C:\dev\polymer2\sample\my-el>polymer init
'uname' is not recognized as an internal or external command,
operable program or batch file.
? Which starter template would you like to use? polymer-3-element
info: [init] Running template polymer-3-element...
? Element name my-el
? Brief description of the element test
error: [cli.main] Uncaught exception: AssertionError [ERR_ASSERTION]: Trying to copy from a source that does not exist
: C:\Users\myuser\AppData\Roaming\npm\node_modules\polymer-cli\templates\element\polymer-3.x\.gitignore
error: [cli.main] AssertionError [ERR_ASSERTION]: Trying to copy from a source that does not exist: C:\Users\myuser\
AppData\Roaming\npm\node_modules\polymer-cli\templates\element\polymer-3.x\.gitignore
at EditionInterface.exports.copy (C:\Users\myuser\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\mem-fs
-editor\lib\actions\copy.js:47:3)
at EditionInterface.module.exports [as copyTpl] (C:\Users\myuser\AppData\Roaming\npm\node_modules\polymer-cli\node
_modules\mem-fs-editor\lib\actions\copy-tpl.js:10:8)
at Polymer3ElementGenerator.writing (C:\Users\myuser\AppData\Roaming\npm\node_modules\polymer-cli\lib\init\element
\element.js:124:21)
at Object.<anonymous> (C:\Users\myuser\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\yeoman-generator\
lib\index.js:417:23)
at C:\Users\myuser\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\run-async\index.js:25:25
at new Promise (<anonymous>)
at C:\Users\myuser\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\run-async\index.js:24:19
at C:\Users\myuser\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\yeoman-generator\lib\index.js:418:9
at runCallback (timers.js:794:20)
at tryOnImmediate (timers.js:752:5)
When connecting to a project on Ada QT library produces errors.
with QT; use QT;
.....
Log.
E:\GNAT\2013\qtada\qt-qchar.o:qt-qchar.adb:(.text+0x14): undefined reference to QChar1_create'
E:\GNAT\2013\qtada\qt-qchar.o:qt-qchar.adb:(.text+0x30): undefined reference toQChar2_create'
E:\GNAT\2013\qtada\qt-qchar.o:qt-qchar.adb:(.text+0x5a): undefined reference to QChar3_create'
E:\GNAT\2013\qtada\qt-qchar.o:qt-qchar.adb:(.text+0x6f): undefined reference toQChar4_create'
E:\GNAT\2013\qtada\qt-qchar.o:qt-qchar.adb:(.text+0x8b): undefined reference to QChar5_create'
E:\GNAT\2013\qtada\qt-qchar.o:qt-qchar.adb:(.text+0xa7): undefined reference toQChar6_create'
E:\GNAT\2013\qtada\qt-qchar.o:qt-qchar.adb:(.text+0xbb): undefined reference to QChar7_create'
E:\GNAT\2013\qtada\qt-qchar.o:qt-qchar.adb:(.text+0xcf): undefined reference toQChar8_create'
E:\GNAT\2013\qtada\qt-qchar.o:qt-qchar.adb:(.text+0xe3): undefined reference to QChar_latin1'
e:/gnat/2013/bin/../libexec/gcc/i686-pc-mingw32/4.7.4/ld.exe: E:\GNAT\2013\qtada\qt-qchar.o: bad reloc address 0x20 in section.eh_frame'
e:/gnat/2013/bin/../libexec/gcc/i686-pc-mingw32/4.7.4/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
gprbuild: link of main.adb failed
[2014-04-28 08:15:40] process exited with status 4 (elapsed time: 01.50s)
Are your installed QT,QTADA libraries compatible with the Mingw-Toolchain? Also regarding the bitness 32/64. The Versions of your libraries and the compile/linker command would be helpful.
You might also consider following hint:
GMP with MinGW on Windows