Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make error when multi version of openssl library installed in system #10

Closed
buaazp opened this issue Apr 17, 2014 · 3 comments
Closed

Comments

@buaazp
Copy link
Owner

buaazp commented Apr 17, 2014

If you installed more than one version of openssl library. CmakeList.txt in zimg cannot fit it correctly.
For example, CentOS has a low version openssl (found version "0.9.8e-rhel5") which cannot be used for build libevhtp. Then you install a new openssl by sourcecode. Error happens like this:

Scanning dependencies of target zimg
Linking C executable zimg
/usr/bin/ld: skipping incompatible /usr/lib/libssl.so when searching for -lssl
/usr/bin/ld: skipping incompatible /usr/lib/libssl.a when searching for -lssl
/usr/bin/ld: skipping incompatible /usr/lib/libcrypto.so when searching for -lcrypto
/usr/bin/ld: skipping incompatible /usr/lib/libcrypto.a when searching for -lcrypto
/usr/bin/ld: skipping incompatible /usr/lib/liblua-5.1.so when searching for -llua-5.1
/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread
/usr/bin/ld: skipping incompatible /usr/lib/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/libc.a when searching for -lc
/usr/local/lib/libevhtp.a(evhtp.c.o): In function `evhtp_ssl_init':
evhtp.c:(.text+0x1018): undefined reference to `EC_KEY_new_by_curve_name'
evhtp.c:(.text+0x1040): undefined reference to `EC_KEY_free'
/usr/local/lib/libevhtp.a(evhtp.c.o): In function `_evhtp_ssl_servername':
evhtp.c:(.text+0x4f7e): undefined reference to `SSL_get_servername'
evhtp.c:(.text+0x501c): undefined reference to `SSL_set_SSL_CTX'
/usr/local/lib/libevhtp.a(evhtp.c.o): In function `_evhtp_request_parser_hostname':
evhtp.c:(.text+0x5c99): undefined reference to `SSL_get_servername'
collect2: ld returned 1 exit status
make[2]: *** [zimg] Error 1
make[1]: *** [CMakeFiles/zimg.dir/all] Error 2
make: *** [all] Error 2
@buaazp buaazp added the bug label Apr 17, 2014
@buaazp
Copy link
Owner Author

buaazp commented Apr 17, 2014

The reason of this bug is cmake function find_package(OpenSSL) can only find the low version openssl and it conflicts with libevhtp.a.

To fix this problem, take steps below:

1.find the path of high version openssl, in my system is:

/usr/local/lib64/libssl.a
/usr/local/lib64/libcrypto.a

2.modify vim CMakeLists.txt and added this path to the CMAKE_EXE_LINKER_FLAGS. Make sure this path is front than others. The postion of CMAKE_EXE_LINKER_FLAGS is at the end of CMakeLists.txt:

set(CMAKE_EXE_LINKER_FLAGS "-L/usr/local/lib64 -L/usr/local/lib -L/usr/lib")

3.rebuild zimg will succ.

cmake .
make

@buaazp buaazp changed the title make error when multi version openssl library installed in system make error when multi version of openssl library installed in system Apr 17, 2014
@errzey
Copy link

errzey commented Apr 17, 2014

You can also do:

 LDFLAGS="-L/usr/local/lib64 -L/usr/local/lib -L/usr/lib" cmake .

@buaazp
Copy link
Owner Author

buaazp commented Apr 17, 2014

Got it!
Thanks @ellzey

@buaazp buaazp closed this as completed Apr 28, 2014
@buaazp buaazp added the build label Aug 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants