How to add a path to LDFLAGS
Asked Answered
V

3

17

I'm trying to set up a library called PBC (Pairing-based cryptography). And this library requires another library called GMP -(GNU Multiple-Precision Library).

My problem is after installing GMP correctly, PBC gives an error of:

gmp library not found add its path to LDFLAGS

I have no idea what LDFLAGS is and how to add it to the path.

PS: I'm using MinGW.

Vitamin answered 6/6, 2011 at 15:21 Comment(2)
Are you running "make" to compile PBC? Did you look at the Makefile; that should have an LDFLAGS defined at the top.Tallou
@Foon, it has make i try with make but it gives this error thoughVitamin
S
15

The question is not really descriptive enough for anyone to answer well, but....

On a Unix-based system you would likely do something like this:

$ export LDFLAGS="-R/the/path/to/the/gmp/lib -L/the/path/to/the/gmp/lib"
$ ./configure
$ make
$ make install

Windows environments with GNU make tools, will need minor tweaks.

Scrophulariaceous answered 3/10, 2012 at 22:52 Comment(1)
What do R and L mean?Prayerful
P
1

If you look into gcc man:

-Ldir

adds directory dir to the list of directories to be searched for -l. So, -Ldir just passes a path to the linker to look for a .a or .so library used by the source code

-Rdir is not always supported by all platform, a better option is rpath together with -Wl:

-Wl,-rpath=dir
Pantaloons answered 26/7, 2022 at 12:47 Comment(0)
T
0
  1. Just to make sure we can't make this easier: are you trying to compile something extra such that you can't (or don't want to; I have no problems if you prefer to compile everything from source or what not but want to make sure you just didn't see it) use the precompiled binaries someone already built using MinGW? (Located here as of when I wrote this.)

  2. LDFLAGS are a convention with a C compiler for flags that should be passed to the loader part. In your case, you're most likely going to want to add something like -L/usr/local/lib (or wheverer GMP got put... I would expect you can probably figure it out by searching for libgmp.a ... if necessary, in your msys shell, cd to / and run find -name "libgmp.a"). If you open the Makefile in a text editor, you should find a LDFLAGS line, possibly empty (on my Linux box, it's just LDFLAGS= for that line).

Tallou answered 7/6, 2011 at 23:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.