Project

General

Profile

Bug #22

Darwin: Compiling ep fails: EVP_DigestSignFinal not found

Added by Anonymous about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
07/20/2016
Due date:
% Done:

0%


Description

Under Darwin, running make in gdp/ep fails because /opt/local/lib/libcrypto.dylib is not used at link time

How to reproduce:

bash-3.2$ make
cc  -Wall -g -O   -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -D_CURRENT_DATE_=\"`date +'%Y-%m-%d_%H:%M'`\" -c ep_version.c
ar -r libep.a ep_adm.o ep_app.o ep_assert.o ep_b64.o ep_crypto.o ep_crypto_cipher.o ep_crypto_key.o ep_crypto_md.o ep_crypto_sign.o ep_crypto_vrfy.o ep_dbg.o \
ep_dumpfds.o ep_fopen_smem.o ep_fopen_syslog.o ep_fread_unlocked.o ep_funclist.o ep_hash.o ep_hexdump.o ep_lib.o ep_log.o ep_mem.o ep_net.o ep_pcvt.o ep_pprin\
t.o ep_prflags.o ep_rpool.o ep_stat.o ep_statcodes.o ep_string.o ep_syslog.o ep_thr.o ep_thr_pool.o ep_time.o ep_xlate.o  ep_version.o
ranlib libep.a
rm -f ../libs/libep.a
cp libep.a ../libs
cc -shared  -o libep.so.3.0 ep_adm.o ep_app.o ep_assert.o ep_b64.o ep_crypto.o ep_crypto_cipher.o ep_crypto_key.o ep_crypto_md.o ep_crypto_sign.o ep_crypto_vr\
fy.o ep_dbg.o ep_dumpfds.o ep_fopen_smem.o ep_fopen_syslog.o ep_fread_unlocked.o ep_funclist.o ep_hash.o ep_hexdump.o ep_lib.o ep_log.o ep_mem.o ep_net.o ep_p\
cvt.o ep_pprint.o ep_prflags.o ep_rpool.o ep_stat.o ep_statcodes.o ep_string.o ep_syslog.o ep_thr.o ep_thr_pool.o ep_time.o ep_xlate.o  ep_version.o  -lcrypto
Undefined symbols for architecture x86_64:
  "_EVP_DigestSignFinal", referenced from:
      _ep_crypto_sign_final in ep_crypto_sign.o
  "_EVP_DigestSignInit", referenced from:
      _ep_crypto_sign_new in ep_crypto_sign.o
  "_EVP_DigestVerifyFinal", referenced from:
      _ep_crypto_vrfy_final in ep_crypto_vrfy.o
  "_EVP_DigestVerifyInit", referenced from:
      _ep_crypto_vrfy_new in ep_crypto_vrfy.o
  "_EVP_PKEY_print_private", referenced from:
      _ep_crypto_key_print in ep_crypto_key.o
  "_EVP_PKEY_print_public", referenced from:
      _ep_crypto_key_print in ep_crypto_key.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libep.so.3.0] Error 1
bash-3.2$

My workaround was to add -L${LOCAL2}/lib to LIBS in gdp/ep/Makefile:
~~~
bash-3.2$ git diff
diff --git a/ep/Makefile b/ep/Makefile
index 77366b0..6e7c1f7 100644
--- a/ep/Makefile
+++ b/ep/Makefile
@@ -201,7 +201,7 @@ RM= rm
LD= ld
LDFLAGS= -L. ${LIBSEARCH}
LDLIBS= ${LIBNAME}.a -pthread
-LIBS= -lcrypto
+LIBS= -L${LOCAL2}/lib -lcrypto
LN= ln
MV= mv
CP= cp
bash-3.2$


  

History

#1 Updated by Eric Allman about 4 years ago

  • Status changed from New to Closed

It turns out that LIBSEARCH was supposed to do this but, due to a cut-and-paste error, the Makefile was using -I instead of -L.

eric

#2 Updated by Anonymous about 4 years ago

I'm not sure how to reopen a bug in RedMine. The Status field shows "Closed" and has no way to edit it.

Not a big deal, but I prefer to close bugs that I create after I verify them.

Anyway, I just checked out a clean gdp repo and this still fails for me:
~~~
bash-3.2$ git clone repoman@repo.eecs.berkeley.edu:projects/swarmlab/gdp.git
Cloning into 'gdp'...
remote: Counting objects: 9765, done.

remote: Compressing objects: 100% (6988/6988), done.

remote: Total 9765 (delta 6710), reused 3994 (delta 2608)

Receiving objects: 100% (9765/9765), 6.24 MiB | 59.00 KiB/s, done.
Resolving deltas: 100% (6710/6710), done.
Checking connectivity... done.
bash-3.2$ cd gdp/
bash-3.2$ make
#(cd doc; make all) # needs pandoc
(cd ep; make all)
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_adm.o ep_adm.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_app.o ep_app.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_assert.o ep_assert.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_b64.o ep_b64.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_crypto.o ep_crypto.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_crypto_cipher.o ep_crypto_cipher.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_crypto_key.o ep_crypto_key.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_crypto_md.o ep_crypto_md.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_crypto_sign.o ep_crypto_sign.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_crypto_vrfy.o ep_crypto_vrfy.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_dbg.o ep_dbg.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_dumpfds.o ep_dumpfds.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_fopen_smem.o ep_fopen_smem.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_fopen_syslog.o ep_fopen_syslog.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_fread_unlocked.o ep_fread_unlocked.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_funclist.o ep_funclist.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_hash.o ep_hash.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_hexdump.o ep_hexdump.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_lib.o ep_lib.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_log.o ep_log.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_mem.o ep_mem.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_net.o ep_net.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_pcvt.o ep_pcvt.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_pprint.o ep_pprint.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_prflags.o ep_prflags.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_rpool.o ep_rpool.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_stat.o ep_stat.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_statcodes.o ep_statcodes.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_string.o ep_string.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_syslog.o ep_syslog.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_thr.o ep_thr.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_thr_pool.o ep_thr_pool.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_time.o ep_time.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -c -o ep_xlate.o ep_xlate.c
cc -Wall -g -O -I -I/usr/local/include -I/opt/local/include -I. -I.. -fPIC -D_CURRENT_DATE_=\"date +'%Y-%m-%d_%H:%M'\" -c ep_version.c
ar -r libep.a ep_adm.o ep_app.o ep_assert.o ep_b64.o ep_crypto.o ep_crypto_cipher.o ep_crypto_key.o ep_crypto_md.o ep_crypto_sign.o ep_crypto_vrfy.o ep_dbg.o \
ep_dumpfds.o ep_fopen_smem.o ep_fopen_syslog.o ep_fread_unlocked.o ep_funclist.o ep_hash.o ep_hexdump.o ep_lib.o ep_log.o ep_mem.o ep_net.o ep_pcvt.o ep_pprin\
t.o ep_prflags.o ep_rpool.o ep_stat.o ep_statcodes.o ep_string.o ep_syslog.o ep_thr.o ep_thr_pool.o ep_time.o ep_xlate.o ep_version.o
ar: creating archive libep.a
ranlib libep.a
rm -f ../libs/libep.a
cp libep.a ../libs
cc -shared -o libep.so.3.0 ep_adm.o ep_app.o ep_assert.o ep_b64.o ep_crypto.o ep_crypto_cipher.o ep_crypto_key.o ep_crypto_md.o ep_crypto_sign.o ep_crypto_vr\
fy.o ep_dbg.o ep_dumpfds.o ep_fopen_smem.o ep_fopen_syslog.o ep_fread_unlocked.o ep_funclist.o ep_hash.o ep_hexdump.o ep_lib.o ep_log.o ep_mem.o ep_net.o ep_p\
cvt.o ep_pprint.o ep_prflags.o ep_rpool.o ep_stat.o ep_statcodes.o ep_string.o ep_syslog.o ep_thr.o ep_thr_pool.o ep_time.o ep_xlate.o ep_version.o -lcrypto
Undefined symbols for architecture x86_64:
"EVP_DigestSignFinal", referenced from:
ep_crypto_sign_final in ep_crypto_sign.o
"EVP_DigestSignInit", referenced from:
ep_crypto_signnew in ep
crypto_sign.o
"_EVP_DigestVerifyFinal", referenced from:
_ep
crypto_vrfy_final in ep_crypto_vrfy.o
"EVP_DigestVerifyInit", referenced from:
_ep_crypto
vrfy_new in ep_crypto_vrfy.o
"EVP_PKEYprint
private", referenced from:
ep_crypto_key_print in ep_crypto_key.o
"EVP_PKEY_print_public", referenced from:
ep_crypto_keyprint in ep
crypto_key.o
ld: symbol(s) not found for architecture x86
64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [libep.so.3.0] Error 1
make: *** [all] Error 2
bash-3.2$
~~~

#3 Updated by Anonymous about 4 years ago

Here's a diff that fixes it for me

diff --git a/ep/Makefile b/ep/Makefile
index 11b3626..7ee2e30 100644
--- a/ep/Makefile
+++ b/ep/Makefile
@@ -231,7 +231,7 @@ ${LIBNAME}.a: ${OBJS}
        ${CP} $@ ${LOCALLIBSDIR}

 ${LIBNAME}.so.${EPLIBVER}: ${OBJS}
-       ${CC} ${SHARED} -o $@ ${OBJS} ${LIBS}
+       ${CC} ${SHARED} -o $@ ${OBJS} ${LDFLAGS} ${LIBS}
        (cd ${LOCALLIBSDIR} && sh makelinks.sh ep ${EPLIBMAJVER} ${EPLIBMINVER})

 ${OBJS}: ${HFILES}
bash-3.2$ 

#4 Updated by Eric Allman about 4 years ago

Mea culpa. Some time back I updated the ep Makefile so that it would be more like the others (in particular, using the same variable names), and I obviously missed some. Oddly, everything compiled fine on Ubuntu (the only platform we "officially" support) and on MacOS (and even on FreeBSD!), but apparently Red Hat is different.

Also available in: Atom PDF