profanity-im / libmesode

*Deprecated* Fork of libstrophe (https://github.com/strophe/libstrophe) for use with Profanity XMPP Client
Other
17 stars 10 forks source link

Tests fail without static libraries #20

Closed ghost closed 3 years ago

ghost commented 3 years ago

When building libmesode (v0.10.1) from source, with --disable-static configure-flag, the build fails with following errors:

test_hash.c:(.text+0x7e): undefined reference to `hash_new'
ld: test_hash.c:(.text+0xe2): undefined reference to `hash_add'
ld: test_hash.c:(.text+0x10d): undefined reference to `hash_num_keys'
ld: test_hash.c:(.text+0x168): undefined reference to `hash_add'
ld: test_hash.c:(.text+0x185): undefined reference to `hash_num_keys'
ld: test_hash.c:(.text+0x1b1): undefined reference to `hash_get'
ld: test_hash.c:(.text+0x23b): undefined reference to `hash_add'
ld: test_hash.c:(.text+0x247): undefined reference to `hash_clone'
ld: test_hash.c:(.text+0x274): undefined reference to `hash_get'
ld: test_hash.c:(.text+0x2d1): undefined reference to `hash_iter_new'
ld: test_hash.c:(.text+0x2fb): undefined reference to `hash_iter_next'
ld: test_hash.c:(.text+0x331): undefined reference to `hash_iter_next'
ld: test_hash.c:(.text+0x352): undefined reference to `hash_iter_next'
ld: test_hash.c:(.text+0x373): undefined reference to `hash_iter_release'
ld: test_hash.c:(.text+0x37f): undefined reference to `hash_release'
ld: test_hash.c:(.text+0x399): undefined reference to `hash_drop'
ld: test_hash.c:(.text+0x3b3): undefined reference to `hash_get'
ld: test_hash.c:(.text+0x3dc): undefined reference to `hash_drop'
ld: test_hash.c:(.text+0x3f6): undefined reference to `hash_drop'
ld: test_hash.c:(.text+0x410): undefined reference to `hash_get'
ld: test_hash.c:(.text+0x439): undefined reference to `hash_get'
ld: test_hash.c:(.text+0x45e): undefined reference to `hash_get'
ld: test_hash.c:(.text+0x484): undefined reference to `hash_get'
ld: test_hash.c:(.text+0x49c): undefined reference to `hash_release'
collect2: error: ld returned 1 exit status
nckx commented 3 years ago

The tests make heavy use of unexported symbols; e.g., you can get them to ‘work’ by

--- a/Makefile.in 2021-02-23 19:59:36.016767814 +0100
+++ b/Makefile.in 2021-02-23 20:46:25.720571374 +0100
@@ -801,7 +801,7 @@
 libmesode_la_CFLAGS = $(SSL_CFLAGS) $(MESODE_FLAGS) $(PARSER_CFLAGS)
 # Export only public API
 libmesode_la_LDFLAGS = $(SSL_LIBS) $(PARSER_LIBS) $(RESOLV_LIBS) \
+   -no-undefined -export-symbols-regex '^xmpp_'
-   -no-undefined -export-symbols-regex '.'
 libmesode_la_SOURCES = src/auth.c src/conn.c src/crypto.c src/ctx.c \
    src/event.c src/handler.c src/hash.c src/jid.c src/md5.c \
    src/rand.c src/resolver.c src/sasl.c src/scram.c src/sha1.c \

Mmm. Yucky. <3

ghost commented 3 years ago

@pasis @jubalh

Changing '^xmpp_' to '.', in Makefile.am, fixed the errors for me. Thanks to @nckx

:-)

nckx commented 3 years ago

Oh! You're very welcome, but I don't consider the above a fix. It's more of a warning to others.

May someone with sharper autotools chops suggest something that doesn't frighten children.

:jack_o_lantern: