[DragonFlyBSD - Bug #2897] (Resolved) Default compiler ignores LIBRARY_PATH

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Tue May 25 12:59:03 PDT 2021


L'assumpte #2897 ha sigut actualitzat per swildner.

Estat ha canviat de New a Resolved

I found the issue and pushed a fix:

https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/9dc2b375dec264b435a79b203ab51f668acee62a


----------------------------------------
Bug #2897: Default compiler ignores LIBRARY_PATH
http://bugs.dragonflybsd.org/issues/2897#change-14086

* Autor: enric
* Estat: Resolved
* Prioritat: Normal
* Assignat a: 
* Categoria: 
* Versió prevista: 6.2
----------------------------------------
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