cyrusimap / cyrus-imapd

Cyrus IMAP is an email, contacts and calendar server
http://cyrusimap.org
Other
548 stars 150 forks source link

libxml2 configure test needs jansson, but doesn't correctly pull it in #3175

Open elliefm opened 4 years ago

elliefm commented 4 years ago

Thanks, @elliefm. I've just dug a bit further and the libxml2 test is failing in configure as it cannot find -ljansson. But libjansson has already been found and is OK (see config.log below). So it looks like libjansson is not correctly linked in the configure test for libxml2. In my setup, I'm using the libjansson in /usr/local/cyruslibs. Unfortunately, C has not been my first language for about 30 years, so I'm reluctant to go digging any further, but it looks like the real issue is in the configure test.

configure:18474: checking for JANSSON
configure:18481: $PKG_CONFIG --exists --print-errors "jansson >= 2.3"
configure:18484: $? = 0
configure:18498: $PKG_CONFIG --exists --print-errors "jansson >= 2.3"
configure:18501: $? = 0
configure:18539: result: yes
configure:18559: checking for json_dumpb in -ljansson
configure:18584: gcc -o conftest -W -Wno-unused-parameter -g -O0 -Wall -Wextra -Werror -fPIC -I/usr/local/cyruslibs/include -L/usr/local/cyruslibs/lib -ljansson  -Wl,-rpath,/usr/local/cyruslibs/lib -Wl,-rpa>
configure:18584: $? = 0
configure:18593: result: yes
configure:18616: checking for ICU
configure:18623: $PKG_CONFIG --exists --print-errors "icu-i18n >= 55 icu-uc >= 55"
configure:18626: $? = 0
configure:18640: $PKG_CONFIG --exists --print-errors "icu-i18n >= 55 icu-uc >= 55"
configure:18643: $? = 0
configure:18681: result: yes
configure:18704: checking for ZEROSKIP
configure:18711: $PKG_CONFIG --exists --print-errors "libzeroskip"
configure:18714: $? = 0
configure:18728: $PKG_CONFIG --exists --print-errors "libzeroskip"
configure:18731: $? = 0
configure:18769: result: yes
configure:18799: checking for LIBCHARDET
configure:18806: $PKG_CONFIG --exists --print-errors "chardet"
configure:18809: $? = 0
configure:18823: $PKG_CONFIG --exists --print-errors "chardet"
configure:18826: $? = 0
configure:18864: result: yes
configure:19034: checking for XML2
configure:19041: $PKG_CONFIG --exists --print-errors "libxml-2.0"
configure:19044: $? = 0
configure:19058: $PKG_CONFIG --exists --print-errors "libxml-2.0"
configure:19061: $? = 0
configure:19099: result: yes
configure:19110: checking for xmlFirstElementChild in -lxml2
configure:19135: gcc -o conftest -W -Wno-unused-parameter -g -O0 -Wall -Wextra -Werror -fPIC  -Wl,-rpath,/usr/local/cyruslibs/lib -Wl,-rpath,/usr/local/cyruslibs/lib/x86_64-linux-gnu conftest.c -lxml2  -lja>
/usr/bin/ld: cannot find -ljansson
collect2: error: ld returned 1 exit status
configure:19135: $? = 1
configure: failed program was:
| /* confdefs.h */

Originally posted by @earthspike in https://github.com/cyrusimap/cyrus-imapd/pull/3153#issuecomment-687653713

elliefm commented 4 years ago

@earthspike,

configure:19135: gcc -o conftest -W -Wno-unused-parameter -g -O0 -Wall -Wextra -Werror -fPIC  -Wl,-rpath,/usr/local/cyruslibs/lib -Wl,-rpath,/usr/local/cyruslibs/lib/x86_64-linux-gnu conftest.c -lxml2  -lja>

I think this line has been truncated while pasting, notice that it ends with "-lja>". It looks like it's trying to link against -ljansson but it doesn't have the -L/path/to/nonstandard/libjansson before it that I would have expected, which is very unusual.

When I configure 3.2 here, it doesn't try to link libjansson for this check at all, and I don't see why libxml2 would be dependent on libjansson, so it's stranger and stranger. So I think the question is not "why can't it find libjansson?", but "why does it think it wants it?"

Can you please:

1) Attach your full config.log file here (redact as necessary for privacy, but please leave all the detail). You can attach a file by clicking the "Attach files by..." bit at the bottom of the comment box. 2) Apply this patch https://github.com/cyrusimap/cyrus-imapd/compare/cyrus-imapd-3.2...elliefm:v32/3175-libxml2-jansson (you can download it as a .patch file from this address: https://github.com/cyrusimap/cyrus-imapd/commit/7cf703f0b9b9ce4e74a71dc2c3bf1fd1a3fc4ecc.patch), re-run configure, and attach the new config.log as well

I'm not yet sure what the shape of the correct fix will be, but hopefully comparing these two config logs will send me in the correct direction. Thanks!

earthspike commented 3 years ago

Apologies, @elliefm I've not been able to get to this for a few months. Still needed? I'm now trying to compile 3.3.1 and have a separate issue.

elliefm commented 3 years ago

I'm not sure! I wasn't able to reproduce whatever was going on locally, so without config logs to pore over, I couldn't really do much. It doesn't seem likely to have just fixed itself either... but nobody else is reporting a problem, so 🤷‍♀️

What's your 3.3.1 issue?