fireball.1
fireball.1

Reputation: 1521

Understand flag setting

I am trying to install BerkeleyDB STL . I ran the following code to download n install the same

curl -OL http://download.oracle.com/berkeley-db/db-6.2.23.NC.tar.gz
tar xf db-6.2.23.NC.tar.gz
cd db-6.2.23.NC/build_unix
../dist/configure --prefix=$HOME --enable-stl
make
make install

then for further installation of my application i need to tell R where is BerkeleyDB STL, for which I did as stated by the manual :

CPPFLAGS=-I${HOME}/include
LDFLAGS=-L${HOME}/lib -Wl,-rpath=${HOME}/lib

But I get the following error while running the second command :

bash: -Wl,-rpath=/home/mayankmodi/lib: No such file or directory

even though the directory structure is

.
├── bin
├── env
├── include
├── lib
└── Videos
*I have deleted most of my folders to make it easy to spot lib directory

QUESTION: I need to understand the implication of

LDFLAGS=-L${HOME}/lib -Wl,-rpath=${HOME}/lib

Upvotes: 0

Views: 455

Answers (1)

Cong Ma
Cong Ma

Reputation: 11322

The line

LDFLAGS=-L${HOME}/lib -Wl,-rpath=${HOME}/lib

with the HOME variable expanded, becomes

LDFLAGS=-L/home/mayankmodi/lib -Wl,-rpath=/home/mayankmodi/lib [rest of actual command]

which is interpreted as something close to

EnvironmentVariable=Value command line ...

i.e. Bash interprets the text -Wl,-rpath=/home/mayankmodi/lib as the start of a command or path to an executable, and attempts to run it with the environment variable setting LDFLAGS=-L/home/mayankmodi/lib, which fails because there's no such command or program.

To fix this, you can wrap the value to be given to LDFLAGS in double quotes:

LDFLAGS="-L${HOME}/lib -Wl,-rpath=${HOME}/lib"

so that LDFLAGS expands to the desired text.

Upvotes: 2

Related Questions