Jan Stary <h...@stare.cz> writes:

>> However, the build eventually fails with a linking error:
>> 
>> /bin/sh ../libtool  --tag=CC --mode=link cc  -g -O2 -fstack-protector-strong 
>> -Wall -Wmissing-prototypes -Wstrict-prototypes   -avoid-version -module 
>> -L/usr/local/lib -fstack-protector-strong -Wl,--as-needed -o sox sox.o  
>> libsox.la                      -lm
>> libtool: link: cc -g -O2 -fstack-protector-strong -Wall -Wmissing-prototypes 
>> -Wstrict-prototypes -fstack-protector-strong -Wl,--as-needed -o .libs/sox 
>> sox.o  -L/usr/local/lib -L./.libs -lsox -lpng -lltdl -lao -lgsm -lid3tag -lz 
>> -lmad -lmp3lame -ltwolame -lopusfile -lopus -lsndio -lvorbisfile -lwavpack 
>> -lcrypto -lsndfile -lFLAC -lvorbisenc -lvorbis -logg -lm 
>> -Wl,-rpath,/home/hans/lib -Wl,-rpath,/usr/local/lib
>> ld: error: undefined symbol: lsx_malloc
>> [...]
>> 
>> Indeed, none of the input files defines lsx_malloc;
>> it is defined in libsox.so
>> 
>>      $ nm .libs/libsox.so.3.0 | grep lsx_malloc
>>      00042a30 T lsx_malloc
>> 
>> but that is not one of the inputs. Adding .libs/libsox.so.3.0
>> as an input to the above line make it link as expected.
>
> Hm. but the "-L./.libs -lsox" should take care of that.
> Is it because of the extra -L/usr/local/lib? When building
> without any extra LDFLAGS, that line is
>
> cc -g -O2 -fstack-protector-strong -Wall -Wmissing-prototypes 
> -Wstrict-prototypes -fstack-protector-strong -Wl,--as-needed -o .libs/sox 
> sox.o  -L ./.libs -lsox
> -L/usr/local/lib -lFLAC -lopusfile -lopus -lsndio -lvorbisenc -lvorbisfile 
> -lvor
> bis -logg -lm -Wl,-rpath,/home/hans/lib -Wl,-rpath,/usr/local/lib

That's seems to be parts of several commands.  Did the mouse slip when
you copied it?

> and it links fine.
>
> Is it because of the _order_ of the -L options?

For each -l option, the directories specified with -L options preceding
it are searched in order until a match is found.  Unless there are
conflicting libraries in different locations, the order doesn't matter.

> Note that with LDFLAGS=/usr/local/lib, the order is
>
>   -o .libs/sox sox.o  -L/usr/local/lib -L./.libs -lsox [etc]
>
> but without LDFLAGS it's
>
>   -o .libs/sox sox.o  -L ./.libs -lsox -L/usr/local/lib -lFLAC [etc]

How did that -L/usr/local/lib get there?

Please send me your config.log so I can see what's going on.

It all works fine on my VM with this environment and no configure options:
AUTOCONF_VERSION=2.69
AUTOMAKE_VERSION=1.16
CC=cc
C_INCLUDE_PATH=/usr/local/include
LIBRARY_PATH=/usr/local/lib

-- 
Måns Rullgård


_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel

Reply via email to