linker error: library not found when running mojo build

Hello, I am trying to compile a mojo file, however the linker can't find the library zlib, which is installed on my system (nix package manager):
magic run mojo build psm.mojo
ld: library not found for -lz
collect2: error: ld returned 1 exit status
/Users/instable/Github/latex2utf8/.magic/envs/default/bin/mojo: error: failed to link executable
magic run mojo build psm.mojo
ld: library not found for -lz
collect2: error: ld returned 1 exit status
/Users/instable/Github/latex2utf8/.magic/envs/default/bin/mojo: error: failed to link executable
So I added zlib to the dependencies using magic add zlib
bat mojoproject.toml
1 [project]
2 │ authors = ["Allemand Instable <[email protected]>"]
3 │ channels = ["conda-forge", "https://conda.modular.com/max", "https://repo.prefix.dev/mojo-community"]
4 │ description = "Simple CLI tool to convert latex to utf8"
5 │ name = "latex2utf8"
6 │ platforms = ["osx-arm64"]
7 │ version = "0.1.0"
8
9 [tasks]
10
11 [dependencies]
12 │ max = "*"
13 │ prism = ">=0.2.1,<0.3"
14 │ zlib = ">=1.3.1,<2"
bat mojoproject.toml
1 [project]
2 │ authors = ["Allemand Instable <[email protected]>"]
3 │ channels = ["conda-forge", "https://conda.modular.com/max", "https://repo.prefix.dev/mojo-community"]
4 │ description = "Simple CLI tool to convert latex to utf8"
5 │ name = "latex2utf8"
6 │ platforms = ["osx-arm64"]
7 │ version = "0.1.0"
8
9 [tasks]
10
11 [dependencies]
12 │ max = "*"
13 │ prism = ">=0.2.1,<0.3"
14 │ zlib = ">=1.3.1,<2"
but it kept on having the same linker error looking at usual C compiler and linker flags :
export LDFLAGS="$(pkg-config --libs zlib)"
export CFLAGS="$(pkg-config --cflags zlib)"
export LDFLAGS="$(pkg-config --libs zlib)"
export CFLAGS="$(pkg-config --cflags zlib)"
it should work fine given :
pkg-config --libs zlib
-L/nix/store/lcdcai6gs0dbsx7a0hz43xb3xwwmb9dl-zlib-1.3.1/lib -lz
pkg-config --cflags zlib
-I/nix/store/3v6hssqkac6ffmq185qwc1sbyflpj5hw-zlib-1.3.1-dev/include
pkg-config --libs zlib
-L/nix/store/lcdcai6gs0dbsx7a0hz43xb3xwwmb9dl-zlib-1.3.1/lib -lz
pkg-config --cflags zlib
-I/nix/store/3v6hssqkac6ffmq185qwc1sbyflpj5hw-zlib-1.3.1-dev/include
however I still get the error message from the linker not being able to find the zlib library for compiling my file
magic run mojo build psm.mojo
ld: library not found for -lz
collect2: error: ld returned 1 exit status
/Users/instable/Github/latex2utf8/.magic/envs/default/bin/mojo: error: failed to link executable
magic run mojo build psm.mojo
ld: library not found for -lz
collect2: error: ld returned 1 exit status
/Users/instable/Github/latex2utf8/.magic/envs/default/bin/mojo: error: failed to link executable
Has anyone any idea on how I could fix this ? Thank you very much !
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server