The LIBUUID macro does not allow you to build a library

25 views
Skip to first unread message

Александр А

unread,
Jan 23, 2023, 11:43:37 PM1/23/23
to MQTT
I need to build a library with a macro because I get an error when building my code

```
./paho.mqtt.c/build/src/libpaho-mqtt3a.a(WebSocket.c.o): In function `uuid_generate':
WebSocket.c:(.text+0x11): multiple definition of `uuid_generate'
./util-linux/libuuid/src/libuuid_la-gen_uuid.o:/root/utils/util-linux/libuuid/src/gen_uuid.c:551: first defined here
./paho.mqtt.c/build/src/libpaho-mqtt3a.a(WebSocket.c.o): In function `uuid_unparse':
WebSocket.c:(.text+0xc0): multiple definition of `uuid_unparse'
./util-linux/libuuid/src/libuuid_la-unparse.o:/root/utils/util-linux/libuuid/src/unparse.c:74: first defined here
collect2: error: ld returned 1 exit status

```
If I configure the library like this, then the error when making
cmake -DPAHO_BUILD_STATIC=TRUE -DPAHO_WITH_SSL=TRUE -DCMAKE_C_FLAGS=-DLIBUUID

```
[ 60%] Linking C executable test_connect_destroy
../src/libpaho-mqtt3c.a(WebSocket.c.o): In function `WebSocket_connect':
WebSocket.c:(.text+0x5cc): undefined reference to `uuid_generate'
collect2: error: ld returned 1 exit status
test/CMakeFiles/test_sync_session_present-static.dir/build.make:95: recipe for target 'test/test_sync_session_present-static' failed
make[2]: *** [test/test_sync_session_present-static] Error 1
CMakeFiles/Makefile2:842: recipe for target 'test/CMakeFiles/test_sync_session_present-static.dir/all' failed
make[1]: *** [test/CMakeFiles/test_sync_session_present-static.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 61%] Building C object src/CMakeFiles/paho-mqtt3as-static.dir/SSLSocket.c.o
../src/libpaho-mqtt3c.so.1.3.12: undefined reference to `uuid_generate'
collect2: error: ld returned 1 exit status
test/CMakeFiles/test_connect_destroy.dir/build.make:95: recipe for target 'test/test_connect_destroy' failed
make[2]: *** [test/test_connect_destroy] Error 1
CMakeFiles/Makefile2:990: recipe for target 'test/CMakeFiles/test_connect_destroy.dir/all' failed
make[1]: *** [test/CMakeFiles/test_connect_destroy.dir/all] Error 2
[ 61%] Linking C static library libpaho-mqtt3a.a
[ 61%] Linking C static library libpaho-mqtt3as.a
[ 61%] Built target paho-mqtt3a-static
[ 61%] Built target paho-mqtt3as-static
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

```
Reply all
Reply to author
Forward
0 new messages