PMunch / futhark

Automatic wrapping of C headers in Nim
MIT License
374 stars 20 forks source link

It could be helpful to have improved instructions for installation #14

Open mavavilj opened 2 years ago

mavavilj commented 2 years ago

I'm trying to install futhark, but I run into the issue of fulfilling these instructions:

https://github.com/PMunch/futhark#installation

There is no information about where libclang.lib should be located with default Ubuntu installation.

PMunch commented 2 years ago

Oh, that section is indeed a bit poorly worded. When installing on Linux through your package manager you shouldn't need to give that passL flag at all. Simply install libclang and run nimble install futhark and you should be good.

mavavilj commented 2 years ago

I got it installed on Ubuntu 20.04, but I had to use the choosenim installation (not the snap one, which is older version of nim) from:

https://nim-lang.org/install_unix.html

Then

nimble install futhark

which failed to:

   Building futhark/opir using c backend
/usr/bin/ld: cannot find -lclang

This is fixed by adding a link to clang.

First find where it is:

locate libclang.so

Which returns something like:

/usr/lib/llvm-10/lib/libclang.so
/usr/lib/llvm-10/lib/libclang.so.1

Then we create a symlink:

sudo ln -s /usr/lib/llvm-10/lib/libclang.so /usr/lib/libclang.so

Now the build should succeed.

PMunch commented 2 years ago

You could've also done LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/llvm-10/lib/ nimble install futhark I believe. This would essentially tell the C compiler that it should also search in that folder for dynamic libraries to load.

And yes, Futhark has only been tested on 1.4.8 and above. In addition it is generally not recommended to use system-installed Nim because of how slow most package managers are at updating their packages. Nim also tends to require things to be put in certain places, and some projects might require the Nim sources which is sometimes not included in the system-built versions. So the general advice is definitely to use choosenim or install it manually instead of getting it from your package manager.

ringabout commented 2 years ago

I encountered the same problem in wsl2 (ubuntu 20.04) and @mavavilj 's solution works like a charm!

Nim Compiler Version 1.7.1 [Linux: amd64]
Compiled at 2022-02-26