Compilation sadly ending with /usr/bin/ld: cannot find -luuid

Hello guys,
I am encountering the following issue when trying to compile a program using make :

/usr/bin/ld: cannot find -luuid
collect2: error: ld returned 1 exit status

even though libuuid is installed :

 $    stat /usr/lib64/libuuid.so
      File: /usr/lib64/libuuid.so -> libuuid.so.1.3.0
      Size: 16              Blocks: 0          IO Block: 4096   symbolic link
    Device: 803h/2051d      Inode: 795886      Links: 1
    Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
    Access: 2020-01-29 15:29:07.733340088 +0100
    Modify: 2020-01-23 23:55:55.000000000 +0100
    Change: 2020-01-29 15:28:03.752342338 +0100
     Birth: 2020-01-29 14:35:34.907453077 +0100

and I can’t get to fix it.

Have you got any ideas on what is going on?
Thank you
Shawn

Do: sudo swupd bundle-add devpkg-util-linux

I already did :confused:

Then there is something wrong with the program you are attempting to compile. We can look into that, but, you didn’t tell us anything about that yet :slight_smile:

Can you please explain what program you’re attempting to compile, and show the relevant commands you’re using, and the relevant output parts?

I’m attempting to compile xmrig-proxy from latest sources :

First I run cmake and everything goes well

root@xxx /home/xxx/xmrig-proxy/build # cmake ..
-- The C compiler identification is GNU 9.2.1
-- The CXX compiler identification is GNU 9.2.1
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for syslog.h
-- Looking for syslog.h - found
-- Found UV: /usr/lib64/libuv.so
-- Found OpenSSL: /usr/lib64/libcrypto.so (found version "1.1.1d")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/xxx/xmrig-proxy/build

Then I run make and I encounter the error

(...)
[ 96%] Building CXX object CMakeFiles/xmrig-proxy.dir/src/proxy/tls/TlsConfig.cpp.o
[ 97%] Building CXX object CMakeFiles/xmrig-proxy.dir/src/proxy/tls/TlsContext.cpp.o
[ 98%] Building CXX object CMakeFiles/xmrig-proxy.dir/src/base/net/http/HttpsClient.cpp.o
[100%] Linking CXX executable xmrig-proxy
/usr/bin/ld: cannot find -luuid
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/xmrig-proxy.dir/build.make:1452: xmrig-proxy] Error 1
make[2]: Leaving directory '/home/xxx/xmrig-proxy/build'
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/xmrig-proxy.dir/all] Error 2
make[1]: Leaving directory '/home/xxx/xmrig-proxy/build'
make: *** [Makefile:84: all] Error 2

There’s an ordering issue with this build. For some reason, the -luuid is passed in the wrong order to the linker.

If you pass -DCMAKE_VERBOSE_MAKEFILE=ON you will be able to see the commands that the build runs. The one that fails ends with:

..... CMakeFiles/xmrig-proxy.dir/src/base/net/http/HttpsClient.cpp.o -o xmrig-proxy -lssl -lcrypto -luv -lpthread -Wl,-Bstatic -Wl,-Bdynamic -lrt -ldl

If you manually run this line, but take out the first -luuid and add it to the far end of the compile line, it succeeds in compiling the binary.

/usr/lib64/ccache/bin/g++  -g -O3 -feliminate-unused-debug-types  -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=32 -Wformat -Wformat-security -m64  -fasynchronous-unwind-tables -Wp,-D_REENTRANT -ftree-loop-distribute-patterns -Wl,-z -Wl,now -Wl,-z -Wl,relro -fno-semantic-interposition -ffat-lto-objects  -fno-trapping-math -Wl,-sort-common -Wl,--enable-new-dtags -mtune=skylake  -Wa,-mbranches-within-32B-boundaries -fvisibility-inlines-hidden -Wl,--enable-new-dtags -Wall -Wno-class-memaccess -O3 -DNDEBUG   -static-libgcc -static-libstdc++ -rdynamic CMakeFiles/xmrig-proxy.dir/src/base/io/Console.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/io/json/Json.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/io/json/JsonChain.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/io/json/JsonRequest.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/io/log/backends/ConsoleLog.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/io/log/backends/FileLog.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/io/log/Log.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/io/Watcher.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/kernel/Base.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/kernel/config/BaseConfig.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/kernel/config/BaseTransform.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/kernel/Entry.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/kernel/Env.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/kernel/Platform.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/kernel/Process.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/kernel/Signals.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/dns/Dns.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/dns/DnsRecord.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/http/Http.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/stratum/BaseClient.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/stratum/Client.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/stratum/Job.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/stratum/Pool.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/stratum/Pools.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/stratum/strategies/FailoverStrategy.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/stratum/strategies/SinglePoolStrategy.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/stratum/Url.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/tools/Arguments.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/tools/Buffer.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/tools/String.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/tools/Timer.cpp.o CMakeFiles/xmrig-proxy.dir/src/3rdparty/http-parser/http_parser.c.o CMakeFiles/xmrig-proxy.dir/src/base/api/Api.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/api/Httpd.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/api/requests/ApiRequest.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/api/requests/HttpApiRequest.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/http/HttpApiResponse.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/http/HttpClient.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/http/HttpContext.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/http/HttpResponse.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/http/HttpServer.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/stratum/DaemonClient.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/stratum/SelfSelectClient.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/tools/TcpServer.cpp.o CMakeFiles/xmrig-proxy.dir/src/App.cpp.o CMakeFiles/xmrig-proxy.dir/src/core/config/Config.cpp.o CMakeFiles/xmrig-proxy.dir/src/core/config/ConfigTransform.cpp.o CMakeFiles/xmrig-proxy.dir/src/core/Controller.cpp.o CMakeFiles/xmrig-proxy.dir/src/crypto/common/Algorithm.cpp.o CMakeFiles/xmrig-proxy.dir/src/crypto/common/Coin.cpp.o CMakeFiles/xmrig-proxy.dir/src/crypto/common/keccak.cpp.o CMakeFiles/xmrig-proxy.dir/src/net/JobResult.cpp.o CMakeFiles/xmrig-proxy.dir/src/net/strategies/DonateStrategy.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/BindHost.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/Counters.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/CustomDiff.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/Error.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/Events.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/events/Event.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/events/MinerEvent.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/log/AccessLog.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/log/ShareLog.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/Login.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/Miner.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/Miners.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/Proxy.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/ProxyDebug.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/Server.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/splitters/donate/DonateMapper.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/splitters/donate/DonateSplitter.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/splitters/nicehash/NonceMapper.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/splitters/nicehash/NonceSplitter.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/splitters/nicehash/NonceStorage.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/splitters/simple/SimpleMapper.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/splitters/simple/SimpleSplitter.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/splitters/Splitter.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/Stats.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/workers/Worker.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/workers/Workers.cpp.o CMakeFiles/xmrig-proxy.dir/src/Summary.cpp.o CMakeFiles/xmrig-proxy.dir/src/xmrig.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/io/json/Json_unix.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/kernel/Platform_unix.cpp.o CMakeFiles/xmrig-proxy.dir/src/App_unix.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/Uuid_unix.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/io/log/backends/SysLog.cpp.o CMakeFiles/xmrig-proxy.dir/src/api/v1/ApiRouter.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/stratum/Tls.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/tls/Tls.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/tls/TlsConfig.cpp.o CMakeFiles/xmrig-proxy.dir/src/proxy/tls/TlsContext.cpp.o CMakeFiles/xmrig-proxy.dir/src/base/net/http/HttpsClient.cpp.o  -o xmrig-proxy  -lssl -lcrypto -luv -lpthread -Wl,-Bstatic  -Wl,-Bdynamic -lrt -ldl -luuid

Note that that effectively takes out -Wl,-Bstatic from before -luuid which suggests that it shouldn’t even use that option.

I think this could be the same problem as this bug, which was reported upstream:

IOW, the bug is in this project.

Thank you a lot!
And sorry for the inconvenience.
Have a very good day or night depending on where you are :slight_smile:

Don’t worry too much about that - Questions like these are good for keeping my “skills” exercised and keep me learning about new problems, something which is needed to make software work better for everyone in the future :wink:

For the rest of the audience, this flag is telling the linker you want static linking, so libuuid.a (which we do not provide) is the file that ld cannot find.