link failure with LDFLAGS="-Wl,--as-needed"

Bug #656010 reported by Robin H. Johnson
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
libmemcached
Invalid
Medium
Trond Norbye

Bug Description

The order of items being presented for linking needs to be fixed to work with -Wl,--as-needed.

CCLD clients/memcapable
clients/.libs/libutilities.a(utilities.o): In function `initialize_sasl':
/dev/shm/portage/dev-libs/libmemcached-0.44/work/libmemcached-0.44/clients/utilities.c:196: undefined reference to `sasl_client_init'
clients/.libs/libutilities.a(utilities.o): In function `shutdown_sasl':
/dev/shm/portage/dev-libs/libmemcached-0.44/work/libmemcached-0.44/clients/utilities.c:216: undefined reference to `sasl_done'
libmemcached/.libs/libmemcached.so: undefined reference to `sasl_client_step'
libmemcached/.libs/libmemcached.so: undefined reference to `sasl_dispose'
libmemcached/.libs/libmemcached.so: undefined reference to `sasl_client_start'
libmemcached/.libs/libmemcached.so: undefined reference to `sasl_client_new'
collect2: ld returned 1 exit status
make[2]: *** [clients/memcapable] Error 1
make[2]: Leaving directory `/dev/shm/portage/dev-libs/libmemcached-0.44/work/libmemcached-0.44'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/dev/shm/portage/dev-libs/libmemcached-0.44/work/libmemcached-0.44'
make: *** [all] Error 2

Increasing the verbosity:
/bin/sh ./libtool --tag=CC --mode=link x86_64-pc-linux-gnu-gcc -std=gnu99 -pthread -pipe -O3 -pedantic -Wall -Wundef -Wshadow -fdiagnostics-show-option -fvisibility=hidden -Wformat=2 -Wconversion -Wstrict-aliasing -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align -Wswitch-default -Wswitch-enum -Wwrite-strings -Wlogical-op -march=nocona -O2 -pipe -g -Wl,-O1 -Wl,--as-needed -o clients/memcapable clients/memcapable.o -lm clients/libutilities.la libmemcached/libmemcached.la /usr/lib64/libsasl2.so /usr/lib64/libdl.so /usr/lib64/libcrypt.so /usr/lib64/libresolv.so libmemcached/libbyteorder.la -lrt
libtool: link: x86_64-pc-linux-gnu-gcc -std=gnu99 -pthread -pipe -O3 -pedantic -Wall -Wundef -Wshadow -fdiagnostics-show-option -fvisibility=hidden -Wformat=2 -Wconversion -Wstrict-aliasing -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align -Wswitch-default -Wswitch-enum -Wwrite-strings -Wlogical-op -march=nocona -O2 -pipe -g -Wl,-O1 -Wl,--as-needed -o clients/.libs/memcapable clients/memcapable.o /usr/lib64/libsasl2.so /usr/lib64/libdl.so /usr/lib64/libcrypt.so /usr/lib64/libresolv.so clients/.libs/libutilities.a libmemcached/.libs/libmemcached.so -lm libmemcached/.libs/libbyteorder.a -lrt -pthread
clients/.libs/libutilities.a(utilities.o): In function `initialize_sasl':
/dev/shm/portage/dev-libs/libmemcached-0.44/work/libmemcached-0.44/clients/utilities.c:196: undefined reference to `sasl_client_init'
clients/.libs/libutilities.a(utilities.o): In function `shutdown_sasl':
/dev/shm/portage/dev-libs/libmemcached-0.44/work/libmemcached-0.44/clients/utilities.c:216: undefined reference to `sasl_done'
libmemcached/.libs/libmemcached.so: undefined reference to `sasl_client_step'
libmemcached/.libs/libmemcached.so: undefined reference to `sasl_dispose'
libmemcached/.libs/libmemcached.so: undefined reference to `sasl_client_start'
libmemcached/.libs/libmemcached.so: undefined reference to `sasl_client_new'
collect2: ld returned 1 exit status
make[2]: *** [clients/memcapable] Error 1
make[2]: Leaving directory `/dev/shm/portage/dev-libs/libmemcached-0.44/work/libmemcached-0.44'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/dev/shm/portage/dev-libs/libmemcached-0.44/work/libmemcached-0.44'
make: *** [all] Error 2

Brian Aker (brianaker)
Changed in libmemcached:
assignee: nobody → Trond Norbye (trond-norbye)
Brian Aker (brianaker)
Changed in libmemcached:
importance: Undecided → Medium
Revision history for this message
Sandy (sandeeptt) wrote :

Is there a patch to this? I get the same error on Solaris 10 Sparc 64bit machine.

Revision history for this message
Sandy (sandeeptt) wrote :

If I configure libmemcached with "--disable-sasl --disable-dtrace", I see a different error when compiling a product dependent on libmemcached.

"/opt/libmemcached-0.44/inst/include/libmemcached/server.h", line 54: undefined symbol: NI_MAXHOST
"/opt/libmemcached-0.44/inst/include/libmemcached/server.h", line 54: can not declare variably modified type at file scope

Revision history for this message
Trond Norbye (trond-norbye) wrote :

I'll try to get around to look at this bug this weekend...

Revision history for this message
Sandy (sandeeptt) wrote :

Sure. Thanks Trond. Is the missing symbol appeared because I disabled sasl while configuring? Or?

Revision history for this message
Trond Norbye (trond-norbye) wrote :

I pushed a fix for the compile problems on Solaris to https://code.launchpad.net/~trond-norbye/libmemcached/compile-fixes (they are unrelated to the original bug).

Changed in libmemcached:
status: New → Invalid
Revision history for this message
Trond Norbye (trond-norbye) wrote :

I tried to reproduce this on Debian with gcc 4.4.5, and it compiles without problems after:

./configure --enable-sasl --without-memcached LDFLAGS=-Wl,--as-needed

I guess that this has been fixed at some time.. Please reopen the bug if you're unable to compile libmemcached with --as-needed to the linker..

Revision history for this message
Brian Aker (brianaker) wrote : Re: [Bug 656010] link failure with LDFLAGS="-Wl,--as-needed"
Download full text (4.2 KiB)

Hi!

No one has provided a patch.

Cheers,
 -Brian

On Jul 28, 2011, at 7:26 AM, Sandy wrote:

> Is there a patch to this? I get the same error on Solaris 10 Sparc 64bit
> machine.
>
> --
> You received this bug notification because you are subscribed to
> libmemcached.
> https://bugs.launchpad.net/bugs/656010
>
> Title:
> link failure with LDFLAGS="-Wl,--as-needed"
>
> Status in libmemcached - A C and C++ client library for memcached:
> New
>
> Bug description:
> The order of items being presented for linking needs to be fixed to
> work with -Wl,--as-needed.
>
> CCLD clients/memcapable
> clients/.libs/libutilities.a(utilities.o): In function `initialize_sasl':
> /dev/shm/portage/dev-libs/libmemcached-0.44/work/libmemcached-0.44/clients/utilities.c:196: undefined reference to `sasl_client_init'
> clients/.libs/libutilities.a(utilities.o): In function `shutdown_sasl':
> /dev/shm/portage/dev-libs/libmemcached-0.44/work/libmemcached-0.44/clients/utilities.c:216: undefined reference to `sasl_done'
> libmemcached/.libs/libmemcached.so: undefined reference to `sasl_client_step'
> libmemcached/.libs/libmemcached.so: undefined reference to `sasl_dispose'
> libmemcached/.libs/libmemcached.so: undefined reference to `sasl_client_start'
> libmemcached/.libs/libmemcached.so: undefined reference to `sasl_client_new'
> collect2: ld returned 1 exit status
> make[2]: *** [clients/memcapable] Error 1
> make[2]: Leaving directory `/dev/shm/portage/dev-libs/libmemcached-0.44/work/libmemcached-0.44'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/dev/shm/portage/dev-libs/libmemcached-0.44/work/libmemcached-0.44'
> make: *** [all] Error 2
>
> Increasing the verbosity:
> /bin/sh ./libtool --tag=CC --mode=link x86_64-pc-linux-gnu-gcc -std=gnu99 -pthread -pipe -O3 -pedantic -Wall -Wundef -Wshadow -fdiagnostics-show-option -fvisibility=hidden -Wformat=2 -Wconversion -Wstrict-aliasing -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align -Wswitch-default -Wswitch-enum -Wwrite-strings -Wlogical-op -march=nocona -O2 -pipe -g -Wl,-O1 -Wl,--as-needed -o clients/memcapable clients/memcapable.o -lm clients/libutilities.la libmemcached/libmemcached.la /usr/lib64/libsasl2.so /usr/lib64/libdl.so /usr/lib64/libcrypt.so /usr/lib64/libresolv.so libmemcached/libbyteorder.la -lrt
> libtool: link: x86_64-pc-linux-gnu-gcc -std=gnu99 -pthread -pipe -O3 -pedantic -Wall -Wundef -Wshadow -fdiagnostics-show-option -fvisibility=hidden -Wformat=2 -Wconversion -Wstrict-aliasing -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wcast-align -Wswitch-default -Wswitch-enum -Wwrite-strings -Wlogical-op -march=nocona -O2 -pipe -g -Wl,-O1 -Wl,--as-needed -o clients/.libs/memcapable clients/memcapable.o /usr/lib64/libsasl2.so /usr/lib64/libdl.so /usr/lib64/libcrypt.so /usr/lib64/libresolv.so clients/.libs/libutilities.a libmemcached/.libs/libmemcached.so -lm libmemcached/.libs/libbyteorder.a -lrt -pthread
> clients/.libs/libutilities.a(utilities.o): In function `initialize_sasl':
> /dev/shm/portage/dev-libs/libmemcached-0.44/work/libmemcached-0....

Read more...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.