Bug 827 - nsd compilation fails when openssl-1.1.0 is compiled with --api=1.1.0
nsd compilation fails when openssl-1.1.0 is compiled with --api=1.1.0
Status: RESOLVED FIXED
Product: NSD
Classification: Unclassified
Component: NSD Code
4.1.x
All All
: P5 normal
Assigned To: NSD team
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-08-31 07:43 CEST by Lars Wendler
Modified: 2016-09-02 11:23 CEST (History)
1 user (show)

See Also:


Attachments
build.log (16.88 KB, text/plain)
2016-08-31 07:43 CEST, Lars Wendler
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Wendler 2016-08-31 07:43:20 CEST
Created attachment 355 [details]
build.log

x86_64-pc-linux-gnu-gcc -march=native -mtune=native -O2 -pipe -Wl,-O1 -Wl,--hash
-style=gnu -Wl,--sort-common -Wl,--as-needed -o nsd answer.o axfr.o buffer.o con
figlexer.o configparser.o dname.o dns.o edns.o iterated_hash.o lookup3.o namedb.
o nsec3.o options.o packet.o query.o rbtree.o radtree.o rdata.o region-allocator
.o rrl.o tsig.o tsig-openssl.o udb.o udbradtree.o udbzone.o util.o xfrd-disk.o x
frd-notify.o xfrd-tcp.o xfrd.o remote.o difffile.o ipc.o mini_event.o netio.o ns
d.o server.o dbaccess.o dbcreate.o zlexer.o zonec.o zparser.o strlcat.o strlcpy.
o b64_pton.o b64_ntop.o reallocarray.o -lssl -lcrypto
tsig-openssl.o: In function `tsig_openssl_init':
tsig-openssl.c:(.text+0x19c): undefined reference to `OpenSSL_add_all_digests'
tsig-openssl.o: In function `tsig_openssl_finalize':
tsig-openssl.c:(.text+0x243): undefined reference to `EVP_cleanup'
remote.o: In function `daemon_remote_create':
remote.c:(.text+0x2b22): undefined reference to `ERR_load_crypto_strings'
remote.c:(.text+0x2b2e): undefined reference to `OpenSSL_add_all_algorithms'
remote.c:(.text+0x2b35): undefined reference to `SSL_library_init'
collect2: error: ld returned 1 exit status
make: *** [Makefile:150: nsd] Error 1
Comment 1 Lars Wendler 2016-08-31 15:56:40 CEST
Additional note:

openssl-1.1 has a new API whose changes can be found at 

  https://wiki.openssl.org/index.php/1.1_API_Changes
Comment 2 Wouter Wijngaards 2016-09-01 14:14:15 CEST
Hi Lars,

I downloaded openssl1.1.0 and compiled NSD with it and that worked fine.  It calls SSL_library_init from remote.c just fine and that links just fine.  Something must be wrong with your libcrypto?

In your output these functions show up as undeclared, this may be the problem.  The header files are not properly installed for openssl?  (in /usr/include)

Best regards, Wouter
Comment 3 Wouter Wijngaards 2016-09-01 14:15:14 CEST
Hi Lars,

For your additional note.  Yes I had to fix NSD for that API change, but that is already done, and in the version you seem to be compiling.  You are having some other issue?

Best regards, Wouter
Comment 4 Lars Wendler 2016-09-02 09:16:51 CEST
Hi Wouter,

yes, this might be a problem with my openssl-1.1.0 installation.
Sorry for wasting your time on this matter.

Kind regards
Lars
Comment 5 Lars Wendler 2016-09-02 10:44:19 CEST
Hi Wouter,

I've checked my openssl-1.1.0 installation and might have found the issue.

I compiled openssl-1.1.0 with the following option:

  --api=1.1.0


This leads to 

/usr/include/openssl/ssl.h not defining SSL_library_init anymore[1]
/usr/include/openssl/evp.h not defining OpenSSL_add_all_algorithms anymore[2]
/usr//include/openssl/err.h not defining ERR_load_crypto_strings anymore [3]

which then leads to the linker errors that can be seen in my initial comment.

I've reopened the bug in case you want to address this issue.

If you think this is not something that requires fixing may I suggest that you document the requirement of openssl-1.1.0 being compiled with --api=1.0.0 or --api=0.9.8 somewhere?

Kind regards 
Lars


[1] https://github.com/openssl/openssl/blob/master/include/openssl/ssl.h#L1660 lines 1660 to 1662
[2] https://github.com/openssl/openssl/blob/master/include/openssl/evp.h#L841 lines 841 to 867
[3] https://github.com/openssl/openssl/blob/master/include/openssl/err.h#L240 lines 240 to 244
Comment 6 Wouter Wijngaards 2016-09-02 11:23:13 CEST
Hi Lars,

Thanks!  Fixed this in the code repository.

Best regards, Wouter