❦ 13 juillet 2015 19:16 +0200, "bjun...@gmail.com" <bjun...@gmail.com> :

> make TARGET=linux2628 USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_LUA=yes
> LUA_LIB=/opt/lua53/lib/ LUA_INC=/opt/lua53/include/ LDFLAGS=-ldl
>
>
>
> resulting error:
>
> .
> .
> .
> gcc -ldl -o haproxy src/haproxy.o src/sessionhash.o src/base64.o
> src/protocol.o src/uri_auth.o src/standard.o src/buffer.o src/log.o
> src/task.o src/chunk.o src/channel.o src/listener.o src/lru.o
> src/xxhash.o src/time.o src/fd.o src/pipe.o src/regex.o src/cfgparse.o
> src/server.o src/checks.o src/queue.o src/frontend.o src/proxy.o
> src/peers.o src/arg.o src/stick_table.o src/proto_uxst.o
> src/connection.o src/proto_http.o src/raw_sock.o src/appsession.o
> src/backend.o src/lb_chash.o src/lb_fwlc.o src/lb_fwrr.o src/lb_map.o
> src/lb_fas.o src/stream_interface.o src/dumpstats.o src/proto_tcp.o
> src/applet.o src/session.o src/stream.o src/hdr_idx.o src/ev_select.o
> src/signal.o src/acl.o src/sample.o src/memory.o src/freq_ctr.o
> src/auth.o src/proto_udp.o src/compression.o src/payload.o src/hash.o
> src/pattern.o src/map.o src/namespace.o src/mailers.o src/dns.o
> src/vars.o src/ev_poll.o src/ev_epoll.o src/ssl_sock.o src/shctx.o
> src/hlua.o ebtree/ebtree.o ebtree/eb32tree.o ebtree/eb64tree.o
> ebtree/ebmbtree.o ebtree/ebsttree.o ebtree/ebimtree.o
> ebtree/ebistree.o   -lcrypt  -lz -ldl  -lssl -lcrypto
> -L/opt/lua53/lib/ -llua -lm -L/usr/lib -lpcreposix -lpcre
> /usr/bin/ld: /opt/lua53/lib//liblua.a(loadlib.o): undefined reference
> to symbol 'dlclose@@GLIBC_2.2.5'
> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libdl.so:
> error adding symbols: DSO missing from command line
> collect2: error: ld returned 1 exit status
> make: *** [haproxy] Error 1

-ldl where dlclose@@GLIBC_2.2.5 should be after -llua, where this symbol
is used.

I suppose that either -ldl could be added to OPTIONS_LDFLAGS append,
like this is done for -lm. Or USE_DL section could be moved towards the
end. I think the first solution is better since libdl seems to be a
dependency of lua.

Note that this is not an Ubuntu-specific but they enforce --as-needed by
default directly in the linker.

> Only if i change LDFLAGS to the following the build is succesful:
>
>
>
> make TARGET=linux2628 USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_LUA=yes
> LUA_LIB=/opt/lua53/lib/ LUA_INC=/opt/lua53/include/
> LDFLAGS=-Wl,--no-as-needed
>
>
>
>
> I'm not aware of the consequences, does anybody have an idea ?

In your case, this is harmless. --as-needed is used mostly to avoid to
pull unneeded dependencies by linking unused symbols. The downside is
that libraries need to be linked in the correct order (a symbol is kept
only if it was previously missing). This is mostly a distro stuff.
-- 
Use self-identifying input.  Allow defaults.  Echo both on output.
            - The Elements of Programming Style (Kernighan & Plauger)

Reply via email to