Modifying a libtool project (Makefile) so a corrected linker command is invoked? - makefile

I'm trying to build GNU gettext from git under Cygwin on Windows; the build process broke, and I found a command that fixes it - but now I don't know how to "patch" it in, so the build process proceeds.
I have followed the official INSTALL.windows, option "1) Native binaries, built using the mingw tool chain."; some things have changed since that was written, so a working configure line for me these days was this - note I also want a static build:
./configure --enable-static --host=x86_64-w64-mingw32 --prefix=/usr/x86_64-w64-mingw32/sys-root/mingw \
CC=x86_64-w64-mingw32-gcc \
CXX=x86_64-w64-mingw32-g++ \
CPPFLAGS="-I/usr/x86_64-w64-mingw32/sys-root/mingw/include -Wall" \
LDFLAGS="-L/usr/x86_64-w64-mingw32/sys-root/mingw/lib"
Now, doing make eventually crashed here:
make[2]: Entering directory '/cygdrive/c/src/gettext_git/gettext-runtime/intl'
/bin/sh ./libtool --tag=CC --mode=link x86_64-w64-mingw32-gcc -fvisibility=hidden -g -O2 -Wl,--export-all-symbols -ladvapi32 -no-undefined -export-symbols-regex '^([^_]|_[^l]|_l[^i]|_li[^b]|_lib[^i]|_libi[^n]|_libin[^t]|_libint[^l]|_libintl[^_]).*' -version-info 11:0:3 -rpath /usr/x86_64-w64-mingw32/sys-root/mingw/lib -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib -o libintl.la bindtextdom.lo dcgettext.lo dgettext.lo gettext.lo finddomain.lo hash-string.lo loadmsgcat.lo localealias.lo textdomain.lo l10nflist.lo explodename.lo dcigettext.lo dcngettext.lo dngettext.lo ngettext.lo plural.lo plural-exp.lo langprefs.lo log.lo printf.lo setlocale.lo version.lo osdep.lo intl-compat.lo gnulib-lib/libgnu.la libintl.res.lo
libtool: link: rm -fr .libs/libintl.dll.a .libs/libintl.exp
libtool: link: /usr/bin/x86_64-w64-mingw32-nm -B .libs/bindtextdom.o .libs/dcgettext.o .libs/dgettext.o .libs/gettext.o .libs/finddomain.o .libs/hash-string.o .libs/loadmsgcat.o .libs/localealias.o .libs/textdomain.o .libs/l10nflist.o .libs/explodename.o .libs/dcigettext.o .libs/dcngettext.o .libs/dngettext.o .libs/ngettext.o .libs/plural.o .libs/plural-exp.o .libs/langprefs.o .libs/log.o .libs/printf.o .libs/setlocale.o .libs/version.o .libs/osdep.o .libs/intl-compat.o .libs/libintl.res.o gnulib-lib/.libs/libgnu.a | /usr/bin/sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' | /usr/bin/sed '/ __gnu_lto/d' | /usr/bin/sed -e '/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //' | sort | uniq > .libs/libintl.exp
libtool: link: /usr/bin/grep -E -e "^([^_]|_[^l]|_l[^i]|_li[^b]|_lib[^i]|_libi[^n]|_libin[^t]|_libint[^l]|_libintl[^_]).*" ".libs/libintl.exp" > ".libs/libintl.expT"
libtool: link: mv -f ".libs/libintl.expT" ".libs/libintl.exp"
libtool: link: if test DEF = "`/usr/bin/sed -n -e 's/^[ ]*//' -e '/^\(;.*\)*$/d' -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' -e q .libs/libintl.exp`" ; then cp .libs/libintl.exp .libs/libintl-8.dll.def; else echo EXPORTS > .libs/libintl-8.dll.def; cat .libs/libintl.exp >> .libs/libintl-8.dll.def; fi
libtool: link: x86_64-w64-mingw32-gcc -shared .libs/libintl-8.dll.def .libs/bindtextdom.o .libs/dcgettext.o .libs/dgettext.o .libs/gettext.o .libs/finddomain.o .libs/hash-string.o .libs/loadmsgcat.o .libs/localealias.o .libs/textdomain.o .libs/l10nflist.o .libs/explodename.o .libs/dcigettext.o .libs/dcngettext.o .libs/dngettext.o .libs/ngettext.o .libs/plural.o .libs/plural-exp.o .libs/langprefs.o .libs/log.o .libs/printf.o .libs/setlocale.o .libs/version.o .libs/osdep.o .libs/intl-compat.o .libs/libintl.res.o -Wl,--whole-archive gnulib-lib/.libs/libgnu.a -Wl,--no-whole-archive -ladvapi32 -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib -g -O2 -Wl,--export-all-symbols -o .libs/libintl-8.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libintl.dll.a
/usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld: .libs/localealias.o: in function `read_alias_file':
/cygdrive/c/src/gettext_git/gettext-runtime/intl/./localealias.c:241: undefined reference to `_libintl_relocate2'
/usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld: .libs/printf.o: in function `libintl_vfprintf':
/cygdrive/c/src/gettext_git/gettext-runtime/intl/./printf.c:125: undefined reference to `_libintl_vasnprintf'
/usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld: .libs/printf.o: in function `libintl_vsprintf':
/cygdrive/c/src/gettext_git/gettext-runtime/intl/./printf.c:187: undefined reference to `_libintl_vasnprintf'
/usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld: /cygdrive/c/src/gettext_git/gettext-runtime/intl/./printf.c:187: undefined reference to `_libintl_vasnprintf'
/usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld: .libs/printf.o: in function `libintl_vsnprintf':
/cygdrive/c/src/gettext_git/gettext-runtime/intl/./printf.c:242: undefined reference to `_libintl_vasnprintf'
/usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld: .libs/printf.o: in function `libintl_vasprintf':
/cygdrive/c/src/gettext_git/gettext-runtime/intl/./printf.c:288: undefined reference to `_libintl_vasnprintf'
/usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld: .libs/printf.o:/cygdrive/c/src/gettext_git/gettext-runtime/intl/./printf.c:288: more undefined references to `_libintl_vasnprintf' follow
/usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld: .libs/printf.o: in function `_libintl_vasnwprintf':
/cygdrive/c/src/gettext_git/gettext-runtime/intl/gnulib-lib/vasnprintf.c:1873: undefined reference to `_libintl_printf_fetchargs'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:1591: libintl.la] Error 1
make[2]: Leaving directory '/cygdrive/c/src/gettext_git/gettext-runtime/intl'
Unfortunately, I really do not know how to work with libtool, as a I really have a hard time understanding it; but I could identify this is the "compile" line that fails:
x86_64-w64-mingw32-gcc -shared .libs/libintl-8.dll.def .libs/bindtextdom.o .libs/dcgettext.o .libs/dgettext.o .libs/gettext.o .libs/finddomain.o .libs/hash-string.o .libs/loadmsgcat.o .libs/localealias.o .libs/textdomain.o .libs/l10nflist.o .libs/explodename.o .libs/dcigettext.o .libs/dcngettext.o .libs/dngettext.o .libs/ngettext.o .libs/plural.o .libs/plural-exp.o .libs/langprefs.o .libs/log.o .libs/printf.o .libs/setlocale.o .libs/version.o .libs/osdep.o .libs/intl-compat.o .libs/libintl.res.o -Wl,--whole-archive gnulib-lib/.libs/libgnu.a -Wl,--no-whole-archive -ladvapi32 -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib -g -O2 -Wl,--export-all-symbols -o .libs/libintl-8.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libintl.dll.a
So, with grep-ing, trial, and error, I eventually found that there are missing .o files - gnulib-lib/relocatable.o, gnulib-lib/vasnprintf.o, gnulib-lib/printf-args.o, gnulib-lib/printf-parse.o (relative to the 'gettext-runtime/intl' directory) - which, if added, make the above compile line succeed. That modified line is below and it works/builds fine, without errors, when ran standalone in terminal:
x86_64-w64-mingw32-gcc -shared .libs/libintl-8.dll.def .libs/bindtextdom.o .libs/dcgettext.o .libs/dgettext.o .libs/gettext.o .libs/finddomain.o .libs/hash-string.o .libs/loadmsgcat.o .libs/localealias.o .libs/textdomain.o .libs/l10nflist.o .libs/explodename.o .libs/dcigettext.o .libs/dcngettext.o .libs/dngettext.o .libs/ngettext.o .libs/plural.o .libs/plural-exp.o .libs/langprefs.o .libs/log.o .libs/printf.o .libs/setlocale.o .libs/version.o .libs/osdep.o .libs/intl-compat.o .libs/libintl.res.o gnulib-lib/relocatable.o gnulib-lib/vasnprintf.o gnulib-lib/printf-args.o gnulib-lib/printf-parse.o -Wl,--whole-archive gnulib-lib/.libs/libgnu.a -Wl,--no-whole-archive -ladvapi32 -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib -g -O2 -Wl,--export-all-symbols -o .libs/libintl-8.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libintl.dll.a
Well, that's nice; and in most projects, if I come to a point like this where build breaks, and then I find a passing invocation that I run from the terminal which builds the offending file - usually I can just type make again, and build process continues.
Not here - once the build process (make) enters the 'gettext-runtime/intl', it deletes everything and starts rebuilding from scratch. Damn it.
Well, that means I must at least modify the Makefile somehow; I could not find what in the Makefile corresponds to the x86_64-w64-mingw32-gcc -shared ... line, but I think it is triggered by the first line once make enters the directory - which is /bin/sh ./libtool --tag=CC --mode=link ..., and I think that one is triggered by this entry in the Makefile:
libintl.la: $(libintl_la_OBJECTS) $(libintl_la_DEPENDENCIES) $(EXTRA_libintl_la_DEPENDENCIES)
$(AM_V_CCLD)$(libintl_la_LINK) $(am_libintl_la_rpath) $(libintl_la_OBJECTS) $(libintl_la_LIBADD) $(LIBS)
First, I tried entering the gnulib-lib/relocatable.o objects here:
libintl.la: $(libintl_la_OBJECTS) $(libintl_la_DEPENDENCIES) $(EXTRA_libintl_la_DEPENDENCIES)
$(AM_V_CCLD)$(libintl_la_LINK) $(am_libintl_la_rpath) $(libintl_la_OBJECTS) gnulib-lib/relocatable.o gnulib-lib/vasnprintf.o gnulib-lib/printf-args.o gnulib-lib/printf-parse.o $(libintl_la_LIBADD) $(LIBS)
This fails with:
libtool: error: cannot build libtool library 'libintl.la' from non-libtool objects on this host: gnulib-lib/relocatable.o gnulib-lib/vasnprintf.o gnulib-lib/printf-args.o gnulib-lib/printf-parse.o
Well, f*** you, damnit.
Turns out, there are also .lo versions of these object, so I tried:
libintl.la: $(libintl_la_OBJECTS) $(libintl_la_DEPENDENCIES) $(EXTRA_libintl_la_DEPENDENCIES)
$(AM_V_CCLD)$(libintl_la_LINK) $(am_libintl_la_rpath) $(libintl_la_OBJECTS) gnulib-lib/relocatable.lo gnulib-lib/vasnprintf.lo gnulib-lib/printf-args.lo gnulib-lib/printf-parse.lo $(libintl_la_LIBADD) $(LIBS)
Now, this sort of posses - but then, the extra objects .lo objects are completely ignored, and I get the exact same linking error at the start of this post:
...
/bin/sh ./libtool --tag=CC --mode=link x86_64-w64-mingw32-gcc -fvisibility=hidden -g -O2 -Wl,--export-all-symbols -ladvapi32 -no-undefined -export-symbols-regex '^([^_]|_[^l]|_l[^i]|_li[^b]|_lib[^i]|_libi[^n]|_libin[^t]|_libint[^l]|_libintl[^_]).*' -version-info 11:0:3 -rpath /usr/x86_64-w64-mingw32/sys-root/mingw/lib -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib -o libintl.la bindtextdom.lo dcgettext.lo dgettext.lo gettext.lo finddomain.lo hash-string.lo loadmsgcat.lo localealias.lo textdomain.lo l10nflist.lo explodename.lo dcigettext.lo dcngettext.lo dngettext.lo ngettext.lo plural.lo plural-exp.lo langprefs.lo log.lo printf.lo setlocale.lo version.lo osdep.lo intl-compat.lo gnulib-lib/relocatable.lo gnulib-lib/vasnprintf.lo gnulib-lib/printf-args.lo gnulib-lib/printf-parse.lo gnulib-lib/libgnu.la libintl.res.lo
libtool: link: rm -fr .libs/libintl.dll.a .libs/libintl.exp
libtool: link: /usr/bin/x86_64-w64-mingw32-nm -B .libs/bindtextdom.o .libs/dcgettext.o .libs/dgettext.o .libs/gettext.o .libs/finddomain.o .libs/hash-string.o .libs/loadmsgcat.o .libs/localealias.o .libs/textdomain.o .libs/l10nflist.o .libs/explodename.o .libs/dcigettext.o .libs/dcngettext.o .libs/dngettext.o .libs/ngettext.o .libs/plural.o .libs/plural-exp.o .libs/langprefs.o .libs/log.o .libs/printf.o .libs/setlocale.o .libs/version.o .libs/osdep.o .libs/intl-compat.o .libs/libintl.res.o gnulib-lib/.libs/libgnu.a | /usr/bin/sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' | /usr/bin/sed '/ __gnu_lto/d' | /usr/bin/sed -e '/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //' | sort | uniq > .libs/libintl.exp
libtool: link: /usr/bin/grep -E -e "^([^_]|_[^l]|_l[^i]|_li[^b]|_lib[^i]|_libi[^n]|_libin[^t]|_libint[^l]|_libintl[^_]).*" ".libs/libintl.exp" > ".libs/libintl.expT"
libtool: link: mv -f ".libs/libintl.expT" ".libs/libintl.exp"
libtool: link: if test DEF = "`/usr/bin/sed -n -e 's/^[ ]*//' -e '/^\(;.*\)*$/d' -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' -e q .libs/libintl.exp`" ; then cp .libs/libintl.exp .libs/libintl-8.dll.def; else echo EXPORTS > .libs/libintl-8.dll.def; cat .libs/libintl.exp >> .libs/libintl-8.dll.def; fi
libtool: link: x86_64-w64-mingw32-gcc -shared .libs/libintl-8.dll.def .libs/bindtextdom.o .libs/dcgettext.o .libs/dgettext.o .libs/gettext.o .libs/finddomain.o .libs/hash-string.o .libs/loadmsgcat.o .libs/localealias.o .libs/textdomain.o .libs/l10nflist.o .libs/explodename.o .libs/dcigettext.o .libs/dcngettext.o .libs/dngettext.o .libs/ngettext.o .libs/plural.o .libs/plural-exp.o .libs/langprefs.o .libs/log.o .libs/printf.o .libs/setlocale.o .libs/version.o .libs/osdep.o .libs/intl-compat.o .libs/libintl.res.o -Wl,--whole-archive gnulib-lib/.libs/libgnu.a -Wl,--no-whole-archive -ladvapi32 -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib -g -O2 -Wl,--export-all-symbols -o .libs/libintl-8.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libintl.dll.a
/usr/lib/gcc/x86_64-w64-mingw32/11/../../../../x86_64-w64-mingw32/bin/ld: .libs/localealias.o: in function `read_alias_file':
/cygdrive/c/src/gettext_git/gettext-runtime/intl/./localealias.c:241: undefined reference to `_libintl_relocate2'
...
AAAAAAAAAAAAAAAAAARRRHRHRHRHRHHHRHGG!!!!!!1!
So -- how can I hack in my changes in this project, so that build succeeds at least at this failing step? (for reference, here is the Makefile I've got generated in this directory)

Related

Use a variable that contains a list of arguments in bash

I'm trying to write a script that rebuild current installed version of nginx on my Ubuntu 18.04.
I don't understand why it fails when I add the configure command options :
#!/bin/bash
NGINX_VERSION=$(nginx -v 2>&1 | grep -o '[0-9.]*')
NGINX_BUILD_ARGS=$(nginx -V 2>&1 | grep -Po '(?<=configure arguments: )--.*$')
echo ${NGINX_BUILD_ARGS[#]}
# output:
# --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-FIJPpj/nginx-1.14.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module
wget https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz
tar -xvzf nginx-${NGINX_VERSION}.tar.gz
rm nginx-${NGINX_VERSION}.tar.gz
cd nginx-${NGINX_VERSION}
./configure ${NGINX_BUILD_ARGS}
# it fails with "invalid option -O2"
If I try to launch the command by myself in the folder :
./configure --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-FIJPpj/nginx-1.14.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module
I got a success...
Is there a way to use ${NGINX_BUILD_ARGS} as a list of arguments ?
Thanks !
EDIT
Tried with quotes :
./configure "${NGINX_BUILD_ARGS}"
But arguments seems to be bad parsed...
EDIT 2
It works with an eval :
eval "./configure ${NGINX_BUILD_ARGS}"
Isn't it unsafe ? No way to create an array from build args variable ?

Can't install VisualSFM macOS High Sierra because it requires cairo-x11 which is no longer supported

I am trying to install VisualSFM on my MacBook Pro mid-2015 running High Sierra for a photogrammetry project I am currently working on with a professor. To do the install I am using Dan Monaghan's installer along with this video to do the install;however, when I run the installer, I get this error:
==> make install
Last 15 lines from /Users/Steven/Library/Logs/Homebrew/gtk+/02.make:
libtool: compile: clang -DHAVE_CONFIG_H -I. -I../.. - DG_LOG_DOMAIN=\"Gdk\" -DGDK_COMPILATION -I../.. -I../../gdk -I../../gdk -DG_DISABLE_CAST_CHECKS -DDISABLE_VISIBILITY -D_REENTRANT -I/usr/local/Cellar/pcre/8.42/include -I/usr/local/Cellar/glib/2.56.1/include/gio-unix-2.0/ -I/usr/local/Cellar/glib/2.56.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.56.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/libpng/1.6.34/include/libpng16 -I/usr/local/Cellar/gdk-pixbuf/2.36.12/include/gdk-pixbuf-2.0 -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/fontconfig/2.13.0/include -I/usr/local/Cellar/pixman/0.34.0_1/include/pixman-1 -I/usr/local/Cellar/cairo/1.14.12/include/cairo -I/usr/local/Cellar/fribidi/1.0.4/include/fribidi -I/usr/local/Cellar/graphite2/1.3.11/include -I/usr/local/Cellar/harfbuzz/1.8.0/include/harfbuzz -I/usr/local/Cellar/pango/1.42.1/include/pango-1.0 -I/opt/X11/include -I/opt/X11/include/cairo -I/opt/X11/include -DG_DISABLE_SINGLE_INCLUDES -DATK_DISABLE_SINGLE_INCLUDES -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES -I/opt/X11/include -g -O2 -Wall -c gdkcursor-x11.c -fno-common -DPIC -o .libs/gdkcursor-x11.o
libtool: compile: clang -DHAVE_CONFIG_H -I. -I../.. -DG_LOG_DOMAIN=\"Gdk\" -DGDK_COMPILATION -I../.. -I../../gdk -I../../gdk -DG_DISABLE_CAST_CHECKS -DDISABLE_VISIBILITY -D_REENTRANT -I/usr/local/Cellar/pcre/8.42/include -I/usr/local/Cellar/glib/2.56.1/include/gio-unix-2.0/ -I/usr/local/Cellar/glib/2.56.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.56.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/libpng/1.6.34/include/libpng16 -I/usr/local/Cellar/gdk-pixbuf/2.36.12/include/gdk-pixbuf-2.0 -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/fontconfig/2.13.0/include -I/usr/local/Cellar/pixman/0.34.0_1/include/pixman-1 -I/usr/local/Cellar/cairo/1.14.12/include/cairo -I/usr/local/Cellar/fribidi/1.0.4/include/fribidi -I/usr/local/Cellar/graphite2/1.3.11/include -I/usr/local/Cellar/harfbuzz/1.8.0/include/harfbuzz -I/usr/local/Cellar/pango/1.42.1/include/pango-1.0 -I/opt/X11/include -I/opt/X11/include/cairo -I/opt/X11/include -DG_DISABLE_SINGLE_INCLUDES -DATK_DISABLE_SINGLE_INCLUDES -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES -I/opt/X11/include -g -O2 -Wall -c gdkapplaunchcontext-x11.c -fno-common -DPIC -o .libs/gdkapplaunchcontext-x11.o
libtool: compile: clang -DHAVE_CONFIG_H -I. -I../.. -DG_LOG_DOMAIN=\"Gdk\" -DGDK_COMPILATION -I../.. -I../../gdk -I../../gdk -DG_DISABLE_CAST_CHECKS -DDISABLE_VISIBILITY -D_REENTRANT -I/usr/local/Cellar/pcre/8.42/include -I/usr/local/Cellar/glib/2.56.1/include/gio-unix-2.0/ -I/usr/local/Cellar/glib/2.56.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.56.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/libpng/1.6.34/include/libpng16 -I/usr/local/Cellar/gdk-pixbuf/2.36.12/include/gdk-pixbuf-2.0 -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/fontconfig/2.13.0/include -I/usr/local/Cellar/pixman/0.34.0_1/include/pixman-1 -I/usr/local/Cellar/cairo/1.14.12/include/cairo -I/usr/local/Cellar/fribidi/1.0.4/include/fribidi -I/usr/local/Cellar/graphite2/1.3.11/include -I/usr/local/Cellar/harfbuzz/1.8.0/include/harfbuzz -I/usr/local/Cellar/pango/1.42.1/include/pango-1.0 -I/opt/X11/include -I/opt/X11/include/cairo -I/opt/X11/include -DG_DISABLE_SINGLE_INCLUDES -DATK_DISABLE_SINGLE_INCLUDES -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES -I/opt/X11/include -g -O2 -Wall -c gdkdisplay-x11.c -fno-common -DPIC -o .libs/gdkdisplay-x11.o
libtool: compile: clang -DHAVE_CONFIG_H -I. -I../.. -DG_LOG_DOMAIN=\"Gdk\" -DGDK_COMPILATION -I../.. -I../../gdk -I../../gdk -DG_DISABLE_CAST_CHECKS -DDISABLE_VISIBILITY -D_REENTRANT -I/usr/local/Cellar/pcre/8.42/include -I/usr/local/Cellar/glib/2.56.1/include/gio-unix-2.0/ -I/usr/local/Cellar/glib/2.56.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.56.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/libpng/1.6.34/include/libpng16 -I/usr/local/Cellar/gdk-pixbuf/2.36.12/include/gdk-pixbuf-2.0 -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/fontconfig/2.13.0/include -I/usr/local/Cellar/pixman/0.34.0_1/include/pixman-1 -I/usr/local/Cellar/cairo/1.14.12/include/cairo -I/usr/local/Cellar/fribidi/1.0.4/include/fribidi -I/usr/local/Cellar/graphite2/1.3.11/include -I/usr/local/Cellar/harfbuzz/1.8.0/include/harfbuzz -I/usr/local/Cellar/pango/1.42.1/include/pango-1.0 -I/opt/X11/include -I/opt/X11/include/cairo -I/opt/X11/include -DG_DISABLE_SINGLE_INCLUDES -DATK_DISABLE_SINGLE_INCLUDES -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES -I/opt/X11/include -g -O2 -Wall -c gdkdrawable-x11.c -fno-common -DPIC -o .libs/gdkdrawable-x11.o
libtool: compile: clang -DHAVE_CONFIG_H -I. -I../.. -DG_LOG_DOMAIN=\"Gdk\" -DGDK_COMPILATION -I../.. -I../../gdk -I../../gdk -DG_DISABLE_CAST_CHECKS -DDISABLE_VISIBILITY -D_REENTRANT -I/usr/local/Cellar/pcre/8.42/include -I/usr/local/Cellar/glib/2.56.1/include/gio-unix-2.0/ -I/usr/local/Cellar/glib/2.56.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.56.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/libpng/1.6.34/include/libpng16 -I/usr/local/Cellar/gdk-pixbuf/2.36.12/include/gdk-pixbuf-2.0 -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/fontconfig/2.13.0/include -I/usr/local/Cellar/pixman/0.34.0_1/include/pixman-1 -I/usr/local/Cellar/cairo/1.14.12/include/cairo -I/usr/local/Cellar/fribidi/1.0.4/include/fribidi -I/usr/local/Cellar/graphite2/1.3.11/include -I/usr/local/Cellar/harfbuzz/1.8.0/include/harfbuzz -I/usr/local/Cellar/pango/1.42.1/include/pango-1.0 -I/opt/X11/include -I/opt/X11/include/cairo -I/opt/X11/include -DG_DISABLE_SINGLE_INCLUDES -DATK_DISABLE_SINGLE_INCLUDES -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES -I/opt/X11/include -g -O2 -Wall -c gdkdnd-x11.c -fno-common -DPIC -o .libs/gdkdnd-x11.o
libtool: compile: clang -DHAVE_CONFIG_H -I. -I../.. -DG_LOG_DOMAIN=\"Gdk\" -DGDK_COMPILATION -I../.. -I../../gdk -I../../gdk -DG_DISABLE_CAST_CHECKS -DDISABLE_VISIBILITY -D_REENTRANT -I/usr/local/Cellar/pcre/8.42/include -I/usr/local/Cellar/glib/2.56.1/include/gio-unix-2.0/ -I/usr/local/Cellar/glib/2.56.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.56.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/libpng/1.6.34/include/libpng16 -I/usr/local/Cellar/gdk-pixbuf/2.36.12/include/gdk-pixbuf-2.0 -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/fontconfig/2.13.0/include -I/usr/local/Cellar/pixman/0.34.0_1/include/pixman-1 -I/usr/local/Cellar/cairo/1.14.12/include/cairo -I/usr/local/Cellar/fribidi/1.0.4/include/fribidi -I/usr/local/Cellar/graphite2/1.3.11/include -I/usr/local/Cellar/harfbuzz/1.8.0/include/harfbuzz -I/usr/local/Cellar/pango/1.42.1/include/pango-1.0 -I/opt/X11/include -I/opt/X11/include/cairo -I/opt/X11/include -DG_DISABLE_SINGLE_INCLUDES -DATK_DISABLE_SINGLE_INCLUDES -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES -I/opt/X11/include -g -O2 -Wall -c gdkevents-x11.c -fno-common -DPIC -o .libs/gdkevents-x11.o
gdkdrawable-x11.c:32:10: fatal error: 'cairo-xlib.h' file not found
#include <cairo-xlib.h>
^~~~~~~~~~~~~~
1 error generated.
make[3]: *** [gdkdrawable-x11.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [install-recursive] Error 1
make[1]: *** [install] Error 2
make: *** [install-recursive] Error 1
Do not report this issue to Homebrew/brew or Homebrew/core!
...
cd build; ar -x ../lib/VisualSFM.a; cd ..;
Package gtk+-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-2.0' found
g++-4.9 -w -o bin/VisualSFM build/*.* -L/usr/local/lib -L/opt/X11/lib -pthread -lGL -lGLU -lX11 -ldl lib/lapack.a lib/blas.a lib/libf2c.a lib/libjpeg.a
Undefined symbols for architecture x86_64:
"_g_cclosure_new", referenced from:
RegisterWin::GetOpenFilePreview(char const*, char const*, int, int) in RegisterGUI.o
"_g_free", referenced from:
RegisterWin::__FileChooserPreview(_GtkFileChooser*, void*) in RegisterGUI.o
RegisterWin::__ComboBoxChanged(_GtkComboBox*, void*) in RegisterGUI.o
...
"_gtk_window_set_type_hint", referenced from:
GlobalTasks::InitLogWindow(char const*, int) in GlobalTasks.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [VisualSFM] Error 1
VSFM application failed to build, halting.
The problem seems to be do to the fact that it requires cairo with x11;however Apple no longer supports cairo with x11 because of XQuartz. I tried brew install --with-x11 cairo but got Warning: cairo: this formula has no --with-x11 option so it will be ignored! I am not sure if it would solve my problem with installing VisualSFM, but is there anyway to install an old version of Cairo with X11?

Unable to insert kernel module: Unknown symbol net_namespace_list

I'm writing a kernel module that lists the network namespaces using the for_each_net and have written the following snippet which compiles fine:
rtnl_lock();
for_each_net(net)
printk("network ns: %p\n", net);
rtnl_unlock();
However when I try to insert the kernel module i get the following error:
insmod: ERROR: could not insert module kerNotification.ko: Unknown symbol in module
The dmesg gives the additional error information:
[3561461.418499] kerNotification: Unknown symbol net_namespace_list (err 0)
The kallsyms shows that it has the symbol of this kernel function:
[josh#dev kernel_prog(keystone_admin)]# cat /proc/kallsyms | grep net_namespace_list
ffffffff81a203e0 R __ksymtab_net_namespace_list
ffffffff81a32bc0 r __kcrctab_net_namespace_list
ffffffff81a55452 r __kstrtab_net_namespace_list
ffffffff81b6b000 D net_namespace_lis
The Module.symvers is included in the makefile as KBUILD_EXTRA_SYMBOLS. Here is the Makefile:
obj-m += kerNotification.o
SYMBOLA=/usr/src/kernels/4.4.57-1.el7.elrepo.x86_64/Module.symvers
KBUILD_EXTRA_SYMBOLS= $(SYMBOLA)
all:
make -C /lib/modules/$(shell uname -r)/build $(KBUILD_EXTRA_SYMBOLS) M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
Here is the complete logs when the make file is built with V=1:
make -C /lib/modules/4.4.57-1.el7.elrepo.x86_64/build /usr/src/kernels/4.4.57-1.el7.elrepo.x86_64/Module.symvers M=/home/cmmdocker/kernel_prog modules
make[1]: Entering directory `/usr/src/kernels/4.4.57-1.el7.elrepo.x86_64'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo >&2; \
echo >&2 " ERROR: Kernel configuration is invalid."; \
echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo >&2 ; \
/bin/false)
make[1]: Nothing to be done for `/usr/src/kernels/4.4.57-1.el7.elrepo.x86_64/Module.symvers'.
mkdir -p /home/cmmdocker/kernel_prog/.tmp_versions ; rm -f /home/cmmdocker/kernel_prog/.tmp_versions/*
make -f ./scripts/Makefile.build obj=/home/cmmdocker/kernel_prog
rm -f /home/cmmdocker/kernel_prog/built-in.o; ar rcsD /home/cmmdocker/kernel_prog/built-in.o
gcc -Wp,-MD,/home/cmmdocker/kernel_prog/.kerNotification.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include -I./arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-PIE -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-maybe-uninitialized -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -g -pg -mfentry -DCC_USING_FENTRY -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -DCC_HAVE_ASM_GOTO -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(kerNotification)" -D"KBUILD_MODNAME=KBUILD_STR(kerNotification)" -c -o /home/cmmdocker/kernel_prog/.tmp_kerNotification.o /home/cmmdocker/kernel_prog/kerNotification.c
/home/cmmdocker/kernel_prog/kerNotification.c: In function ‘kerNotification_init’:
/home/cmmdocker/kernel_prog/kerNotification.c:37:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
struct net *net;
^
if [ "-pg" = "-pg" ]; then if [ /home/cmmdocker/kernel_prog/kerNotification.o != "scripts/mod/empty.o" ]; then ./scripts/recordmcount "/home/cmmdocker/kernel_prog/kerNotification.o"; fi; fi;
(cat /dev/null; echo kernel//home/cmmdocker/kernel_prog/kerNotification.ko;) > /home/cmmdocker/kernel_prog/modules.order
make -f ./scripts/Makefile.modpost
find /home/cmmdocker/kernel_prog/.tmp_versions -name '*.mod' | xargs -r grep -h '\.ko$' | sort -u | sed 's/\.ko$/.o/' | scripts/mod/modpost -m -a -i ./Module.symvers -I /home/cmmdocker/kernel_prog/Module.symvers -e /usr/src/kernels/4.4.57-1.el7.elrepo.x86_64/Module.symvers -o /home/cmmdocker/kernel_prog/Module.symvers -w -s -T -
gcc -Wp,-MD,/home/cmmdocker/kernel_prog/.kerNotification.mod.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include -I./arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-PIE -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-maybe-uninitialized -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -g -pg -mfentry -DCC_USING_FENTRY -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -DCC_HAVE_ASM_GOTO -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(kerNotification.mod)" -D"KBUILD_MODNAME=KBUILD_STR(kerNotification)" -DMODULE -c -o /home/cmmdocker/kernel_prog/kerNotification.mod.o /home/cmmdocker/kernel_prog/kerNotification.mod.c
ld -r -m elf_x86_64 -T ./scripts/module-common.lds --build-id -o /home/cmmdocker/kernel_prog/kerNotification.ko /home/cmmdocker/kernel_prog/kerNotification.o /home/cmmdocker/kernel_prog/kerNotification.mod.o
make[1]: Leaving directory `/usr/src/kernels/4.4.57-1.el7.elrepo.x86_64'
Any idea how to fix this?
Issue was missing license. Below was added to get the expected result:
MODULE_LICENSE("GPL");
Referred the following answer from another query on stackoverflow for this: unknown-symbol-class-create-err-0
insmod: ERROR: could not insert module kerNotification.ko: Unknown
symbol in module
You get the above error because the net_namespace_list is missing in the kernel. So you need to make sure to insert the module which it is defined. looking at the source code its declared in net_namespace.c and looking at the Makefile it will when CONFIG_NET is enabled. Also when you have built your kernel image the System.map file should tell you if its declared in the kernel image which you have built, something like below:
cat System.map | grep net_namespace_list
8041a888 r __ksymtab_net_namespace_list
8042b80c r __kstrtab_net_namespace_list
80464c08 D net_namespace_list

/usr/bin/ld: cannot find -lmkl_rt When compiling makefile

here is the make file
# EXTRALIBS = -L/opt/SUNWspro/lib -lF77 -lM77 -lsunmath -lfsu
# LAPACK = -L/home/bramley/lib -llapack95
# BLAS = -L/home/bramley/lib -lblas95
# F95= /usr/local/intel/compiler60/ia32/bin/ifc
# OPTS= -O -w
# LIBS = $(LAPACK) $(BLAS)
include make.inc
runLU: luDriver.o LU8.o LU4.o rowswp.o elapsedtime.o kinds.mod \
utilities.o swaps.o checkLU.o WriteParameters.o writeB.o Writeipiv.o
$(F95) $(INCS) -o runLU $(OPTS) luDriver.o LU8.o LU4.o kinds.o \
utilities.o swaps.o elapsedtime.o WriteParameters.o checkLU.o \
rowswp.o writeB.o Writeipiv.o $(LIBS)
luDriver.o: luDriver.f90 kinds.mod
$(F95) $(OPTS) -c luDriver.f90
LU4.o: LU4.c
$(CC) $(INCS) $(OPTS) -c LU4.c
LU8.o: LU8.c
$(CC) $(INCS) $(OPTS) -c LU8.c
rowswp.o: rowswp.f90 kinds.mod
$(F95) $(OPTS) -c rowswp.f90
WriteParameters.o: WriteParameters.f90
$(F95) $(OPTS) -c WriteParameters.f90
kinds.mod: kinds.f90
$(F95) $(OPTS) -c kinds.f90
elapsedtime.o: elapsedtime.f90
$(F95) $(OPTS) -c elapsedtime.f90
checkLU.o: checkLU.f90 kinds.mod
$(F95) $(OPTS) -c checkLU.f90
swaps.o: swaps.f90 kinds.mod
$(F95) $(OPTS) -c swaps.f90
utilities.o: utilities.f90 kinds.mod
$(F95) $(OPTS) -c utilities.f90
writeB.o: writeB.f90
$(F95) $(OPTS) -c writeB.f90
Writeipiv.o: Writeipiv.f90
$(F95) $(OPTS) -c Writeipiv.f90
clean:
/bin/rm -f *.o *.mod runLU log B ipiv
kleen:
/bin/rm -f *.o *.mod runLU log results B ipiv
and here is make.inc
# F90 = ifort
F90 = gfortran
CC = gcc
F95 = $(F90)
OPTS = -O3
MKLROOT = /opt/intel/composer_xe_2013.3.163/mkl
LIBS = -L$(MKLROOT)/lib/intel64 -lmkl_rt -lpthread -lm
INCS = -I.
WHat should i do here when it says -lmkl_rt is not found ???
Use
source /opt/intel/composerxe/bin/compilervars.sh intel64
(best to put it in bash_profile). Adjust the path according to your installation.
It sets the correct LIBRARY_PATH variable (not LD_LIBRARY_PATH, that is for runtime!)
You should set the variable LD_LIBRARY_PATH and point it to the directory containing the missing library.

Undefined reference when compiling OpenSSL

I'm not sure what to do here, I ran make and got this:
make[2]: Entering directory `/tmp/openssl-1.0.1/test'
( :; LIBDEPS="${LIBDEPS:--L.. -lssl -L.. -lcrypto -ldl}"; LDCMD="${LDCMD:-gcc}"; LDFLAGS="${LDFLAGS:--DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -fno-exceptions -Wa,--noexecstack -m64 -DL_ENDIAN -DTERMIO -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM}"; LIBPATH=`for x in $LIBDEPS; do echo $x; done | sed -e 's/^ *-L//;t' -e d | uniq`; LIBPATH=`echo $LIBPATH | sed -e 's/ /:/g'`; LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH ${LDCMD} ${LDFLAGS} -o ${APPNAME:=rc4test} rc4test.o ${LIBDEPS} )
rc4test.o: In function `main':
rc4test.c:(.text+0x30): undefined reference to `OPENSSL_cpuid_setup'
collect2: ld returned 1 exit status
make[2]: *** [link_app.] Error 1
make[2]: Leaving directory `/tmp/openssl-1.0.1/test'
make[1]: *** [rc4test] Error 2
make[1]: Leaving directory `/tmp/openssl-1.0.1/test'
make: *** [build_tests] Error 1
I think this is a gcc thing, but I am not sure how to approach this. Should I be compiling this manually?
I ran into the same problem, and was able to solve it by passing adding -DOPENSSL_PIC to the config call:
./config -fPIC -DOPENSSL_PIC

Resources