[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

directory search order for link libraries

From: Tobias Preclik
Subject: directory search order for link libraries
Date: Wed, 24 Jul 2013 15:10:51 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7


from my bug tracker submission at savannah.gnu.org [1]:

Consider the following Makefile:
# --- >8 ---
vpath lib%.a /tmp/boosttmp/
vpath lib%.so /tmp/boosttmp/
a: -lm -lboost_system
@echo target a: $^
b: -lboost_system -lm
@echo target b: $^
# --- >8 ---

Note that /tmp/boosttmp/ as well as some system library path must
contain libboost_system.so to reproduce the bug. From my understanding
make will search the vpath first and then the system directories. Now
consider the following executions of make:
$ make a
target a: /usr/lib64/libm.so /usr/lib64/libboost_system.so
$ make b
target b: /tmp/boosttmp/libboost_system.a /usr/lib64/libm.so
$ make a b
target a: /usr/lib64/libm.so /usr/lib64/libboost_system.so
target b: /usr/lib64/libboost_system.so /usr/lib64/libm.so
$ make b a
target b: /tmp/boosttmp/libboost_system.a /usr/lib64/libm.so
target a: /usr/lib64/libm.so /tmp/boosttmp/libboost_system.a
"make a" and "make a b" find the libboost_system libray in the system
directories but "make b" and "make b a" in the vpath directory. Note
also that the expansion of target a and b is inconsistent in the
different executions.

Is that the intended behaviour? From what I understand from the manual
vpath has priority over the system library paths and -lboost_system
should always be resolved to /tmp/boosttmp/libboost_system.a.

Best regards,

[1] https://savannah.gnu.org/bugs/?39560

reply via email to

[Prev in Thread] Current Thread [Next in Thread]