Building R Package and Error "Ld: Cannot Find -Lgfortran"

usr/bin/ld: cannot find -l nameOfTheLibrary

If your library name is say libxyz.so and it is located on path say:

/home/user/myDir

then to link it to your program:

g++ -L/home/user/myDir -lxyz myprog.cpp -o myprog

How to avoid cannot find -lR for R Package installation on windows

You are making three mistakes:

  1. You should not install rtools under program files or any other path with a space.
  2. You are using BINPREF wrong, causing the 64-bit toolchain to be used on 32-bit.
  3. The mingw gcc dirs should not be on the PATH. Only the bin dir (bash and make) should be.

Recommended setup:

It is highly recommended to install rtools in the default location C:\Rtools\. This is the only configuration that is widely tested.

In this case you only need to make put C:\Rtools\bin is on the PATH in order to compile packages. R will automatically use the correct compilers on 32-bit and 64-bit.

With non-default Rtools location:

If you really must install rtools in a non standard location, you can set BINPREF to a pattern that includes $(WIN) that gets expanded to the correct path for example like so:

Sys.setenv(BINPREF="C:/YourRtoolsPath/mingw_$(WIN)/bin/")

When make invokes the compiler, $(WIN) gets substituted by either 32 or 64 which should then resolve to the correct path of the respective toolchain.

/usr/bin/ld: cannot find during linking g++

ld's manual page describes the -l option as follows (irrelevant details omitted):

-l namespec

--library=namespec

Add the archive or object file specified by namespec to the list of
files to link. [...] ld will search a directory for a library called
libnamespec.so

If you read this very carefully, you will reach the conclusion that -llibclickhouse-cpp-lib instructs ld to search for a library named liblibclickhouse-cpp-lib.so which, obviously, does not exist.

This should simply be -lclickhouse-cpp-lib.

/usr/bin/ld: cannot find

Add -L/opt/lib to your compiler parameters, this makes the compiler and linker search that path for libcalc.so in that folder.

ld cannot find shared library even with -L specified

but ld cannot seem to find it

This command line: gcc ... -lInsertTimingInstr.so ... asks the linker to link against libInsertTimingInstr.so.a or libInsertTimingInstr.so.so, neither of which exists.

You want: gcc ... -lInsertTimingInstr ... (i.e. drop the lib prefix and the .so suffix).

Alternatively, you could do this: gcc ... /home/user/cuda_sync_analyzer-install/lib/libInsertTimingInstr.so ...

/usr/bin/ld: cannot find -lauparse

You need audit-libs-devel. Here's how I found that:

$ sudo dnf install /usr/lib64/libauparse.so
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
audit-libs-devel x86_64 2.7.7-1.fc26 updates-testing 81 k

In general:

  1. Libraries are gonna be in /usr/lib64 on x86_64 systems.
  2. -lsomething means to look for /usr/lib64/libsomething.so
  3. And DNF has this neat feature where it can find things by file, so there you go.
  4. Also, for most libraries on Fedora, there's a runtime package (here, audit-libs and then a devel package (audit-libs-devel) which contains the .so symlink and usually header files and stuff.


Related Topics



Leave a reply



Submit