> 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

and it links fine.

Is it because of the _order_ of the -L options?
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]

Jan



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

Reply via email to