[DragonFlyBSD - Bug #2897] (New) Default compiler ignores LIBRARY_PATH
bugtracker-admin at leaf.dragonflybsd.org
bugtracker-admin at leaf.dragonflybsd.org
Fri Apr 1 07:53:19 PDT 2016
Issue #2897 has been reported by enric.
----------------------------------------
Bug #2897: Default compiler ignores LIBRARY_PATH
http://bugs.dragonflybsd.org/issues/2897
* Author: enric
* Status: New
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
The default compiler of "DragonFly 4.4-RELEASE" ignores the value of the environment variable LIBRARY_PATH.
Steps to reproduce:
cat > foo.c
int foo(void) { return 42; }
^D
cat > main.c
int foo(void);
int main() { return foo(); }
^D
# commands to reproduce the problem:
cc -c foo.c
ar r libfoo.a foo.o
LIBRARY_PATH=`pwd` cc main.c -lfoo
# observed behaviour: the compiler gives an error because it cannot find foo
# expected behaviour: the compiler produces a program a.out that returns 42
# workaround:
cc main.c -lfoo -L`pwd`
This causes problems when compiling some packages that work correctly in other
systems, notably OpenBSD and Debian linux. This problem is easy to workaround
(once you identify it!). However, the behavior is inconsistent with the provided
documentation.
Quote from cc(1):
LIBRARY_PATH
The value of LIBRARY_PATH is a colon-separated list of directories,
much like PATH. When configured as a native compiler, GCC tries
the directories thus specified when searching for special linker
files, if it can't find them using GCC_EXEC_PREFIX. Linking using
GCC also uses these directories when searching for ordinary
libraries for the -l option (but directories specified with -L come
first).
Either the documentation or the compiler specs should be updated to be
consistent.
By running the compiler with the "-v" option, you can see that the variable is
acknowledged, however its values are not passed to the linker.
--
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
More information about the Bugs
mailing list