sqlcipheron MacOS HighSierra build error - macos

I build sqlcipher from github repository on MacOS :
9429:sqlcipher administrator$ ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_ENABLE_UNLOCK_NOTIFY"
checking build system type... i386-apple-darwin17.4.0
...
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing libtool commands
9429:sqlcipher administrator$ make
./libtool --mode=link gcc -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_OS_UNIX=1 -I. -I/Users/administrator/pjx/sqlcipher/src -I/Users/administrator/pjx/sqlcipher/ext/rtree -I/Users/administrator/pjx/sqlcipher/ext/icu -I/Users/administrator/pjx/sqlcipher/ext/fts3 -I/Users/administrator/pjx/sqlcipher/ext/async -I/Users/administrator/pjx/sqlcipher/ext/session -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY -no-undefined -o libsqlcipher.la sqlite3.lo -lcrypto \
-rpath "/usr/local/lib" -version-info "8:6:8"
libtool: link: gcc -dynamiclib -o .libs/libsqlcipher.0.dylib .libs/sqlite3.o -lcrypto -install_name /usr/local/lib/libsqlcipher.0.dylib -compatibility_version 9 -current_version 9.6 -Wl,-single_module
Undefined symbols for architecture x86_64:
"_HMAC_CTX_free", referenced from:
_sqlcipher_openssl_hmac in sqlite3.o
"_HMAC_CTX_new", referenced from:
_sqlcipher_openssl_hmac in sqlite3.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: *** [libsqlcipher.la] Error 1
What's my mistake?
What is "_HMAC_CTX_free" error ?

I had the same problem. The solution is to compile with OpenSSL statically.
You need to give the static library in the ./configure command!
./configure --enable-tempstore=yes \
CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_ENABLE_UNLOCK_NOTIFY"\
LDFLAGS="/usr/local/lib/libcrypto.a"
make
Don't forget to link the right library libcrypto.a

Related

math library and POSIX realtime extensions for Mac

Although more a novice I try to explain my problem.
I am on a Mac and use command line to build the executable. The compiling command works successfully on Ubuntu.
cc program.o file1.o file2.o file3.o file4.o -lm -lrt -o program
ld: library not found for -lrt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [program] Error 1
If I run with -v command I get the following:
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.11.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -o program program.o file1.o file2.o file3.o file4.o -lm -lrt -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/lib/darwin/libclang_rt.osx.a
ld: library not found for -lrt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any hint?
I found in this post what -lm -lrt mean but still could not figure out a solution.
Update 1: According to this link -lrt is not available for Mac.
Update 2: I have found two possible solutions: (a) either to remove completely the flag or (b) use the -lSystem.B instead. The real-time extensions seems to be in libSystem.B.dylib as explained here.

Undefined symbols for architecture x86_64 on Mac OS

I am trying to install stunnel software on Mac OS 10.10 and I am getting the following error
Undefined symbols for architecture x86_64
while executing make command from terminal.
below are the detailed logs:
Making all in src
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
/bin/sh ../libtool --tag=CC --mode=link gcc -g -O2 -D_THREAD_SAFE -pthread -Wall -Wextra -Wpedantic -Wformat=2 -Wconversion -Wno-long-long -Wno-deprecated-declarations -fstack-protector -fPIE - D_FORTIFY_SOURCE=2 -L/usr/local/openssl/lib64 -L/usr/local/openssl/lib -lssl -lcrypto -fPIE -pie -o stunnel stunnel-tls.o stunnel-str.o stunnel-file.o stunnel-client.o stunnel-log.o stunnel-options.o stunnel-protocol.o stunnel-network.o stunnel-resolver.o stunnel-ssl.o stunnel-ctx.o stunnel-verify.o stunnel-sthreads.o stunnel-fd.o stunnel-dhparam.o stunnel-cron.o stunnel-stunnel.o stunnel-pty.o stunnel-libwrap.o stunnel-ui_unix.o -lz
libtool: link: gcc -g -O2 -D_THREAD_SAFE -pthread -Wall -Wextra -Wpedantic -Wformat=2 -Wconversion - Wno-long-long -Wno-deprecated-declarations -fstack-protector -fPIE -D_FORTIFY_SOURCE=2 -fPIE -pie -o stunnel stunnel-tls.o stunnel-str.o stunnel-file.o stunnel-client.o stunnel-log.o stunnel-options.o stunnel-protocol.o stunnel-network.o stunnel-resolver.o stunnel-ssl.o stunnel-ctx.o stunnel-verify.o stunnel-sthreads.o stunnel-fd.o stunnel-dhparam.o stunnel-cron.o stunnel-stunnel.o stunnel-pty.o stunnel-libwrap.o stunnel-ui_unix.o -L/usr/local/openssl/lib64 -L/usr/local/openssl/lib -lssl -lcrypto -lz -pthread
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pie'
clang: warning: argument unused during compilation: '-pthread'
ld: warning: directory not found for option '-L/usr/local/openssl/lib64'
ld: warning: directory not found for option '-L/usr/local/openssl/lib'
Undefined symbols for architecture x86_64:
"_CRYPTO_THREADID_set_callback", referenced from:
_sthreads_init in stunnel-sthreads.o
"_CRYPTO_THREADID_set_numeric", referenced from:
_threadid_func in stunnel-sthreads.o
"_ERR_remove_thread_state", referenced from:
_client_run in stunnel-client.o
"_SSL_CTX_set_psk_client_callback", referenced from:
_context_init in stunnel-ctx.o
"_SSL_CTX_set_psk_server_callback", referenced from:
_context_init in stunnel-ctx.o
"_TLSv1_1_client_method", referenced from:
_parse_service_option in stunnel-options.o
"_TLSv1_1_server_method", referenced from:
_parse_service_option in stunnel-options.o
"_TLSv1_2_client_method", referenced from:
_parse_service_option in stunnel-options.o
"_TLSv1_2_server_method", referenced from:
_parse_service_option in stunnel-options.o
"_X509_STORE_get1_certs", referenced from:
_verify_callback in stunnel-verify.o
"_X509_check_email", referenced from:
_verify_callback in stunnel-verify.o
"_X509_check_host", referenced from:
_verify_callback in stunnel-verify.o
"_X509_check_ip_asc", referenced from:
_verify_callback in stunnel-verify.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[2]: *** [stunnel] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1
You need to pass arguments to link with pthread and pie
not -pthread but -lpthread and not -pie but -lpie
Also there are no libs in /usr/local/openssl/ try to install them with brew or macports or just download the binaries.
The hints are there, right in front of You:
clang: warning: argument unused during compilation: '-pthread'
...
ld: warning: directory not found for option '-L/usr/local/openssl/lib64'
This problem was coming since installable has dependency on OpenSSL and it was not able to find libraries related to OpenSSL.
There can be two possible reasons for this problem-
1. OpenSSL is not installed in the system. In this case , OpenSSL needs to be installed first before installing stunnel.
OpenSSL is not installed in standard path.

Building GCC-4.9.2 on OS X Yosemite

Ok, I'm having trouble building gcc-4.9.2 on Apple's new OS X Yosemite. I'm not sure if I need to be building a gnu-gcc compiler on OS X, as most other software has compiled fine, apart from tesseract-3.0.1 and some of my own wxWidgets applications. Are there certain programs/code features that clang can't compile?
My build steps are as follows:
cd build-gcc
../gcc-4.9.1/configure --program-prefix="gnu-" --prefix="/usr/local/gcc-4.9.1" --with-gmp="/usr/local" --with-mpfr="/usr/local" --with-mpc="/usr/local" CC=clang CXX=clang++
make
My build path and gcc source paths do not contain any whitespace, and I have installed GMP, MPFR and MPC in /usr/local.
My build outputs are:
clang++ -g -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -Wl,-no_pie -o cc1 c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o c/c-array-notation.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-cilkplus.o c-family/array-notation-common.o c-family/cilk.o c-family/c-ubsan.o i386-c.o darwin-c.o \
cc1-checksum.o libbackend.a main.o tree-browser.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ./../intl/libintl.a -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -lmpc -lmpfr -lgmp -L../zlib -lz
ld: warning: ld: warning: ld: warning: ignoring file libbackend.a, file was built for archive which is not the architecture being linked (x86_64): libbackend.aignoring file libcommon-target.a, file was built for archive which is not the architecture being linked (x86_64): libcommon-target.aignoring file ../libdecnumber/libdecnumber.a, file was built for archive which is not the architecture being linked (x86_64): ../libdecnumber/libdecnumber.a
ld: warning: ignoring file ../zlib/libz.a, file was built for archive which is not the architecture being linked (x86_64): ../zlib/libz.a
Undefined symbols for architecture x86_64:
... (Lots of symbols)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [cc1] Error 1
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2
Configure outputs the build type as: x86_64-apple-darwin14.0.0, so I don't understand why this is happening.
Thank You in advance for any help.
Turns out that I had a broken ranlib in /usr/local/bin - maybe GNU Binutils don't work on OS X? All I needed to do to fix the problem was to:
sudo mv /usr/local/bin/ranlib /usr/local/ranlib_old
and then make, and now I have a working GCC!

Linking argp library for gcc on OSX

I am having pretty much the same problem as in this question
Undefined symbols argp_parse and arpg_usage when installing rng-tools on OSX
but it's a different project. It seems the problem was solved by linking in argp, which I installed with homebrew. However, I can't link it properly. This is the error, where you can see how I've tried to link argp-standalone with -L.
gcc -std=gnu99 -pedantic -Wall -Wextra -Wmissing-prototypes -DRESDIR=\"/usr/local/share/tsim\"
-g -O2 -L/usr/local/opt/argp-standalone/lib -L/usr/X11R6/lib -lXaw -lXt -lXmu -lX11 -lXext
-o tsim tsim-AddToggleWidget.o tsim-DialogPopup.o tsim-file.o tsim-resources.o tsim-timer.o
tsim-tsim.o tsim-bitmap.o tsim-DrawingPalette.o tsim-Graph.o tsim-sound.o tsim-train.o
tsim-BitmapDirectory.o tsim-errcheck.o tsim-pipe.o tsim-Sprite.o tsim-tsim_argp.o
Undefined symbols for architecture x86_64:
"_argp_parse", referenced from:
_parse in tsim-tsim_argp.o
"_argp_usage", referenced from:
_parse_opt in tsim-tsim_argp.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[2]: *** [tsim] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Undefined symbols "_TLSv1_1_client_method" for x86_64 when compiling httpd on Mac os 10.8

The detail error message is below.
$ ./configure
$ make
then ...
/usr/share/apr-1/build-1/libtool --silent --mode=link /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc -lssl -lcrypto -lpthread \
-o ab ab.lo -L/usr/lib -R/usr/lib -laprutil-1 -lexpat -liconv -lsqlite3 -lldap -llber -llber -L/usr/lib -R/usr/lib -lapr-1 -lpthread
Undefined symbols for architecture x86_64:
"_TLSv1_1_client_method", referenced from:
_main in ab.o
"_TLSv1_2_client_method", referenced from:
_main in ab.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
APR and apr-util are required dependencies.
So - before building httpd on Mac,
port install APR
port install apr-util
Solved this.
Additionally, you might have to set the 'OPENSSL_ROOT_DIR' variable to '/opt/local'.
You can do that by giving '-DOPENSSL_ROOT_DIR=/opt/local' as command line argument when executing cmake.

Resources