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

>> > cc [...] -o .libs/sox sox.o  -L./.libs -lsox -L/usr/local/lib -lpng [...]
>> > cc [...] -o .libs/sox sox.o  -L/usr/local/lib -L./.libs -lsox -lpng [...]
>> >
>> > The first works, the second does not.
>> > The only difference between the two is the place
>> > where the extra -L/usr/local/lib gets added,
>> > as described in the previous emails.
>
> And it seems libtool itself is the one who breaks it.
> This is the failing line again:
>
> /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 -Wl,--as-needed -o sox sox.o  
> libsox.la                      -lm
>
> Notice the "-L/usr/local/lib -Wl,--as-needed".
> The "-L/usr/local/lib" part comes from the configure arg:
>
>   ./configure CC=cc CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib
>
> The "-Wl,--as-needed" comes from
>
>   $ grep as-needed configure.ac
>   AX_APPEND_LINK_FLAGS([-Wl,--as-needed])
>
> That results in the following line in src/Makefile:
>
>   LDFLAGS = -L/usr/local/lib -Wl,--as-needed
>
> and that's what is passed in the above command line. Now, libtool
> apparently preprocesses the line into something else; in particular,
> it reorders the options. The very next command is:
>
> libtool: link: cc -g -O2 -fstack-protector-strong -Wall -Wmissing-prototypes 
> -Wstrict-prototypes -Wl,--as-needed -o .libs/sox sox.o  -L/usr/local/lib 
> -L./.libs -lsox -lpng -lltdl -lao -lgsm -lmad -lmp3lame -ltwolame -lid3tag 
> -lz -lopusfile -lopus -lsndio -lvorbisfile -lwavpack -lcrypto -lsndfile 
> -lFLAC -lvorbisenc -lvorbis -logg -lm -Wl,-rpath,/usr/local/lib
>
> Notice where the -L/usr/local/lib has been moved.
> As described previously, if it comes after -lsox
> instead of before it, it links just fine.

None of this has changed.  The problem is that you have an old libsox in
/usr/local/lib, and with that -L flag early in the command, it takes
precedence over the just-built libsox, causing the link to fail.  If
you're building the same version, it won't matter which one the linker
finds, so it succeeds.

This whole issue is unique to OpenBSD.  On Linux and FreeBSD the link
command uses the full filename of libsox, so it isn't searched for in
the -L locations.

-- 
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