Reputation: 41
I can't compile, I use Ubuntu on Odroid-XU4 plate. How can I fix this problem? Thanks for any help.
odroid@odroid:~/Desktop/curl_test.2$ g++ -o postit2 postit2.c -lcurl
/tmp/cc4MoKQE.o: In function `main':
postit2.c:(.text+0x2c): undefined reference to `curl_mime_init'
postit2.c:(.text+0x36): undefined reference to `curl_mime_addpart'
postit2.c:(.text+0x48): undefined reference to `curl_mime_name'
postit2.c:(.text+0x56): undefined reference to `curl_mime_filedata'
postit2.c:(.text+0xfa): undefined reference to `curl_mime_free'
collect2: error: ld returned 1 exit status
odroid@odroid:~/Desktop/curl_test.2$ curl --version
curl 7.56.0 (armv7l-unknown-linux-gnueabihf) libcurl/7.47.0
OpenSSL/1.0.2g zlib/1.2.8 libidn/1.32 librtmp/2.3
Release-Date: 2017-10-04
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps
pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM
NTLM_WB SSL libz TLS-SRP UnixSockets
Upvotes: 4
Views: 3181
Reputation: 120229
configure
is --prefix=`.-I<directory-to-install>/include
and the linker option is -L<directory-to-install>/lib
. -Wl,-rpath=<directory-where-libcurl.so-lives-at-run-time>
. Unless you are compiling for a different machine, this is the same directory where libcurl.so is installed, so you might end up specifying the same directory twice, with -L and -Wl,-rpath options.Upvotes: 1
Reputation: 856
Linker looks for libcurl in its configured path and it finds old version first.
Edit /etc/ld.so.conf
to make the linker looks for in directory with new libculr version.
Or reinstall libcurl:
sudo apt-get remove libcurl
wget http://curl.haxx.se/download/curl-7.56.0.tar.gz
./configure
make
make install
Upvotes: 0