Here are my compiler logs I don't quite understand what to do
$ emmake make CFLAGS="-fstack-protector-strong" LDFLAGS="-fstack-protector-strong"
make: make CFLAGS=-fstack-protector-strong LDFLAGS=-fstack-protector-strong
emcc -fstack-protector-strong -fstack-protector-strong -o mkp224o.tmp main.c.o worker.c.o yaml.c.o vec.c.o cpucount.c.o base32_to.c.o base32_from.c.o base64_to.c.o base64_from.c.o ioutil.c.o keccak.c.o -lpthread -lsodium && mv mkp224o.tmp mkp224o
wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard
wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard
wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard
wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard
wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard
wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard
wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard
wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard
wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard
wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard
wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard
wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard
wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard
wasm-ld-13: error: /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a(libsodium_la-hash_sha256_cp.o): undefined symbol: __stack_chk_guard
emcc: error: '/usr/bin/wasm-ld-13 -o mkp224o.wasm main.c.o worker.c.o yaml.c.o vec.c.o cpucount.c.o base32_to.c.o base32_from.c.o base64_to.c.o base64_from.c.o ioutil.c.o keccak.c.o /usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten/libsodium.a -L/usr/share/emscripten/cache/sysroot/lib/wasm32-emscripten -lGL -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --import-undefined --strip-debug --export-if-defined=main --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__stdio_exit --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_init --export=stackSave --export=stackRestore --export=stackAlloc --export=__wasm_call_ctors --export=__errno_location --export=malloc --export=free --export=emscripten_main_thread_process_queued_calls --export-table -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024' failed (returned 1)
make: *** [GNUmakefile:99: mkp224o] Error 1
emmake: error: 'make CFLAGS=-fstack-protector-strong LDFLAGS=-fstack-protector-strong' failed (returned 2)
The problem is solved, but I did not track at what step it was done, since I walked in circles many times.
From the moment it didn't work for me, I did:
-installed bison and gawk
sudo apt install bison gawk
-copied the "c++" folder from the Include folder to the /usr/share/emscripten/cache/sysroot/include directory.
switched to providing python, with the commands:
python3 '/usr/share/emscripten/emconfigure.py' ./configure --prefix="$(pwd)/install"
python3 '/usr/share/emscripten/emmake.py' make clean
python3 '/usr/share/emscripten/emmake.py' make
when code errors occur, set
sudo apt install python3-pysodium
after I solved a couple of compilation errors (from a very long list of errors) and corrected by type in terminal:
emcc -Wall -Wno-error -Wextra -Wno-unused-function -Wmissing-prototypes -Wstrict-prototypes -x c++ -g -O2 -lm -ldl -Wall -Wpointer-arith -finline-functions -ffast-math -DED25519_donna -fPIE -DSTATISTICS -DPASSPHRASE -DVERSION='"unknown"' -D'CRYPTO_NAMESPACETOP=crypto_sign_ed25519_donna' -D'_CRYPTO_NAMESPACETOP=crypto_sign_ed25519_donna' -D'CRYPTO_NAMESPACE(name)=crypto_sign_ed25519_donna##name' -D'_CRYPTO_NAMESPACE(name)=crypto_sign_ed25519_donna ##name' -c -o main.c.o.tmp main.c && mv main.c.o.tmp main.c.o
and then finished compiling
python3 '/usr/share/emscripten/emmake.py' make
Related
gtk3.def
headers = gtk/gtk.h
headerFilter = gtk/* gobject/* gio/*
build.sh
IPREFIX_linux=-I/usr/include
LINKER_ARGS_linux="-L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib -lglib-2.0 -lgio-2.0 -lgobject-2.0 -latk-1.0 -lpango-1.0 -lgdk_pixbuf-2.0 -lharfbuzz -lcairo -lgtk-3"
if [ x$TARGET == x ]; then
case "$OSTYPE" in
darwin*) TARGET=macbook ;;
linux*) TARGET=linux ;;
*) echo "unknown: $OSTYPE" && exit 1;;
esac
fi
var=IPREFIX_${TARGET}
IPREFIX="${!var}"
var=LINKER_ARGS_${TARGET}
LINKER_ARGS=${!var}
var=COMPILER_ARGS_${TARGET}
COMPILER_ARGS=${!var} # add -opt for an optimized build.
if [ ! -f $DIR/gtk3 ]; then
echo "Generating GTK stubs (once), may take few mins depending on the hardware..."
cinterop -compiler-options $IPREFIX/atk-1.0 -compiler-options $IPREFIX/gio-unix-2.0 -compiler-options $IPREFIX/gdk-pixbuf-2.0 -compiler-options \
$IPREFIX/cairo -compiler-options -I/opt/local/lib/glib-2.0/include \
-compiler-options -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -compiler-options $IPREFIX/gtk-3.0 \
-compiler-options $IPREFIX/glib-2.0 -def $DIR/gtk3.def -compiler-options $IPREFIX/harfbuzz \
-compiler-options $IPREFIX/pango-1.0 -target $TARGET -o $DIR/gtk3 || exit 1
**// the cinterop command makes gtk3.klib which is ok! but the problem is next command.**
*konanc -target $TARGET Application.kt -l $DIR/gtk3 -linker-option "$LINKER_ARGS" -e "sample.gtk.main" -o $DIR/Main.kexe || exit 1*
**// I tried konanc instead of kotlin-native but the error same like below.
// also change target linux instead of linux_x64**
**// Application.kt starts sentence package sample.gtk**
error
/home/bob-kim/.konan/dependencies/x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9-2/x86_64-unknown-linux-gnu/bin/ld.gold invocation reported errors
The /home/bob-kim/.konan/dependencies/x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9-2/x86_64-unknown-linux-gnu/bin/ld.gold command returned non-zero exit code: 1.
output:
/tmp/konan_temp12575366956155761859/result.o:out:function gtk3_g_signal_connect_data_wrapper194: error: undefined reference to 'g_signal_connect_data'
/tmp/konan_temp12575366956155761859/result.o:out:function gtk3_g_object_unref_wrapper279: error: undefined reference to 'g_object_unref'
/tmp/konan_temp12575366956155761859/result.o:out:function gtk3_g_application_run_wrapper593: error: undefined reference to 'g_application_run'
/tmp/konan_temp12575366956155761859/result.o:out:function gtk3_gtk_widget_destroy_wrapper3089: error: undefined reference to 'gtk_widget_destroy'
/tmp/konan_temp12575366956155761859/result.o:out:function gtk3_gtk_widget_show_all_wrapper3095: error: undefined reference to 'gtk_widget_show_all'
/tmp/konan_temp12575366956155761859/result.o:out:function gtk3_gtk_application_new_wrapper3338: error: undefined reference to 'gtk_application_new'
/tmp/konan_temp12575366956155761859/result.o:out:function gtk3_gtk_container_add_wrapper3367: error: undefined reference to 'gtk_container_add'
/tmp/konan_temp12575366956155761859/result.o:out:function gtk3_gtk_window_set_title_wrapper3415: error: undefined reference to 'gtk_window_set_title'
/tmp/konan_temp12575366956155761859/result.o:out:function gtk3_gtk_window_set_default_size_wrapper3510: error: undefined reference to 'gtk_window_set_default_size'
/tmp/konan_temp12575366956155761859/result.o:out:function gtk3_gtk_application_window_new_wrapper4563: error: undefined reference to 'gtk_application_window_new'
/tmp/konan_temp12575366956155761859/result.o:out:function gtk3_gtk_button_box_new_wrapper4612: error: undefined reference to 'gtk_button_box_new'
/tmp/konan_temp12575366956155761859/result.o:out:function gtk3_gtk_button_new_with_label_wrapper4669: error: undefined reference to 'gtk_button_new_with_label'
I'm trying to compile ICU sqlite extension.
System: Ubuntu 19.04
src: sqlite-src-3310100.zip
action history:
unzip sqlte-src-3310100.zip
mkdir bld
cd bld
CFLAGS="-O3" ../sqlte-src-3310100/configure && make -j8
# compilation successfull without errors except some warnings
gcc --shared -fPIC -O3 -licui18n -licudata -licuuc -I ./ -I ../src/ext/icu/ -o libSqliteIcu.so ../src/ext/icu/icu.c
# there is no errors
sudo cp libSqliteIcu.so /usr/lib/
Trying to load:
import sqlite3
conn = sqlite3.connect("database.sqlite") # или :memory: чтобы сохранить в RAM
cur = conn.cursor()
conn.enable_load_extension(True)
conn.load_extension('libSqliteIcu')
Error appears:
------------------------------------------------------
OperationalError Traceback (most recent call last)
<ipython-input-67-d5ebe36b8718> in <module>
3 cur = conn.cursor()
4 conn.enable_load_extension(True)
----> 5 conn.load_extension('libSqliteIcu')
OperationalError: /lib/libSqliteIcu.so: undefined symbol: uregex_setText_64
Please help.
Problem solved.
Solution:
gcc --shared -fPIC -O3 -o libSqliteIcu.so ../src/ext/icu/icu.c -licui18n -licuuc -licudata -L/usr/local/lib
Details:
pkg-config --libs icu-i18n
returns:
-licui18n -licuuc -licudata -L/usr/local/lib
I am trying to build openSSL for android using ndk. I am using dockerFile concept. I have set few environment variables as per suggested in http://wiki.openssl.org/index.php/Android. Now I am getting following error:
make[2]: Entering directory `/Android/openssl/apps'
( :; LIBDEPS="${LIBDEPS:--L.. -lssl -L.. -lcrypto -ldl}"; LDCMD="${LDCMD:-arm-l
inux-androideabi-gcc}"; LDFLAGS="${LDFLAGS:--DOPENSSL_THREADS -D_REENTRANT -DDSO
_DLFCN -DHAVE_DLFCN_H --static -Wa,--noexecstack -march=armv7-a -mandroid -I/And
roid/android-ndk-r10c/platforms/android-19/arch-arm/usr/include -B/Android/andro
id-ndk-r10c/platforms/android-19/arch-arm/usr/lib -O3 -fomit-frame-pointer -Wall
-DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_AS
M -DAES_ASM -DBSAES_ASM -DGHASH_ASM}"; LIBPATH=`for x in $LIBDEPS; do echo $x; d
one | 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:
=openssl} openssl.o verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd
.o gendh.o errstr.o ca.o pkcs7.o crl2p7.o crl.o rsa.o rsautl.o dsa.o dsaparam.o
ec.o ecparam.o x509.o genrsa.o gendsa.o genpkey.o s_server.o s_client.o speed.o
s_time.o apps.o s_cb.o s_socket.o app_rand.o version.o sess_id.o ciphers.o nseq.
o pkcs12.o pkcs8.o pkey.o pkeyparam.o pkeyutl.o spkac.o smime.o cms.o rand.o eng
ine.o ocsp.o prime.o ts.o srp.o ${LIBDEPS} )
/Android/toolchain-arm/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ldl
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_globallookup: error: unde
fined reference to 'dlopen'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_globallookup: error: unde
fined reference to 'dlsym'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_globallookup: error: unde
fined reference to 'dlclose'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_func: error: undefin
ed reference to 'dlsym'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_func: error: undefin
ed reference to 'dlerror'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_var: error: undefine
d reference to 'dlsym'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_bind_var: error: undefine
d reference to 'dlerror'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_load: error: undefined re
ference to 'dlopen'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_load: error: undefined re
ference to 'dlclose'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_load: error: undefined re
ference to 'dlerror'
../libcrypto.a(dso_dlfcn.o):dso_dlfcn.c:function dlfcn_unload: error: undefined
reference to 'dlclose'
collect2: error: ld returned 1 exit status
make[2]: Leaving directory `/Android/openssl/apps'
make[2]: *** [link_app.] Error 1
make[1]: *** [openssl] Error 2
make[1]: Leaving directory `/Android/openssl/apps'
make: *** [build_apps] Error 1
INFO[0135] The command [/bin/sh -c cd openssl && ./config --static no-ssl2 no-ss
l3 no-comp no-hw no-engine && make depend && make && ls -hs . && cp l
ibssl.a /Android/output] returned a non-zero code: 2
docker#boot2docker:/home/curl_ssl$
Do you have suggestions to resolve above error? I am not able to find what is reason behind such error.
Android has openssl already. Perhaps you do not need to compile them. Try answer from this question Compiling OpenSSL on Android
I'm trying to bootstrap the gcc/glibc toolchain. It always fails to build failures. I have been trying dozens of times with different methods.
Here is how I have been trying to bootstrap:
path:
export PATH=/home/defer/dev/linux/bin:/usr/bin:/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.2
binutils:
../configure --prefix=/home/defer/dev/linux --target=x86_64-pc-linux-gnu --with-sysroot=/home/defer/dev/linux --with-lib-path=/home/defer/dev/linux/lib --disable-nls --disable-werror
gcc stage1:
../configure --target=x86_64-pc-linux-gnu --prefix=/home/defer/dev/linux --with-sysroot=/home/defer/dev/linux --with-newlib --without-headers --with-native-system-header-dir=/home/defer/dev/linux/include --disable-nls
--disable-shared --disable-multilib --disable-decimal-float --disable-threads --disable-libatomic --disable-libgomp --disable-libitm --disable-libmudflap --disable-libquadmath --disable-libsanitizer --disable-libssp --disable-libstdc++-v3 --enable-languages=c,c++
linux headers:
make INSTALL_HDR_PATH=/home/defer/dev/linux headers_install
glibc:
../configure --prefix=/home/defer/dev/linux --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-profile --enable-kernel=2.6.32 --with-headers=/home/defer/dev/linux/include libc_cv_forced_unwind=yes libc_cv_ctors_header=yes libc_cv_c_cleanup=yes
Here are errors I get while building glibc:
a - ns_netint.os
a - ns_ttl.os
a - ns_print.os
a - ns_samedomain.os
a - ns_date.os
cd /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv && /home/defer/dev/linux/lib/gcc/x86_64-pc-linux-gnu/4.8.2/../../../../x86_64-pc-linux-gnu/bin/ar cruv libnss_dns_pic.a dns-host.os dns-network.os dns-canon.os
cd /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv && /home/defer/dev/linux/lib/gcc/x86_64-pc-linux-gnu/4.8.2/../../../../x86_64-pc-linux-gnu/bin/ar cruv libanl.a gai_cancel.o gai_error.o gai_misc.o gai_notify.o gai_suspend.o getaddrinfo_a.o
a - dns-host.os
a - dns-network.os
a - dns-canon.os
x86_64-pc-linux-gnu-gcc -shared -static-libgcc -Wl,-O1 -Wl,-z,defs -Wl,-dynamic-linker=/home/defer/dev/linux/lib/ld-linux-x86-64.so.2 -B/home/defer/dev/linux/src/glibc-2.19/glibc-build/csu/ -Wl,--version-script=/home/defer/dev/linux/src/glibc-2.19/glibc-build/libresolv.map -Wl,-soname=libresolv.so.2 -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both -L/home/defer/dev/linux/src/glibc-2.19/glibc-build -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/math -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/elf -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/dlfcn -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/nss -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/nis -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/rt -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/crypt -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/nptl -Wl,-rpath-link=/home/defer/dev/linux/src/glibc-2.19/glibc-build:/home/defer/dev/linux/src/glibc-2.19/glibc-build/math:/home/defer/dev/linux/src/glibc-2.19/glibc-build/elf:/home/defer/dev/linux/src/glibc-2.19/glibc-build/dlfcn:/home/defer/dev/linux/src/glibc-2.19/glibc-build/nss:/home/defer/dev/linux/src/glibc-2.19/glibc-build/nis:/home/defer/dev/linux/src/glibc-2.19/glibc-build/rt:/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv:/home/defer/dev/linux/src/glibc-2.19/glibc-build/crypt:/home/defer/dev/linux/src/glibc-2.19/glibc-build/nptl -o /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libresolv.so -T /home/defer/dev/linux/src/glibc-2.19/glibc-build/shlib.lds /home/defer/dev/linux/src/glibc-2.19/glibc-build/csu/abi-note.o -Wl,--whole-archive /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libresolv_pic.a -Wl,--no-whole-archive /home/defer/dev/linux/src/glibc-2.19/glibc-build/elf/interp.os -Wl,--start-group /home/defer/dev/linux/src/glibc-2.19/glibc-build/libc.so /home/defer/dev/linux/src/glibc-2.19/glibc-build/libc_nonshared.a -Wl,--as-needed /home/defer/dev/linux/src/glibc-2.19/glibc-build/elf/ld.so -Wl,--no-as-needed -Wl,--end-group
a - gai_cancel.o
a - gai_error.o
a - gai_misc.o
a - gai_notify.o
a - gai_suspend.o
a - getaddrinfo_a.o
cd /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv && /home/defer/dev/linux/lib/gcc/x86_64-pc-linux-gnu/4.8.2/../../../../x86_64-pc-linux-gnu/bin/ar cruv libanl_pic.a gai_cancel.os gai_error.os gai_misc.os gai_notify.os gai_suspend.os getaddrinfo_a.os
a - gai_cancel.os
a - gai_error.os
a - gai_misc.os
a - gai_notify.os
a - gai_suspend.os
a - getaddrinfo_a.os
x86_64-pc-linux-gnu-gcc -shared -static-libgcc -Wl,-O1 -Wl,-z,defs -Wl,-dynamic-linker=/home/defer/dev/linux/lib/ld-linux-x86-64.so.2 -B/home/defer/dev/linux/src/glibc-2.19/glibc-build/csu/ -Wl,--version-script=/home/defer/dev/linux/src/glibc-2.19/glibc-build/libanl.map -Wl,-soname=libanl.so.1 -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both -L/home/defer/dev/linux/src/glibc-2.19/glibc-build -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/math -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/elf -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/dlfcn -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/nss -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/nis -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/rt -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/crypt -L/home/defer/dev/linux/src/glibc-2.19/glibc-build/nptl -Wl,-rpath-link=/home/defer/dev/linux/src/glibc-2.19/glibc-build:/home/defer/dev/linux/src/glibc-2.19/glibc-build/math:/home/defer/dev/linux/src/glibc-2.19/glibc-build/elf:/home/defer/dev/linux/src/glibc-2.19/glibc-build/dlfcn:/home/defer/dev/linux/src/glibc-2.19/glibc-build/nss:/home/defer/dev/linux/src/glibc-2.19/glibc-build/nis:/home/defer/dev/linux/src/glibc-2.19/glibc-build/rt:/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv:/home/defer/dev/linux/src/glibc-2.19/glibc-build/crypt:/home/defer/dev/linux/src/glibc-2.19/glibc-build/nptl -o /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libanl.so -T /home/defer/dev/linux/src/glibc-2.19/glibc-build/shlib.lds /home/defer/dev/linux/src/glibc-2.19/glibc-build/csu/abi-note.o -Wl,--whole-archive /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libanl_pic.a -Wl,--no-whole-archive /home/defer/dev/linux/src/glibc-2.19/glibc-build/elf/interp.os /home/defer/dev/linux/src/glibc-2.19/glibc-build/nptl/libpthread_nonshared.a /home/defer/dev/linux/src/glibc-2.19/glibc-build/nptl/libpthread.so -Wl,--start-group /home/defer/dev/linux/src/glibc-2.19/glibc-build/libc.so /home/defer/dev/linux/src/glibc-2.19/glibc-build/libc_nonshared.a -Wl,--as-needed /home/defer/dev/linux/src/glibc-2.19/glibc-build/elf/ld.so -Wl,--no-as-needed -Wl,--end-group
rm -f /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libanl.so.1.new
/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libresolv_pic.a(ns_print.os): In function `__GI_ns_sprintrrf':
/home/defer/dev/linux/src/glibc-2.19/resolv/ns_print.c:99: undefined reference to `__stack_chk_guard'
/home/defer/dev/linux/src/glibc-2.19/resolv/ns_print.c:728: undefined reference to `__stack_chk_guard'
/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libresolv_pic.a(gethnamaddr.os): In function `getanswer':
/home/defer/dev/linux/src/glibc-2.19/resolv/gethnamaddr.c:180: undefined reference to `__stack_chk_guard'
/home/defer/dev/linux/src/glibc-2.19/resolv/gethnamaddr.c:483: undefined reference to `__stack_chk_guard'
/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libresolv_pic.a(gethnamaddr.os): In function `__GI_res_gethostbyname2':
/home/defer/dev/linux/src/glibc-2.19/resolv/gethnamaddr.c:510: undefined reference to `__stack_chk_guard'
/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libresolv_pic.a(gethnamaddr.os):/home/defer/dev/linux/src/glibc-2.19/resolv/gethnamaddr.c:636: more undefined references to `__stack_chk_guard' follow
collect2: error: ld returned 1 exit status
/bin/sh ../scripts/rellns-sh /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libanl.so /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libanl.so.1.new
../Makerules:438: recipe for target '/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libresolv.so' failed
make[2]: *** [/home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libresolv.so] Error 1
make[2]: *** Waiting for unfinished jobs....
mv -f /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libanl.so.1.new /home/defer/dev/linux/src/glibc-2.19/glibc-build/resolv/libanl.so.1
make[2]: Leaving directory '/home/defer/dev/linux/src/glibc-2.19/resolv'
Makefile:213: recipe for target 'resolv/others' failed
make[1]: *** [resolv/others] Error 2
make[1]: Leaving directory '/home/defer/dev/linux/src/glibc-2.19'
Makefile:9: recipe for target 'all' failed
make: *** [all] Error 2
real 3m23.747s
user 9m57.851s
sys 1m21.334s
I solved the problem. Gentoo GCC had stack smash protection on by default.
I had to use:
CFLAGS="-O2 -fno-stack-protector" ../configure --prefix=/home/defer/dev/linux --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-profile --enable-kernel=2.6.32 --with-headers=/home/defer/dev/linux/include libc_cv_forced_unwind=yes libc_cv_ctors_header=yes libc_cv_c_cleanup=yes
Hopefully someone can help with this.
After rebuilding OpenCV 2.4.6 with Cuda Toolkit 5.5 on linux, an attempt was made to build a single c++ file that references OpenCV and CUDA using via make and a CLI g++ command. The input and output from each approach are shown below.
The Makefile attempts to reference the *.a files from OpenCV, but is not successful. The CLI g++ command attempts to reference *.so files, which it seems to do, however, some methods appear to be undefined.
Is it necessary for the Makefile to access only the OpenCV *.a files?
Makefile:
CFLAGS = -g Wall
LIBPATH = /data/content/cuda/opencv-2.4.6/lib
LIBS = -lopencv_calib3d_pch_dephelp -lopencv_contrib_pch_dephelp -lopencv_core_pch_dephelp -lopencv_features2d_pch_dephelp -lopencv_flann_pch_dephelp -lopencv_gpu_pch_dephelp -lopencv_haartraining_engine -lopencv_highgui_pch_dephelp -lopencv_imgproc_pch_dephelp -lopencv_legacy_pch_dephelp -lopencv_ml_pch_dephelp -lopencv_nonfree_pch_dephelp -lopencv_objdetect_pch_dephelp -lopencv_perf_calib3d_pch_dephelp -lopencv_perf_core_pch_dephelp -lopencv_perf_features2d_pch_dephelp -lopencv_perf_gpu_pch_dephelp -lopencv_perf_highgui_pch_dephelp -lopencv_perf_imgproc_pch_dephelp -lopencv_perf_nonfree_pch_dephelp -lopencv_perf_objdetect_pch_dephelp -lopencv_perf_photo_pch_dephelp -lopencv_perf_stitching_pch_dephelp -lopencv_perf_superres_pch_dephelp -lopencv_perf_video_pch_dephelp -lopencv_photo_pch_dephelp -lopencv_stitching_pch_dephelp -lopencv_superres_pch_dephelp -lopencv_test_calib3d_pch_dephelp -lopencv_test_contrib_pch_dephelp -lopencv_test_core_pch_dephelp -lopencv_test_features2d_pch_dephelp -lopencv_test_flann_pch_dephelp -lopencv_test_gpu_pch_dephelp -lopencv_test_highgui_pch_dephelp -lopencv_test_imgproc_pch_dephelp -lopencv_test_legacy_pch_dephelp -lopencv_test_ml_pch_dephelp -lopencv_test_nonfree_pch_dephelp -lopencv_test_objdetect_pch_dephelp -lopencv_test_photo_pch_dephelp -lopencv_test_stitching_pch_dephelp -lopencv_test_superres_pch_dephelp -lopencv_test_video_pch_dephelp -lopencv_ts_pch_dephelp -lopencv_video_pch_dephelp -lopencv_videostab_pch_dephelp -lopencv_gpu -lopencv_highgui
INCLUDEPATH1 = /usr/include/opencv2/core
INCLUDEPATH2 = /usr/include/opencv2/highgui
INCLUDEPATH3 = /usr/include/opencv2/gpu
all: tiff2png1.so
tiff2png1.so: main.o
g++ -o tiff2png1.so main.o **-L $(LIBPATH) $(LIB)**
main.o: main.cpp
g++ -c main.cpp -g -Wall -I $(INCLUDEPATH1) -I $(INCLUDEPATH2) -I $(INCLUDEPATH3) $(LIBPATH)
.PHONY: clean
clean:
rm -vf tiff2png1.so *.o
Makefile Output:
g++ -o tiff2png1.so main.o -L /data/content/cuda/opencv-2.4.6/lib
main.o: In function main':
/home/.../main.cpp:13: undefined reference tocv::gpu::getCudaEnabledDeviceCount()'
/home/.../main.cpp:15: undefined reference to cv::gpu::getDevice()'
/home/.../main.cpp:21: undefined reference tocv::imread(std::basic_string, std::allocator > const&, int)'
/home/.../main.cpp:27: undefined reference to cv::gpu::GpuMat::GpuMat(cv::Mat const&)'
/home/.../main.cpp:29: undefined reference tocv::gpu::Stream::Null()'
/home/.../main.cpp:29: undefined reference to cv::gpu::resize(cv::gpu::GpuMat const&, cv::gpu::GpuMat&, cv::Size_<int>, double, double, int, cv::gpu::Stream&)'
/home/.../main.cpp:42: undefined reference tocv::Mat::Mat(cv::gpu::GpuMat const&)'
/home/.../main.cpp:49: undefined reference to cv::_InputArray::_InputArray(cv::Mat const&)'
...
main.o: In function~GpuMat': /usr/include/opencv2/core/gpumat.hpp:374: undefined reference to `cv::gpu::GpuMat::release()'
collect2: ld returned 1 exit status
make: * [tiff2png1.so] Error 1
Command Line Build
$ g++ -o tx.exe main.o -L/data/content/cuda/opencv-2.4.6/lib -lopencv_gpu
Command Line Build Output
/data/content/cuda/opencv-2.4.6/lib/libopencv_gpu.so: undefined reference to `cv::gpu::convertTo(cv::gpu::GpuMat const&, cv::gpu::GpuMat&, double, double, CUstream_st*)'
/data/content/cuda/opencv-2.4.6/lib/libopencv_gpu.so: undefined reference to `cv::gpu::setTo(cv::gpu::GpuMat&, cv::Scalar_, cv::gpu::GpuMat const&, CUstream_st*)'
/data/content/cuda/opencv-2.4.6/lib/libopencv_gpu.so: undefined reference to `cv::gpu::setTo(cv::gpu::GpuMat&, cv::Scalar_, CUstream_st*)'
collect2: ld returned 1 exit status
It looks like you may have omitted an 'S' at the end of your variable in the linker target
**LIBS** = -lopencv_calib3d_pch_dephelp ...
tiff2png1.so: main.o
g++ -o tiff2png1.so main.o -L $(LIBPATH) $(**LIB**)
and so the -l options aren't being passed to the linker
g++ -o tiff2png1.so main.o -L /data/content/cuda/opencv-2.4.6/lib **should be here** main.o