LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   undefined reference to `__isoc99_sscanf' (https://www.linuxquestions.org/questions/programming-9/undefined-reference-to-%60__isoc99_sscanf-873058/)

harishisnow 04-05-2011 04:01 AM

undefined reference to `__isoc99_sscanf'
 
Hello,

When I compile my code in Linux (ATCA machine), I am getting the following error:

/vobs/ims_do/lib/rhlinux/debug/libnem-dummy_td2.so: undefined reference to `__isoc99_sscanf'

The same code is being compiled in Solaris without any problems.
Please help me find a solution.

Regards,
Harish

Sergei Steshenko 04-05-2011 04:42 AM

Quote:

Originally Posted by harishisnow (Post 4314335)
...When I compile...

You think we here possess telepathic abilities here and know command line(s) you've used ?

A likely cause is that standard "C" library is missing, but if that's the case, the question is "why ?". I.e. typically linker know that it's needed.

Try to add '-lc' to your command line.

Nominal Animal 04-05-2011 11:25 AM

Quote:

Originally Posted by harishisnow (Post 4314335)
/vobs/ims_do/lib/rhlinux/debug/libnem-dummy_td2.so: undefined reference to `__isoc99_sscanf'

You have glibc version prior to 2.7 installed, and are using libraries (ffmpeg?) which were compiled against glibc 2.7. The __isoc99_sscanf was added to glibc in version 2.7.

You'll need to check which static library file (*.a) refers to that symbol, and recompile it. You can use command
Code:

objdump -t path-to-library.a | grep -e __isoc99_sscanf
to find which library refers to that symbol.

Alternatively, you can upgrade your c library to version 2.7 or newer. If you're using Debian or Ubuntu, upgrading package libc6-dev to at least 2.7 should be enough.

If the error message referred to an unversioned symbol (i.e. the error message did not refer to __isoc99_sscanf@@GLIBC...), then you could write a __isoc99_sscanf wrapper using stdargs and GNU sscanf (their differences being usually insignificant) and include that in the linking.

noahzarc 07-27-2012 12:45 PM

Quote:

Originally Posted by Nominal Animal (Post 4314731)
You have glibc version prior to 2.7 installed, and are using libraries (ffmpeg?) which were compiled against glibc 2.7. The __isoc99_sscanf was added to glibc in version 2.7.

You'll need to check which static library file (*.a) refers to that symbol, and recompile it. You can use command
Code:

objdump -t path-to-library.a | grep -e __isoc99_sscanf
to find which library refers to that symbol.

Alternatively, you can upgrade your c library to version 2.7 or newer. If you're using Debian or Ubuntu, upgrading package libc6-dev to at least 2.7 should be enough.

If the error message referred to an unversioned symbol (i.e. the error message did not refer to __isoc99_sscanf@@GLIBC...), then you could write a __isoc99_sscanf wrapper using stdargs and GNU sscanf (their differences being usually insignificant) and include that in the linking.

Could you give out some hints about "__isoc99_sscanf wrapper using stdargs and GNU sscanf"?

Thanks!

Metal-forth 07-31-2012 09:24 AM

Hi guys
New one here..
I am also having the same problem installing Nagios Plugins..


ssl -lcrypto -lpthread -ldl
libtool: link: gcc -DNP_VERSION=\"1.4.16\" -g -O2 -o check_http check_http.o sslutils.o netutils.o utils.o -L/root/downloads/nagios-plugins-1.4.16/plugins -L/usr/local/ssl/lib ../lib/libnagiosplug.a ../gl/libgnu.a -lnsl -lresolv -lssl -lcrypto -lpthread -ldl
/usr/local/ssl/lib/libcrypto.a(v3_utl.o): In function `ipv6_cb':
v3_utl.c:(.text+0x2d9): undefined reference to `__isoc99_sscanf'
/usr/local/ssl/lib/libcrypto.a(v3_utl.o): In function `a2i_ipadd':
v3_utl.c:(.text+0x125d): undefined reference to `__isoc99_sscanf'
/usr/local/ssl/lib/libcrypto.a(v3_utl.o): In function `a2i_IPADDRESS':
v3_utl.c:(.text+0x135f): undefined reference to `__isoc99_sscanf'
/usr/local/ssl/lib/libcrypto.a(v3_utl.o): In function `a2i_IPADDRESS_NC':
v3_utl.c:(.text+0x19df): undefined reference to `__isoc99_sscanf'
v3_utl.c:(.text+0x1a77): undefined reference to `__isoc99_sscanf'
collect2: ld returned 1 exit status
make[1]: *** [check_http] Error 1
make[1]: Leaving directory `/root/downloads/nagios-plugins-1.4.16/plugins'
make: *** [install-recursive] Error 1


Any ideas similar ideas??

MadanKumarNath 04-07-2015 04:38 AM

undefined reference to `__isoc99_fscanf'
 
Use -D_GNU_SOURCE to compile. It will resolve the issue.

Thanks
Madan


All times are GMT -5. The time now is 10:10 PM.