Closed rishavs closed 1 year ago
c:/users/risharan/scoop/apps/mingw-winlibs/current/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lclang: No such file or directory
You don't appear to have libclang
installed correctly
I did try with wsl. Here is the error;
rishav@Rishav-SB3:/mnt/c/Users/risharan/Documents/Dev/nim/mirana/linux$ nimble install futhark
Prompt: No local packages.json found, download it from internet? [y/N]
y
Answer: Downloading Official package list
Success Package list downloaded.
Downloading https://github.com/PMunch/futhark using git
Warning: Package 'futhark' has an incorrect structure. The top level of the package source directory should contain at most one module, named 'futhark.nim', but a file named 'opir.nim' was found. This will be an error in the future.
Hint: If this is the primary source file in the package, rename it to 'futhark.nim'. If it's a source file required by the main module, or if it is one of several modules exposed by 'futhark', then move it into a 'futhark/' subdirectory. If it's a test file or otherwise not required to build the the package 'futhark.nim', prevent its installation by adding `skipFiles = @["opir.nim"]` to the .nimble file. See https://github.com/nim-lang/nimble#libraries for more info.
Verifying dependencies for futhark@0.9.1
Installing https://github.com/PMunch/libclang-nim@#head
Downloading https://github.com/PMunch/libclang-nim using git
Warning: Package 'clang' has an incorrect structure. It should contain a single directory hierarchy for source files, named 'clang', but file 'CXErrorCode.nim' is in a directory named 'clangpkg' instead. This will be an error in the future.
Hint: If 'clangpkg' contains source files for building 'clang', rename it to 'clang'. Otherwise, prevent its installation by adding `skipDirs = @["clangpkg"]` to the .nimble file.
Verifying dependencies for clang@#head
Installing clang@#head
Success: clang installed successfully.
Installing termstyle@any version
Downloading https://github.com/PMunch/termstyle using git
Verifying dependencies for termstyle@0.1.0
Installing termstyle@0.1.0
Success: termstyle installed successfully.
Installing macroutils@any version
Downloading https://github.com/PMunch/macroutils using git
Verifying dependencies for macroutils@1.2.0
Installing macroutils@1.2.0
Success: macroutils installed successfully.
Installing futhark@0.9.1
Building futhark/opir using c backend
/tmp/nimble_22369/githubcom_PMunchfuthark/src/opir.nim(158, 1) Warning: catch a more precise Exception deriving from CatchableError or Defect. [BareExcept]
/tmp/nimble_22369/githubcom_PMunchfuthark/src/opir.nim(357, 39) template/generic instantiation of `parseReturn` from here
/tmp/nimble_22369/githubcom_PMunchfuthark/src/opir.nim(353, 11) Warning: The bare except clause is deprecated; use `except CatchableError:` instead [BareExcept]
/tmp/nimble_22369/githubcom_PMunchfuthark/src/opir.nim(359, 35) template/generic instantiation of `parseReturn` from here
/tmp/nimble_22369/githubcom_PMunchfuthark/src/opir.nim(353, 11) Warning: The bare except clause is deprecated; use `except CatchableError:` instead [BareExcept]
/tmp/nimble_22369/githubcom_PMunchfuthark/src/opir.nim(360, 35) template/generic instantiation of `parseReturn` from here
/tmp/nimble_22369/githubcom_PMunchfuthark/src/opir.nim(353, 11) Warning: The bare except clause is deprecated; use `except CatchableError:` instead [BareExcept]
/tmp/nimble_22369/githubcom_PMunchfuthark/src/opir.nim(361, 35) template/generic instantiation of `parseReturn` from here
/tmp/nimble_22369/githubcom_PMunchfuthark/src/opir.nim(353, 11) Warning: The bare except clause is deprecated; use `except CatchableError:` instead [BareExcept]
/tmp/nimble_22369/githubcom_PMunchfuthark/src/opir.nim(362, 55) template/generic instantiation of `parseReturn` from here
/tmp/nimble_22369/githubcom_PMunchfuthark/src/opir.nim(353, 11) Warning: The bare except clause is deprecated; use `except CatchableError:` instead [BareExcept]
/tmp/nimble_22369/githubcom_PMunchfuthark/src/opir.nim(364, 38) template/generic instantiation of `parseReturn` from here
/tmp/nimble_22369/githubcom_PMunchfuthark/src/opir.nim(353, 11) Warning: The bare except clause is deprecated; use `except CatchableError:` instead [BareExcept]
/usr/bin/ld: cannot find -lclang: No such file or directory
collect2: error: ld returned 1 exit status
Error: execution of an external program failed: 'gcc -o /tmp/nimble_22369/githubcom_PMunchfuthark/opir /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.choosenim@stoolchains@snim-1.6.12@slib@sstd@sprivate@sdigitsutils.nim.c.o /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.choosenim@stoolchains@snim-1.6.12@slib@ssystem@sassertions.nim.c.o /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.choosenim@stoolchains@snim-1.6.12@slib@ssystem@sformatfloat.nim.c.o /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.choosenim@stoolchains@snim-1.6.12@slib@ssystem@sdollars.nim.c.o /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.choosenim@stoolchains@snim-1.6.12@slib@ssystem@sio.nim.c.o /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.choosenim@stoolchains@snim-1.6.12@slib@ssystem.nim.c.o /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.choosenim@stoolchains@snim-1.6.12@slib@spure@sparseutils.nim.c.o /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.choosenim@stoolchains@snim-1.6.12@slib@spure@smath.nim.c.o /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.choosenim@stoolchains@snim-1.6.12@slib@spure@salgorithm.nim.c.o /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.choosenim@stoolchains@snim-1.6.12@slib@spure@sstrutils.nim.c.o /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.choosenim@stoolchains@snim-1.6.12@slib@spure@spathnorm.nim.c.o /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.choosenim@stoolchains@snim-1.6.12@slib@spure@soptions.nim.c.o /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.choosenim@stoolchains@snim-1.6.12@slib@spure@stimes.nim.c.o /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.choosenim@stoolchains@snim-1.6.12@slib@spure@sos.nim.c.o /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.choosenim@stoolchains@snim-1.6.12@slib@spure@shashes.nim.c.o /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.choosenim@stoolchains@snim-1.6.12@slib@spure@scollections@stables.nim.c.o /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.choosenim@stoolchains@snim-1.6.12@slib@spure@sjson.nim.c.o /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.nimble@spkgs@sclang-@hhead@sclangpkg@sIndex.nim.c.o /home/rishav/.cache/nim/opir_r/@m..@s..@s..@s..@shome@srishav@s.nimble@spkgs@stermstyle-0.1.0@stermstyle.nim.c.o /home/rishav/.cache/nim/opir_r/@mopir.nim.c.o -lm -lm -lrt -lclang -ldl'
Prompt: Build failed for 'futhark@0.9.1', would you like to try installing 'futhark@#head' (latest unstable)? [y/N]
n
Answer: Tip: 33 messages have been suppressed, use --verbose to show them.
Error: Aborting installation due to build failure
/usr/bin/ld: cannot find -lclang: No such file or directory
Same error, you don't have libclang
installed.
That's strange. I am able to use clang on both;
C:\Users\risharan\Documents\Dev\nim\mirana>clang -v
clang version 16.0.4
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Users\risharan\scoop\apps\llvm\current\bin
and on wsl
rishav@Rishav-SB3:/mnt/c/Users/risharan/Documents/Dev/nim/mirana/linux$ clang -v
Ubuntu clang version 14.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
Candidate multilib: .;@m64
Selected multilib: .;@m64
Could it be something related to having multiple clang version installed on the OS? Is there a way to pass the clang path to futhark so that it refers to a specific clang version?
Clang != libclang. They are often shipped separately. You might also simply be running into path issues. Futhark tries to find libclang on its own, but if you installed it in a strange location it might not be able to.
Thanks for your patience. Is it possible for me to specify a path to libclang library during futhank installation? I am unable to resolve this issue on my side. I do have libclang also installed but still getting the same issue.
If I can specify a path to libclang, or just have the libclang lib in the project directory for me to finish the installation of futhark , I would be unblocked.
You should be able to specify with --passL:"-L<path to libclang.dll>"
I believe
For people just rushing here in to get futhark
running with nimlang/nim Docker image or Ubuntu 20
:
ln -s libclang-10.so /usr/lib/x86_64-linux-gnu/libclang.so
@PMunch Maybe it would be a good idea to expose the Installation section or even add some OS specific hints there. For Ubuntu libclang-dev
is being installed in /usr/lib/x86_64-linux-gnu
and has a version specific addendum. Therefore ld
fails when linking -lclang
.
@zembrowski sounds like a good idea. Since I can't verify paths and such without installing another OS I would be very happy to receive PRs with install instructions for different OSs and the Docker container.
I did
nimble install futhark
on both windows & wsl and hit the same error. Adding the trace text here;