OpenFastPath / ofp

OpenFastPath project
BSD 3-Clause "New" or "Revised" License
349 stars 126 forks source link

Optional --with-libconfig may not work #229

Closed HsuJv closed 4 years ago

HsuJv commented 4 years ago

I find that there is an option "--with-libconfig" after "./configure --help" and use it to specify a non-standard install. But it keeps alerting

checking for libconfig.h... yes checking for library containing config_init... no configure: error: Unable to find libconfig library

After I investigating the configure.ac file, I'm confused by the line 402 LIBS="-lconfig $LIBS":

why LIBS="-lconfig $LIBS" ? Doesn't it mean to use the system default libconfig rather than the one "-L$with_libconfig/lib" specifies?

Then I modify the configure file to echo the checking statement and get

checking for library containing config_init... =========================-lconfig -L/some/other/path/odp/lib/ -lodp-linux ....(something else)

The checking is not using the specified user-installed libconfig at all!!

For my practice, it doesn't work at all until I change this statement to LIBS="-L$with_libconfig/lib -lconfig $LIBS"

HsuJv commented 4 years ago

It seems the $LIBS should be put ahead, to say, LIBS="$LIBS -L$with_libconfig/lib -lconfig". Otherwise I'm getting a linking error while link target classifier

CCLD classifier /ld_path/real-ld:/install_path/odp/lib/libodp-linux.a(odp_crypto_openssl.o): in function `HMAC_CTX_new': /odp_path/platform/linux-musdk/../linux-generic/odp_crypto_openssl.c:283: undefined reference to `HMAC_CTX_init' /ld_path/real-ld:/install_path/odp/lib/libodp-linux.a(odp_crypto_openssl.o): in function `HMAC_CTX_free': /odp_path/platform/linux-musdk/../linux-generic/odp_crypto_openssl.c:289: undefined reference to `HMAC_CTX_cleanup' /ld_path/real-ld:/install_path/odp/lib/libodp-linux.a(odp_crypto_openssl.o): in function `openssl_thread_id': /odp_path/platform/linux-musdk/../linux-generic/odp_crypto_openssl.c:1910: undefined reference to `CRYPTO_THREADID_set_numeric' /ld_path/real-ld:/install_path/odp/lib/libodp-linux.a(odp_crypto_openssl.o): in function `odp_crypto_init_global': /odp_path/platform/linux-musdk/../linux-generic/odp_crypto_openssl.c:1933: undefined reference to `CRYPTO_num_locks' /ld_path/real-ld: /odp_path/platform/linux-musdk/../linux-generic/odp_crypto_openssl.c:1964: undefined reference to `CRYPTO_THREADID_set_callback' /ld_path/real-ld: /odp_path/platform/linux-musdk/../linux-generic/odp_crypto_openssl.c:1965: undefined reference to `CRYPTO_set_locking_callback' /ld_path/real-ld:/install_path/odp/lib/libodp-linux.a(odp_crypto_openssl.o): in function `odp_crypto_term_global': /odp_path/platform/linux-musdk/../linux-generic/odp_crypto_openssl.c:1985: undefined reference to `CRYPTO_set_locking_callback' /ld_path/real-ld: /odp_path/platform/linux-musdk/../linux-generic/odp_crypto_openssl.c:1986: undefined reference to `CRYPTO_set_id_callback'

Which says that odp-linux.a depends on libconfig, but the statement "-L/libconfig_install_path/lib -lconfig" keeps appearing in advance of the "-L/odp_install_path/lib -lodp-linux", even I put the option --with-libconfig=prefix ahead of --with-odp=prefix

HsuJv commented 4 years ago

I double checked these codes again and found that I was not thoughtful enough about it before.

This code LIBS="-lconfig $LIBS" is used to link to the standrad-installing libconfig. But there's no update after a --with-libconfig= specifies so that it keeps checking the system path while ./configure.

But I still can not figure out why this line will affect the link of classifier.

Pls provide a best solution.

MatiasElo commented 4 years ago

This seems like a valid problem. Which ODP version are you using?

HsuJv commented 4 years ago

odp-marvell, v1.21.0.

Which one of these two problem that seems to be valid? The one about config.ac or the one about classifier?

I've searched in the issues but none of an issue that mentions the config.ac problem. You just tell them to install a libconfig-dev. But for my practise, I'm sure I've had a libconfig-dev in a non-standrad installing path

MatiasElo commented 4 years ago

Most likely both are valid. I've reproduced the libconfig install path problem on my test system and I'm working on a fix right now. I'll take a look at the linking issue next.

HsuJv commented 4 years ago

Well, waiting for ur good news

MatiasElo commented 4 years ago

Does this commit https://github.com/matiaselo/ofp/commit/f1b1582aa52458f3fc3cd10c3ec6acb7a997eb41 fix your libconfig issue?

The linker errors you have pasted are from OpenSSL library. Which OpenSSL version are you using?

HsuJv commented 4 years ago

Yes it works, but the check of _configinit becomes none required, is that right?

The openssl suite is 1.0.2r version.

In fact, it only appears when I put -lconfig ahead of -lodp-linux (as a temprorary workaround, I changed the line 402 in the old config.ac to LIBS="-L$with_libconfig/lib -lconfig $LIBS" to pass the check and got the link error. And then I change it to LIBS="$LIBS -L$with_libconfig/lib -lconfig" and got no error). And with your fix commit, the link error disappears as well.

Thanks a lot

MatiasElo commented 4 years ago

Yes it works, but the check of _configinit becomes none required, is that right?

I'm not completely sure what you mean by this. I still want to check that the library is available if use_libconfig is true.

In fact, it only appears when I put -lconfig ahead of -lodp-linux (as a temprorary workaround, I changed the line 402 in the old config.ac to LIBS="-L$with_libconfig/lib -lconfig $LIBS" to pass the check and got the link error. And then I change it to LIBS="$LIBS -L$with_libconfig/lib -lconfig" and got no error). And with your fix commit, the link error disappears as well.

Just to be sure, is the linking now working for you without any additional modifications?

The openssl suite is 1.0.2r version.

I assume you are still getting the OpenSSL linking failures. Is your OpenSSL installed in the standard system path?

HsuJv commented 4 years ago

The linking is working now. Nothing more ought to be modified. The linking error may be introduced by some of my rough change to pass the configure checking.

Sorry for my unclear expression which disturbs you.

What I mean is I'm getting these echos while configuring:

checking libconfig.h... yes checking for library containing config_init... none required.

Is the statement none required right ? Does it ought to be yes?

MatiasElo commented 4 years ago

checking libconfig.h... yes checking for library containing config_init... none required.

Is the statement none required right ? Does it ought to be yes?

Thanks, good catch. This was caused by an unnecessary LIBS="-lconfig $LIBSline in my patch. AC_SEARCH_LIBS adds libconfig to LIBS if the test passes.

HsuJv commented 4 years ago

gotcha, thanks a lot again. And I'll close this issue as is solved.

MatiasElo commented 4 years ago

gotcha, thanks a lot again. And I'll close this issue as is solved.

Glad to help. I'll keep the issue open until the fix is merged.