Hi,
I am trying to use the MQTT client emqx/emqtt
version 1.4.7
in an Elixir project.
When I try to compile my Elixir code with mix compile
, an error appears:
/nix/store/h19zwlkrp6b0hp3ypbqdcggnyarn3af6-binutils-2.35.2/bin/ld: cannot find -lATOMIC-NOTFOUND
collect2: error: ld returned 1 exit status
As I understand (see https://github.com/emqx/quic/issues/78#issuecomment-1059999041 ), I am missing the libatomic
library.
How can I get this library in NixOS?
I only found libatomic_ops
but it does not seem to help.
NobbZ
March 7, 2022, 9:53am
2
libgccjit
seems to provide a libatomic.so
according to nix-locate
.
There have been much more hits than that, though that seemed to be the best match. The list was hard to browse on a mobile connected through SSH though.
Thank you.
Indeed, I have added the following to shell.nix
:
shellHook = ''
export LD_LIBRARY_PATH=${libgccjit}/lib:$LD_LIBRARY_PATH
'';
I can see I have the library but it is still not found:
[nix-shell:~/dev/myproject]$ echo $LD_LIBRARY_PATH
/nix/store/jql0jjch4pcm4w3l8l4qxa9gwjjw00nm-libgccjit-10.3.0/lib:
[nix-shell:~/dev/myproject]$ l /nix/store/jql0jjch4pcm4w3l8l4qxa9gwjjw00nm-libgccjit-10.3.0/lib/libatomic.*
-r--r--r-- 1 root root 127K jan. 1 1970 /nix/store/jql0jjch4pcm4w3l8l4qxa9gwjjw00nm-libgccjit-10.3.0/lib/libatomic.a
-r-xr-xr-x 1 root root 1018 jan. 1 1970 /nix/store/jql0jjch4pcm4w3l8l4qxa9gwjjw00nm-libgccjit-10.3.0/lib/libatomic.la
lrwxrwxrwx 1 root root 18 jan. 1 1970 /nix/store/jql0jjch4pcm4w3l8l4qxa9gwjjw00nm-libgccjit-10.3.0/lib/libatomic.so -> libatomic.so.1.2.0
lrwxrwxrwx 1 root root 18 jan. 1 1970 /nix/store/jql0jjch4pcm4w3l8l4qxa9gwjjw00nm-libgccjit-10.3.0/lib/libatomic.so.1 -> libatomic.so.1.2.0
-r-xr-xr-x 1 root root 30K jan. 1 1970 /nix/store/jql0jjch4pcm4w3l8l4qxa9gwjjw00nm-libgccjit-10.3.0/lib/libatomic.so.1.2.0
[nix-shell:~/dev/myproject]$ mix compile
-- CMAKE Version: 3.21.2
-- Source Dir: /home/me/dev/myproject/deps/quicer/msquic
-- Host System name: Linux
-- Setting policy 0091
-- System name: Linux
-- System version: 5.10.102
-- Platform version:
-- Build type: RelWithDebInfo
-- QUIC Platform: linux
-- Version Build ID: 0
-- Version Suffix: -private
-- Enabling OpenSsl configuration tests
-- Enabling shared ephemeral port work around
-- Disabling tracing
-- Setting openssldir to /nix/store/b7rwxm8hqwnkv2sp9ky74y9cjv165w3c-openssl-1.1.1m/etc/ssl
-- Configuring for OpenSSL
-- Configuring done
-- Generating done
-- Build files have been written to: /home/me/dev/myproject/deps/quicer/c_build
make: Entering directory '/home/me/dev/myproject/deps/quicer/c_build'
make[1]: Entering directory '/home/me/dev/myproject/deps/quicer/c_build'
make[2]: Entering directory '/home/me/dev/myproject/deps/quicer/c_build'
make[2]: Entering directory '/home/me/dev/myproject/deps/quicer/c_build'
make[2]: Leaving directory '/home/me/dev/myproject/deps/quicer/c_build'
[ 2%] Built target OpenSSL_Target
make[2]: Entering directory '/home/me/dev/myproject/deps/quicer/c_build'
Consolidate compiler generated dependencies of target core
make[2]: Leaving directory '/home/me/dev/myproject/deps/quicer/c_build'
Consolidate compiler generated dependencies of target platform
make[2]: Leaving directory '/home/me/dev/myproject/deps/quicer/c_build'
[ 53%] Built target core
[ 72%] Built target platform
make[2]: Entering directory '/home/me/dev/myproject/deps/quicer/c_build'
Consolidate compiler generated dependencies of target msquic
make[2]: Leaving directory '/home/me/dev/myproject/deps/quicer/c_build'
make[2]: Entering directory '/home/me/dev/myproject/deps/quicer/c_build'
[ 73%] Linking C shared library ../../bin/Release/libmsquic.so
/nix/store/h19zwlkrp6b0hp3ypbqdcggnyarn3af6-binutils-2.35.2/bin/ld: cannot find -lATOMIC-NOTFOUND
collect2: error: ld returned 1 exit status
make[2]: *** [msquic/src/bin/CMakeFiles/msquic.dir/build.make:101: msquic/bin/Release/libmsquic.so] Error 1
make[2]: Leaving directory '/home/me/dev/myproject/deps/quicer/c_build'
make[1]: *** [CMakeFiles/Makefile2:345: msquic/src/bin/CMakeFiles/msquic.dir/all] Error 2
make[1]: Leaving directory '/home/me/dev/myproject/deps/quicer/c_build'
make: *** [Makefile:136: all] Error 2
make: Leaving directory '/home/me/dev/myproject/deps/quicer/c_build'
===> Hook for compile failed!
** (Mix) Could not compile dependency :quicer, "/home/me/.mix/rebar3 bare compile --paths /home/me/dev/myproject/_build/dev/lib/*/ebin" command failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile quicer", update it with "mix deps.update quicer" or clean it with "mix deps.clean quicer"
Am I making something wrong?
@NobbZ any idea why it still is not found?
NobbZ
March 21, 2022, 7:00am
5
Seems as if the cmake
files do want to use pkg-config
exclusively. Though there are no pkg config files in the gcc lib.
Cmake does have facilities to override the searches IIRC and directly provide correct locations. Though I do not remember the details.
Though I already think that the CMake file is badly written, as it fails during compilation, rather than “configuration”