I'm trying to use WinARM 4.1.1 to compile and link object files for a BREW project. I got started using this page: http://brew.wardco.com/.
First thing to note is that I have this successfully working under the GNUDE tool chain. When I switched over to WinARM, I initially got it to work till I noticed that I had -Lc:/gnude/arm-elf/lib instead of -Lc:/WinARM/arm-elf/lib in my linker library path. I obviously don't want to have both systems in place in my environment. Using the WinARM library path causes me to get the following linker errors:
c:/WinARM/arm-elf/lib\libsupc++.a(eh_personality.o): In function `read_encoded_value_with_base':
c:/winarms/gcc-4.1.1/gcc/unwind-pe.h:259: undefined reference to `abort'
c:/WinARM/arm-elf/lib\libsupc++.a(eh_personality.o): In function `base_of_encoded_value':
c:/winarms/gcc-4.1.1/gcc/unwind-pe.h:122: undefined reference to `abort'
c:/winarms/gcc-4.1.1/gcc/unwind-pe.h:122: undefined reference to `abort'
c:/WinARM/arm-elf/lib\libsupc++.a(eh_personality.o): In function `size_of_encoded_value':
c:/winarms/gcc-4.1.1/gcc/unwind-pe.h:90: undefined reference to `abort'
c:/WinARM/arm-elf/lib\libsupc++.a(eh_terminate.o): In function `__cxxabiv1::__terminate(void (*)())':
../../../../../gcc-4.1.1/libstdc++-v3/libsupc++/eh_terminate.cc:44: undefined reference to `abort'
c:/WinARM/arm-elf/lib\libsupc++.a(eh_terminate.o):../../../../../gcc-4.1.1/libstdc++-v3/libsupc++/eh_terminate.cc:46: more undefined references to `abort' follow
c:/WinARM/arm-elf/lib\libc.a(fopen.o): In function `_fopen_r':
fopen.c:(.text+0x48): undefined reference to `_open_r'
c:/WinARM/arm-elf/lib\libc.a(freer.o): In function `_malloc_trim_r':
mallocr.c:(.text+0x48): undefined reference to `_sbrk_r'
mallocr.c:(.text+0x64): undefined reference to `_sbrk_r'
mallocr.c:(.text+0x84): undefined reference to `_sbrk_r'
c:/WinARM/arm-elf/lib\libc.a(fseek.o): In function `_fseek_r':
fseek.c:(.text+0x158): undefined reference to `_fstat_r'
fseek.c:(.text+0x1b0): undefined reference to `_fstat_r'
c:/WinARM/arm-elf/lib\libc.a(makebuf.o): In function `__smakebuf':
makebuf.c:(.text+0x3c): undefined reference to `_fstat_r'
makebuf.c:(.text+0x110): undefined reference to `isatty'
c:/WinARM/arm-elf/lib\libc.a(mallocr.o): In function `_malloc_r':
mallocr.c:(.text+0x424): undefined reference to `_sbrk_r'
mallocr.c:(.text+0x4cc): undefined reference to `_sbrk_r'
c:/WinARM/arm-elf/lib\libc.a(stdio.o): In function `__sclose':
stdio.c:(.text+0xc): undefined reference to `_close_r'
c:/WinARM/arm-elf/lib\libc.a(stdio.o): In function `__sseek':
stdio.c:(.text+0x30): undefined reference to `_lseek_r'
c:/WinARM/arm-elf/lib\libc.a(stdio.o): In function `__swrite':
stdio.c:(.text+0x84): undefined reference to `_lseek_r'
stdio.c:(.text+0xac): undefined reference to `_write_r'
c:/WinARM/arm-elf/lib\libc.a(stdio.o): In function `__sread':
stdio.c:(.text+0xd0): undefined reference to `_read_r'
c:/WinARM/arm-elf/lib\libc.a(syswrite.o): In function `write':
syswrite.c:(.text+0x24): undefined reference to `_write_r'
C:\WinARM/lib/gcc/arm-elf/4.1.1/\libgcc.a(unwind-sjlj.o): In function `_Unwind_RaiseException_Phase2':
../../../gcc-4.1.1/gcc/unwind.inc:75: undefined reference to `abort'
C:\WinARM/lib/gcc/arm-elf/4.1.1/\libgcc.a(unwind-sjlj.o): In function `_Unwind_SjLj_Resume':
../../../gcc-4.1.1/gcc/unwind.inc:238: undefined reference to `abort'
C:\WinARM/lib/gcc/arm-elf/4.1.1/\libgcc.a(unwind-sjlj.o): In function `_Unwind_SjLj_Resume_or_Rethrow':
../../../gcc-4.1.1/gcc/unwind.inc:263: undefined reference to `abort'
NMAKE : fatal error U1077: 'C:\WinARM\bin\arm-elf-ld.EXE' : return code '0x1'
Stop.
I am not sure how to approach solving this; it appears that I am simply missing a path somewhere, but which path? I notice there are "c:\winarms\gcc-4.1.1..." 'paths' listed... this not a location on my computer. Is it a library reference?
Any insight would be appreciated.
Have you tried c:\WinARM\lib\gcc\arm-elf\4.1.1 ? Your lib path could also depend on what kind of instruction set you are using. I use something like c:\blahblah\WinARM\lib\gcc\arm-elf\4.1.1\thumb because I build most of my sources into the thumb instruction set.
Related
I am trying to compile some programs i have found on github. The repository is at the following URL:
[enter link description here][1]
https://github.com/iagox86/nbtool
I have little knowledge of C programs, however when i try to use GCC with the following command i receive errors.
the command i have tried is:
gcc -o dnslogger dnslogger.c
I receive the following error:
/tmp/ccLRFQbp.o: In function `dns_callback':
dnslogger.c:(.text+0x51): undefined reference to `dns_create_from_packet'
dnslogger.c:(.text+0x5f): undefined reference to `dns_create'
dnslogger.c:(.text+0x10e): undefined reference to `dns_add_question'
dnslogger.c:(.text+0x179): undefined reference to `dns_add_answer_A'
dnslogger.c:(.text+0x1dc): undefined reference to `dns_add_answer_AAAA'
dnslogger.c:(.text+0x214): undefined reference to `dns_to_packet'
dnslogger.c:(.text+0x236): undefined reference to `udp_send'
dnslogger.c:(.text+0x260): undefined reference to `dns_create_error_string'
dnslogger.c:(.text+0x282): undefined reference to `udp_send'
dnslogger.c:(.text+0x28e): undefined reference to `safe_free'
dnslogger.c:(.text+0x29a): undefined reference to `dns_destroy'
dnslogger.c:(.text+0x2a6): undefined reference to `dns_destroy'
/tmp/ccLRFQbp.o: In function `dns_poll':
dnslogger.c:(.text+0x2d7): undefined reference to `select_group_create'
dnslogger.c:(.text+0x304): undefined reference to `select_group_add_socket'
dnslogger.c:(.text+0x321): undefined reference to `select_set_recv'
dnslogger.c:(.text+0x336): undefined reference to `select_group_do_select'
/tmp/ccLRFQbp.o: In function `cleanup':
dnslogger.c:(.text+0x36b): undefined reference to `select_group_destroy'
dnslogger.c:(.text+0x37a): undefined reference to `safe_free'
dnslogger.c:(.text+0x384): undefined reference to `print_memory'
/tmp/ccLRFQbp.o: In function `main':
dnslogger.c:(.text+0x6ed): undefined reference to `safe_malloc_internal'
dnslogger.c:(.text+0x718): undefined reference to `winsock_initialize'
dnslogger.c:(.text+0x934): undefined reference to `dns_do_test'
dnslogger.c:(.text+0xaab): undefined reference to `udp_create_socket'
dnslogger.c:(.text+0xb5f): undefined reference to `drop_privileges'
collect2: error: ld returned 1 exit status
the repository has a Makefile file which i suspect is used to compile the programs, but i am not sure of the exact commands to use on ubuntu, i have tried some of the commands but i receive errors when using the supplied commands from the file.
the makefile is located here:
https://github.com/iagox86/nbtool/blob/master/Makefile
How can i compile these programs from ubuntu command line?
Just run make.
git clone https://github.com/iagox86/nbtool
cd nbtool
make
You need some programs to compile everything (samples) though.
(make will complain if they're missing on your system)
If you're more interested in the Makefile itself, use the links in the comments or read specific documentation for example Gnu Make
(I chose Gnu Make, as tags specify ubuntu explicitly)
I'm trying to crosscompile the azure iothub sdk, written in C, for an ARM gateway.
This gateway is provided with its crosscompiler.
I need iothub's libraries and includes in order to develop on the gateway.
I've downloaded and crosscompiled zlib, curl, openssl and libuuid for thar ARM device without problems.
Currently I'm stuck at the linking phase of the crosscompilation.
In order to compile the sdk Cmake is used, so I've provided a cusom toolchain file to setup paths and directories to my development environment.
This is the system configuration:
OS: Linux 2.6.36
Architecture: ARM9
Azure IoTHub SDK Version: 2017-11-03
toolchain file (toolchain.cmake):
INCLUDE(CMakeForceCompiler)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_C_COMPILER /opt/crosstool/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc)
set(CMAKE_CXX_COMPILER /opt/crosstool/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-g++)
set(CMAKE_C_FLAGS "${CMAKE_CC_FLAGS} -L/opt/crosstool/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/usr/lib -ldl -lcrypto -lssl")
#set(CMAKE_C_FLAGS "--std=c99 ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L/opt/crosstool/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/usr/lib -ldl -lcrypto -lssl")
set(CXX_FLAG_CXX11 "--std=c++11 ${CMAKE_CXX_FLAGS}")
set(CMAKE_FIND_ROOT_PATH /opt/crosstool/arm-none-linux-gnueabi/arm-none-linux-gnueabi)
#OpenSSL path
set(OPENSSL_ROOT_DIR /opt/crosstool/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/usr/ssl)
set(OPENSSL_CRYPTO_LIBRARY /opt/crosstool/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/usr/lib/libcrypto.so.1.0.0)
#set(OPENSSL_CRYPTO_LIBRARY /opt/crosstool/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/armv4t/usr/lib/libcrypt.a)
set(OPENSSL_SSL_LIBRARY /opt/crosstool/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/usr/lib/libssl.a)
set(OPENSSL_INCLUDE_DIR /opt/crosstool/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/usr/include)
#libcurl path
set(CURL_INCLUDE_DIR /opt/crosstool/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/usr/include/curl)
set(CURL_LIBRARY /opt/crosstool/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/usr/lib/libcurl.a)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
To compile the sdk I run following commands inside /sdk/directory/cmake/ :
cmake -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DCMAKE_INSTALL_PREFIX=/opt/crosstool/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/usr/
cmake --build .
First command returns to me this output:
-- The C compiler identification is GNU 4.4.1
-- The CXX compiler identification is GNU 4.4.1
-- Check for working C compiler: /opt/crosstool/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc
-- Check for working C compiler: /opt/crosstool/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /opt/crosstool/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-g++
-- Check for working CXX compiler: /opt/crosstool/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for include file stdint.h
-- Looking for include file stdint.h - found
-- Looking for include file stdbool.h
-- Looking for include file stdbool.h - found
-- target architecture: ARM
-- Found OpenSSL: /opt/crosstool/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/usr/lib/libcrypto.so.1.0.0 (found version "1.0.2m")
-- Cross compiling not using pkg-config
-- Found CURL: /opt/crosstool/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/usr/lib/libcurl.a
-- Found CURL: /opt/crosstool/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/usr/lib/libcurl.a
-- target architecture: ARM
-- target architecture: ARM
-- target architecture: ARM
-- iothub architecture: ARM
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/azure-iot-sdk-c/cmake
I'm getting problems with the secon one which got an error at the 20% of the process while linking files, this the output:
[ 19%] Built target aziotsharedutil
Scanning dependencies of target iot_c_utility
[ 20%] Building C object c-utility/samples/iot_c_utility/CMakeFiles/iot_c_utility.dir/iot_c_utility.c.o
[ 20%] Linking C executable iot_c_utility
../../libaziotsharedutil.a(tlsio_openssl.c.o): In function log_ERR_get_error': tlsio_openssl.c:(.text+0x1198): undefined reference toERR_get_error'
tlsio_openssl.c:(.text+0x11d4): undefined reference to ERR_error_string' tlsio_openssl.c:(.text+0x1224): undefined reference toERR_get_error'
../../libaziotsharedutil.a(tlsio_openssl.c.o): In function openssl_dynamic_locks_uninstall': tlsio_openssl.c:(.text+0x1450): undefined reference toCRYPTO_set_dynlock_create_callback'
tlsio_openssl.c:(.text+0x1458): undefined reference to CRYPTO_set_dynlock_lock_callback' tlsio_openssl.c:(.text+0x1460): undefined reference toCRYPTO_set_dynlock_destroy_callback'
../../libaziotsharedutil.a(tlsio_openssl.c.o): In function openssl_dynamic_locks_install': tlsio_openssl.c:(.text+0x1484): undefined reference toCRYPTO_set_dynlock_destroy_callback'
tlsio_openssl.c:(.text+0x1494): undefined reference to CRYPTO_set_dynlock_lock_callback' tlsio_openssl.c:(.text+0x14a4): undefined reference toCRYPTO_set_dynlock_create_callback'
../../libaziotsharedutil.a(tlsio_openssl.c.o): In function openssl_static_locks_lock_unlock_cb': tlsio_openssl.c:(.text+0x14ec): undefined reference toCRYPTO_num_locks'
../../libaziotsharedutil.a(tlsio_openssl.c.o): In function openssl_static_locks_uninstall': tlsio_openssl.c:(.text+0x15f4): undefined reference toCRYPTO_set_locking_callback'
tlsio_openssl.c:(.text+0x1658): undefined reference to CRYPTO_num_locks' ../../libaziotsharedutil.a(tlsio_openssl.c.o): In functionopenssl_static_locks_install':
tlsio_openssl.c:(.text+0x1790): undefined reference to CRYPTO_num_locks' tlsio_openssl.c:(.text+0x18ec): undefined reference toCRYPTO_num_locks'
tlsio_openssl.c:(.text+0x1908): undefined reference to CRYPTO_num_locks' tlsio_openssl.c:(.text+0x1980): undefined reference toCRYPTO_set_locking_callback'
../../libaziotsharedutil.a(tlsio_openssl.c.o): In function write_outgoing_bytes': tlsio_openssl.c:(.text+0x1b60): undefined reference toBIO_ctrl_pending'
tlsio_openssl.c:(.text+0x1c18): undefined reference to BIO_read' ../../libaziotsharedutil.a(tlsio_openssl.c.o): In functionsend_handshake_bytes':
tlsio_openssl.c:(.text+0x1d38): undefined reference to ERR_clear_error' tlsio_openssl.c:(.text+0x1d48): undefined reference toSSL_do_handshake'
tlsio_openssl.c:(.text+0x1d70): undefined reference to SSL_get_error' tlsio_openssl.c:(.text+0x1db8): undefined reference toERR_get_error'
tlsio_openssl.c:(.text+0x1dc8): undefined reference to ERR_error_string' ../../libaziotsharedutil.a(tlsio_openssl.c.o): In functiondecode_ssl_received_bytes':
tlsio_openssl.c:(.text+0x21d0): undefined reference to SSL_read' ../../libaziotsharedutil.a(tlsio_openssl.c.o): In functionon_underlying_io_bytes_received':
tlsio_openssl.c:(.text+0x22e8): undefined reference to BIO_write' ../../libaziotsharedutil.a(tlsio_openssl.c.o): In functionclose_openssl_instance':
tlsio_openssl.c:(.text+0x241c): undefined reference to SSL_free' tlsio_openssl.c:(.text+0x2448): undefined reference toSSL_CTX_free'
../../libaziotsharedutil.a(tlsio_openssl.c.o): In function add_certificate_to_store': tlsio_openssl.c:(.text+0x249c): undefined reference toSSL_CTX_get_cert_store'
tlsio_openssl.c:(.text+0x24d0): undefined reference to BIO_s_mem' tlsio_openssl.c:(.text+0x2508): undefined reference toBIO_new'
tlsio_openssl.c:(.text+0x2544): undefined reference to BIO_puts' tlsio_openssl.c:(.text+0x25b4): undefined reference toX509_STORE_add_cert'
tlsio_openssl.c:(.text+0x25c8): undefined reference to X509_free' tlsio_openssl.c:(.text+0x25e4): undefined reference toX509_free'
tlsio_openssl.c:(.text+0x2600): undefined reference to PEM_read_bio_X509' tlsio_openssl.c:(.text+0x263c): undefined reference toBIO_free'
../../libaziotsharedutil.a(tlsio_openssl.c.o): In function create_openssl_instance': tlsio_openssl.c:(.text+0x26b0): undefined reference toTLSv1_2_method'
tlsio_openssl.c:(.text+0x26d0): undefined reference to TLSv1_1_method' tlsio_openssl.c:(.text+0x26e0): undefined reference toTLSv1_method'
tlsio_openssl.c:(.text+0x26f0): undefined reference to SSL_CTX_new' tlsio_openssl.c:(.text+0x2758): undefined reference toSSL_CTX_free'
tlsio_openssl.c:(.text+0x27e4): undefined reference to SSL_CTX_free' tlsio_openssl.c:(.text+0x2870): undefined reference toSSL_CTX_free'
tlsio_openssl.c:(.text+0x2904): undefined reference to SSL_CTX_set_cert_verify_callback' tlsio_openssl.c:(.text+0x2908): undefined reference toBIO_s_mem'
tlsio_openssl.c:(.text+0x2914): undefined reference to BIO_new' tlsio_openssl.c:(.text+0x2940): undefined reference toSSL_CTX_free'
tlsio_openssl.c:(.text+0x296c): undefined reference to BIO_s_mem' tlsio_openssl.c:(.text+0x2978): undefined reference toBIO_new'
tlsio_openssl.c:(.text+0x29a4): undefined reference to BIO_free' tlsio_openssl.c:(.text+0x29b4): undefined reference toSSL_CTX_free'
tlsio_openssl.c:(.text+0x29f8): undefined reference to BIO_ctrl' tlsio_openssl.c:(.text+0x2a20): undefined reference toBIO_ctrl'
tlsio_openssl.c:(.text+0x2a3c): undefined reference to BIO_free' tlsio_openssl.c:(.text+0x2a4c): undefined reference toBIO_free'
tlsio_openssl.c:(.text+0x2a5c): undefined reference to SSL_CTX_free' tlsio_openssl.c:(.text+0x2ae0): undefined reference toSSL_CTX_set_verify'
tlsio_openssl.c:(.text+0x2af0): undefined reference to SSL_CTX_set_default_verify_paths' tlsio_openssl.c:(.text+0x2b60): undefined reference toSSL_new'
tlsio_openssl.c:(.text+0x2b8c): undefined reference to BIO_free' tlsio_openssl.c:(.text+0x2b9c): undefined reference toBIO_free'
tlsio_openssl.c:(.text+0x2bac): undefined reference to SSL_CTX_free' tlsio_openssl.c:(.text+0x2bfc): undefined reference toSSL_set_bio'
tlsio_openssl.c:(.text+0x2c0c): undefined reference to SSL_set_connect_state' ../../libaziotsharedutil.a(tlsio_openssl.c.o): In functiontlsio_openssl_init':
tlsio_openssl.c:(.text+0x2c88): undefined reference to SSL_library_init' tlsio_openssl.c:(.text+0x2c8c): undefined reference toSSL_load_error_strings'
tlsio_openssl.c:(.text+0x2c90): undefined reference to ERR_load_BIO_strings' tlsio_openssl.c:(.text+0x2c94): undefined reference toOPENSSL_add_all_algorithms_noconf'
../../libaziotsharedutil.a(tlsio_openssl.c.o): In function tlsio_openssl_deinit': tlsio_openssl.c:(.text+0x2d40): undefined reference toFIPS_mode_set'
tlsio_openssl.c:(.text+0x2d48): undefined reference to CRYPTO_set_locking_callback' tlsio_openssl.c:(.text+0x2d50): undefined reference toCRYPTO_set_id_callback'
tlsio_openssl.c:(.text+0x2d54): undefined reference to ERR_free_strings' tlsio_openssl.c:(.text+0x2d58): undefined reference toEVP_cleanup'
tlsio_openssl.c:(.text+0x2d60): undefined reference to ERR_remove_thread_state' tlsio_openssl.c:(.text+0x2d64): undefined reference toSSL_COMP_free_compression_methods'
tlsio_openssl.c:(.text+0x2d68): undefined reference to CRYPTO_cleanup_all_ex_data' ../../libaziotsharedutil.a(tlsio_openssl.c.o): In functiontlsio_openssl_send':
tlsio_openssl.c:(.text+0x38e4): undefined reference to SSL_write' ../../libaziotsharedutil.a(tlsio_openssl.c.o): In functiontlsio_openssl_setoption':
tlsio_openssl.c:(.text+0x423c): undefined reference to SSL_CTX_set_cert_verify_callback' tlsio_openssl.c:(.text+0x42ac): undefined reference toSSL_CTX_set_cert_verify_callback'
../../libaziotsharedutil.a(x509_openssl.c.o): In function log_ERR_get_error': x509_openssl.c:(.text+0x80): undefined reference toERR_get_error'
x509_openssl.c:(.text+0xbc): undefined reference to ERR_error_string' x509_openssl.c:(.text+0x10c): undefined reference toERR_get_error'
../../libaziotsharedutil.a(x509_openssl.c.o): In function load_certificate_chain': x509_openssl.c:(.text+0x170): undefined reference toBIO_new_mem_buf'
x509_openssl.c:(.text+0x1b4): undefined reference to PEM_read_bio_X509_AUX' x509_openssl.c:(.text+0x1f0): undefined reference toSSL_CTX_use_certificate'
x509_openssl.c:(.text+0x250): undefined reference to sk_pop_free' x509_openssl.c:(.text+0x274): undefined reference toSSL_CTX_ctrl'
x509_openssl.c:(.text+0x288): undefined reference to X509_free' x509_openssl.c:(.text+0x2ac): undefined reference toPEM_read_bio_X509'
x509_openssl.c:(.text+0x2d0): undefined reference to ERR_peek_last_error' x509_openssl.c:(.text+0x300): undefined reference toERR_clear_error'
x509_openssl.c:(.text+0x31c): undefined reference to X509_free' x509_openssl.c:(.text+0x324): undefined reference toBIO_free'
x509_openssl.c:(.text+0x344): undefined reference to X509_free' ../../libaziotsharedutil.a(x509_openssl.c.o): In functionload_alias_key_cert':
x509_openssl.c:(.text+0x374): undefined reference to BIO_new_mem_buf' x509_openssl.c:(.text+0x3b8): undefined reference toPEM_read_bio_PrivateKey'
x509_openssl.c:(.text+0x3f4): undefined reference to SSL_CTX_use_PrivateKey' x509_openssl.c:(.text+0x470): undefined reference toEVP_PKEY_free'
x509_openssl.c:(.text+0x478): undefined reference to BIO_free' ../../libaziotsharedutil.a(x509_openssl.c.o): In functionload_private_key_RSA':
x509_openssl.c:(.text+0x4c8): undefined reference to BIO_new_mem_buf' x509_openssl.c:(.text+0x50c): undefined reference toPEM_read_bio_RSAPrivateKey'
x509_openssl.c:(.text+0x548): undefined reference to SSL_CTX_use_RSAPrivateKey' x509_openssl.c:(.text+0x580): undefined reference toRSA_free'
x509_openssl.c:(.text+0x588): undefined reference to BIO_free' ../../libaziotsharedutil.a(x509_openssl.c.o): In functionx509_openssl_add_certificates':
x509_openssl.c:(.text+0xa1c): undefined reference to SSL_CTX_get_cert_store' x509_openssl.c:(.text+0xa50): undefined reference toBIO_s_mem'
x509_openssl.c:(.text+0xa88): undefined reference to BIO_new' x509_openssl.c:(.text+0xac4): undefined reference toBIO_puts'
x509_openssl.c:(.text+0xb1c): undefined reference to X509_STORE_add_cert' x509_openssl.c:(.text+0xb2c): undefined reference toERR_peek_error'
x509_openssl.c:(.text+0xb60): undefined reference to X509_free' x509_openssl.c:(.text+0xb6c): undefined reference toX509_free'
x509_openssl.c:(.text+0xb88): undefined reference to PEM_read_bio_X509' x509_openssl.c:(.text+0xbc4): undefined reference toBIO_free'
../../libaziotsharedutil.a(crt_abstractions.c.o): In function splitFloatString': crt_abstractions.c:(.text+0x10b8): undefined reference topow'
crt_abstractions.c:(.text+0x1150): undefined reference to pow' ../../libaziotsharedutil.a(crt_abstractions.c.o): In functionstrtof_s':
crt_abstractions.c:(.text+0x127c): undefined reference to pow' ../../libaziotsharedutil.a(crt_abstractions.c.o): In functionstrtold_s':
crt_abstractions.c:(.text+0x158c): undefined reference to `pow'
collect2: ld returned 1 exit status
c-utility/samples/iot_c_utility/CMakeFiles/iot_c_utility.dir/build.make:95: set di istruzioni per l'obiettivo "c-utility/samples/iot_c_utility/iot_c_utility" non riuscito
make[2]: *** [c-utility/samples/iot_c_utility/iot_c_utility] Errore 1
CMakeFiles/Makefile2:1056: set di istruzioni per l'obiettivo "c-utility/samples/iot_c_utility/CMakeFiles/iot_c_utility.dir/all" non riuscito
make[1]: *** [c-utility/samples/iot_c_utility/CMakeFiles/iot_c_utility.dir/all] Errore 2
Makefile:140: set di istruzioni per l'obiettivo "all" non riuscito
make: *** [all] Errore 2
I'm trying to figure out what library or link directive I'm missing because I think I'm not referencing a compiled library in the correct way, but I wasn't able to find the solution yet.
Is there someone who already solved a similar problem?
Use VERBOSE=1 to get the output from the linker.
It looks like you are missing to link against libssl and libcrypto
I'm trying to build OpenSSL. If I build it with make (1 thread), it compiles okay. But if I build it with 3 threads (make -j3), I get LOTS of linker errors:
bntest.o: In function `message':
bntest.c:(.text+0x30): undefined reference to `BIO_puts'
bntest.c:(.text+0x3b): undefined reference to `BIO_puts'
bntest.o: In function `test_add':
bntest.c:(.text+0xe2): undefined reference to `BN_init'
bntest.c:(.text+0xec): undefined reference to `BN_init'
bntest.c:(.text+0xf6): undefined reference to `BN_init'
bntest.c:(.text+0x107): undefined reference to `BN_bntest_rand'
bntest.c:(.text+0x119): undefined reference to `BN_print'
bntest.c:(.text+0x126): undefined reference to `BIO_puts'
bntest.c:(.text+0x156): undefined reference to `BN_add'
bntest.c:(.text+0x166): undefined reference to `BN_add'
bntest.c:(.text+0x191): undefined reference to `BN_bntest_rand'
bntest.c:(.text+0x1d3): undefined reference to `BN_add'
bntest.c:(.text+0x1f5): undefined reference to `BN_print'
bntest.c:(.text+0x202): undefined reference to `BIO_puts'
bntest.c:(.text+0x20f): undefined reference to `BN_print'
bntest.c:(.text+0x21c): undefined reference to `BIO_puts'
bntest.c:(.text+0x264): undefined reference to `BN_free'
bntest.c:(.text+0x26e): undefined reference to `BN_free'
bntest.c:(.text+0x278): undefined reference to `BN_free'
bntest.o: In function `test_sub':
bntest.c:(.text+0x2af): undefined reference to `BN_init'
bntest.c:(.text+0x2b9): undefined reference to `BN_init'
bntest.c:(.text+0x2c3): undefined reference to `BN_init'
bntest.c:(.text+0x2e0): undefined reference to `BN_bntest_rand'
bntest.c:(.text+0x322): undefined reference to `BN_sub'
...and so on, for hundreds of lines...
To be clear, the exact sequence of commands I ran is:
$ wget https://www.openssl.org/source/openssl-1.0.1l.tar.gz
$ tar -xzf openssl-1.0.1l.tar.gz
$ cd openssl-1.0.1l
$ ./config
$ make -j3
I'm on Ubuntu 14.10 on an x64 machine.
This might be an RTFM-type question, but I haven't been able to see anywhere that says building OpenSSL with multiple threads is not supported.
So the question: Is building OpenSSL with multiple threads supported? If so, what am I doing wrong?
As MadScientist's comment indicates a makefile has to be designed to support parallel builds. Apparently OpenSSL is supposed to support parallel make but one of their bug reports shows that this support has on a few occasions been broken. This bug was most recently marked as fixed on December 12th, 2014, so it's possible that using a newer version of OpenSSL will fix the problem you've encountered.
I am trying to access png pixel data in my C code on. I found this library libpng. I downloaded latest version from this site, I am using Ubuntu 14.04. I followed the instructions in the INSTALL file. Everything went well. And then I tried to compile with gcc this piece of code. But I received this:
/tmp/ccWa9LDO.o: In function `read_png_file':
test.c:(.text+0x13c): undefined reference to `png_sig_cmp'
test.c:(.text+0x16f): undefined reference to `png_create_read_struct'
test.c:(.text+0x1a0): undefined reference to `png_create_info_struct'
test.c:(.text+0x1db): undefined reference to `png_set_longjmp_fn'
test.c:(.text+0x20c): undefined reference to `png_init_io'
test.c:(.text+0x220): undefined reference to `png_set_sig_bytes'
test.c:(.text+0x239): undefined reference to `png_read_info'
test.c:(.text+0x252): undefined reference to `png_get_image_width'
test.c:(.text+0x271): undefined reference to `png_get_image_height'
test.c:(.text+0x290): undefined reference to `png_get_color_type'
test.c:(.text+0x2af): undefined reference to `png_get_bit_depth'
test.c:(.text+0x2c4): undefined reference to `png_set_interlace_handling'
test.c:(.text+0x2e3): undefined reference to `png_read_update_info'
test.c:(.text+0x2fc): undefined reference to `png_set_longjmp_fn'
test.c:(.text+0x36f): undefined reference to `png_get_rowbytes'
test.c:(.text+0x3b2): undefined reference to `png_read_image'
/tmp/ccWa9LDO.o: In function `write_png_file':
test.c:(.text+0x430): undefined reference to `png_create_write_struct'
test.c:(.text+0x461): undefined reference to `png_create_info_struct'
test.c:(.text+0x49c): undefined reference to `png_set_longjmp_fn'
test.c:(.text+0x4cd): undefined reference to `png_init_io'
test.c:(.text+0x4e6): undefined reference to `png_set_longjmp_fn'
test.c:(.text+0x559): undefined reference to `png_set_IHDR'
test.c:(.text+0x572): undefined reference to `png_write_info'
test.c:(.text+0x58b): undefined reference to `png_set_longjmp_fn'
test.c:(.text+0x5bf): undefined reference to `png_write_image'
test.c:(.text+0x5d8): undefined reference to `png_set_longjmp_fn'
test.c:(.text+0x607): undefined reference to `png_write_end'
/tmp/ccWa9LDO.o: In function `process_file':
test.c:(.text+0x692): undefined reference to `png_get_color_type'
test.c:(.text+0x6be): undefined reference to `png_get_color_type'
test.c:(.text+0x6db): undefined reference to `png_get_color_type'
collect2: error: ld returned 1 exit status
I don't understand it because I would expect that if there is problem with installation I would get errors just for including png.h.
You said in the comments that you use gcc my_code.c, try
gcc my_code.c -lpng
The -l flag links a library, in this case libpng12-dev.
Linking means that your compiler adds the code from all the object files to create a single executable file. The object files are the separate compiled source code files (the .o files).
I don't know english very well, but I will try to help you.
I was getting this issues about 2 days, the solution is so simple, let's see.
try to do this: gcc my_code.c -lpng
afterwards you will get some file like a.out, then you need to have some picture png in same directory.
after, type this: ./a.out png_file.png res.png
The output file will be called res.png.
I think you installed only the PNG processing library. You will have to install the header files that can reference the library installed. So Install 'dev' package also like this
sudo apt-get install libpng12-dev
We are building a project that requires log4c to be linked in the static mode, the following is part of the linker error that is being generated.
/usr/local/lib/liblog4c.a(domnode-expat.o): In function `sd_domnode_read':
/log4c-1.2.1/src/sd/domnode-expat.c:316: undefined reference to `XML_ParserCreate'
/log4c-1.2.1/src/sd/domnode-expat.c:324: undefined reference to `XML_SetCommentHandler'
/log4c-1.2.1/src/sd/domnode-expat.c:325: undefined reference to `XML_SetUserData'
/log4c-1.2.1/src/sd/domnode-expat.c:327: undefined reference to `XML_Parse'
/log4c-1.2.1/src/sd/domnode-expat.c:355: undefined reference to `XML_ParserFree'
/log4c-1.2.1/src/sd/domnode-expat.c:328: undefined reference to `XML_GetErrorCode'
/log4c-1.2.1/src/sd/domnode-expat.c:328: undefined reference to `XML_ErrorString'
/usr/local/lib/liblog4c.a(domnode-expat.o): In function `sd_domnode_fread':
/log4c-1.2.1/src/sd/domnode-expat.c:242: undefined reference to `XML_ParserCreate'
/log4c-1.2.1/src/sd/domnode-expat.c:250: undefined reference to `XML_SetCommentHandler'
/log4c-1.2.1/src/sd/domnode-expat.c:251: undefined reference to `XML_SetUserData'
/log4c-1.2.1/src/sd/domnode-expat.c:258: undefined reference to `XML_GetBuffer'
/log4c-1.2.1/src/sd/domnode-expat.c:268: undefined reference to `XML_ParseBuffer'
/log4c-1.2.1/src/sd/domnode-expat.c:301: undefined reference to `XML_ParserFree'
/log4c-1.2.1/src/sd/domnode-expat.c:269: undefined reference to `XML_GetErrorCode'
/log4c-1.2.1/src/sd/domnode-expat.c:269: undefined reference to `XML_ErrorString'
collect2: ld returned 1 exit status
Off hand it seems to be missing libexpat.a, but libexpat.a is on the build machine and Eclipse is configured to find it. We have built libexpat.a with the --disable-shared parm to ./configure with no success.
Any ideas?
The solution to the static link issue is to set the linking order of the libraries to other libs
log4c
expat
pthread
This should allow log4c to link in the static mode.