modular icon indicating copy to clipboard operation
modular copied to clipboard

[BUG] mojo build failed because ld cannot find -lz -ltinfo

Open autoarcher opened this issue 1 year ago • 2 comments

Bug description

Just Following the Get Started Doc of Mojo, failed in the step 4 Build an executable binary.

Steps to reproduce

  • Include relevant code snippet or link to code that did not work as expected.
    (hello) xxx@coding:~/mojo_exp/hello$ mojo build hello.mojo
    /usr/bin/ld: cannot find -lz: No such file or directory
    /usr/bin/ld: cannot find -ltinfo: No such file or directory
    collect2: error: ld returned 1 exit status
    mojo: error: failed to link executable
    
  • If applicable, add screenshots to help explain the problem.
  • If using the Playground, name the pre-existing notebook that failed and the steps that led to failure.
  • Include anything else that might help us debug the issue. I try to set LD_LIBRARY_PATH to the project .magic lib path, like .magic/envs/default/lib, because the missing so files are there, but it didn't help.

System information

- What OS did you do install Mojo on ?
Operating System: Ubuntu 22.04.5 LTS
          Kernel: Linux 5.15.0-122-generic
    Architecture: x86-64
- Provide version information for Mojo by pasting the output of `mojo -v`
mojo 24.5.0 (e8aacb95)
- Provide Modular CLI version by pasting the output of `modular -v`
magic 0.3.0
- ld version
2.38

autoarcher avatar Sep 21 '24 15:09 autoarcher

I got that issue as well. I run sudo apt-get install -y gcc g++ zlib1g-dev libtinfo-dev to install the dependencies that it has

Moosems avatar Sep 23 '24 02:09 Moosems

I got that issue as well. I run sudo apt-get install -y gcc g++ zlib1g-dev libtinfo-dev to install the dependencies that it has

It worked. Thank you.

autoarcher avatar Sep 25 '24 13:09 autoarcher

I had the some problem starting from a brand-new Ubuntu 24 machine. The comment by @mackauto solved it, thanks!

Ivo-Balbaert avatar Oct 21 '24 09:10 Ivo-Balbaert

Same here, was following the same guide and got the same issue.

It was fixed by installing the missing packages.

I’m on Ubuntu 22.04.5 LTS

ccavazos avatar Nov 29 '24 21:11 ccavazos

on fedora you need to dnf install ncurses-devel to get this library.

MrGibus avatar Jan 12 '25 03:01 MrGibus