Operating System - HP-UX
1753863 Members
7514 Online
108809 Solutions
New Discussion юеВ

diffutils-2.8.7 __strtoull Unsatisfied Symbol

 
SOLVED
Go to solution
Kevin Schultz
Advisor

diffutils-2.8.7 __strtoull Unsatisfied Symbol

Dear ITRC forums community:

Thanks again for all your help.

If you are willing and able, would you please help me understand this root cause of this problem? I am compiling diffutils-2.8.7 and get this error:

gcc -O -o cmp cmp.o ../lib/libdiffutils.a
ld: Unsatisfied symbol "__strtoull" in file ../lib/libdiffutils.a[xstrtoumax.o]

I am using gcc 4.0.0:

gcc -v
Using built-in specs.
Target: hppa64-hp-hpux11.00
Configured with: ../gcc-4.0.0/configure --prefix=/usr/local/pa20_64 --enable-threads --enable-threads=posix95 --with-gnu-as --with-as=/usr/local/pa20_64/bin/as --disable-nls --with-gmp=/usr/local/pa20_64 --with-mpfr=/usr/local/pa20_64 --disable-shared --enable-languages=c,c++
Thread model: posix95
gcc version 4.0.0

on HP-UX 11.00:

uname -a
HP-UX voltaire B.11.00 U 9000/785 2015073023 unlimited-user license

I downloaded the HP-UX Porting and Archive Center source code for 11.11, and that code compiles with the HP ANSI C compiler...so I think that means that __strtoull exists (please correct me if I am mistaken).

nm -A on /usr/lib/libc.a returns:

sh # nm -A libc.a | grep __strtoull
libc.a:S$3$__strtoull| 1416|static|data |$LIT$
libc.a:__strtoull | 0|extern|entry |$CODE$

I think that is where strtoull is defined. Am I correct?

I wrote a small test program:

1 /* gcc -v % -I/usr/include -L/usr/lib -lc */
2 #include
3 #include
4
5 int main(int argc, char argv[])
6 {
7 __strtoull(NULL,NULL,0);
8 return 1;
9 }

When I run the file in my terminal window, I get this response:

:!gcc -v foo.c -I/usr/include -L/usr/lib -lc
Using built-in specs.
Target: hppa64-hp-hpux11.00
Configured with: ../gcc-4.0.0/configure --prefix=/usr/local/pa20_64 --enable-threads --enable-threads=posix95 --with-gnu-as --with-as=/usr/local/pa20_64/bin/as --disable-nls --with-gmp=/usr/local/pa20_64 --with-mpfr=/usr/local/pa20_64 --disable-shared --enable-languages=c,c++
Thread model: posix95
gcc version 4.0.0
/projects/local/pa20_64/bin/../libexec/gcc/hppa64-hp-hpux11.00/4.0.0/cc1 -quiet -v -I/usr/include -iprefix /projects/local/pa20_64/bin/../lib/gcc/hppa64-hp-hpux11.00/4.0.0/ foo.c -quiet -dumpbase foo.c -auxbase foo -version -o /var/tmp//ccLls3Kk.s
ignoring nonexistent directory "/projects/local/pa20_64/bin/../lib/gcc/hppa64-hp-hpux11.00/4.0.0/../../../../hppa64-hp-hpux11.00/include"
ignoring nonexistent directory "/usr/local/include"
ignoring duplicate directory "/usr/local/pa20_64/lib/gcc/hppa64-hp-hpux11.00/4.0.0/include"
ignoring nonexistent directory "/usr/local/pa20_64/lib/gcc/hppa64-hp-hpux11.00/4.0.0/../../../../hppa64-hp-hpux11.00/include"
ignoring duplicate directory "/usr/include"
as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
/projects/local/pa20_64/bin/../lib/gcc/hppa64-hp-hpux11.00/4.0.0/include
/usr/local/pa20_64/include
/usr/include
End of search list.
GNU C version 4.0.0 (hppa64-hp-hpux11.00)
compiled by GNU C version 4.0.0.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
/usr/local/pa20_64/bin/as --traditional-format -o /var/tmp//cciDAfJE.o /var/tmp//ccLls3Kk.s
/projects/local/pa20_64/bin/../libexec/gcc/hppa64-hp-hpux11.00/4.0.0/collect2 +Accept TypeMismatch -z -E -u main /usr/ccs/lib/pa20_64/crt0.o /projects/local/pa20_64/bin/../lib/gcc/hppa64-hp-hpux11.00/4.0.0/crtbegin.o -L/usr/lib -L/projects/local/pa20_64/bin/../lib/gcc/hppa64-hp-hpux11.00/4.0.0 -L/projects/local/pa20_64/bin/../lib/gcc -L/usr/local/pa20_64/lib/gcc/hppa64-hp-hpux11.00/4.0.0 -L/projects/local/pa20_64/bin/../lib/gcc/hppa64-hp-hpux11.00/4.0.0/../../../../hppa64-hp-hpux11.00/lib -L/usr/local/pa20_64/lib/gcc/hppa64-hp-hpux11.00/4.0.0/../../../../hppa64-hp-hpux11.00/lib -L/usr/ccs/bin -L/usr/ccs/lib/pa20_64 -L/opt/langtools/lib/pa20_64 -L/projects/local/pa20_64/bin/../lib/gcc/hppa64-hp-hpux11.00/4.0.0/../../.. -L/usr/local/pa20_64/lib/gcc/hppa64-hp-hpux11.00/4.0.0/../../.. -L/lib/pa20_64 -L/usr/lib/pa20_64 /var/tmp//cciDAfJE.o -lc -lgcc -lc /usr/lib/pa20_64/milli.a -lgcc /projects/local/pa20_64/bin/../lib/gcc/hppa64-hp-hpux11.00/4.0.0/crtend.o
ld: Unsatisfied symbol "__strtoull" in file /var/tmp//cciDAfJE.o
1 errors.
collect2: ld returned 1 exit status

shell returned 1

Thank you for any help.


Best regards,



Kevin
7 REPLIES 7
Kevin Schultz
Advisor

Re: diffutils-2.8.7 __strtoull Unsatisfied Symbol

Dear ITRC community forums,

I mentioned above that the diffutils code compiled under HP ANSI C. This is true for 32-bit but not 64-bit, as I just verified. I forgot to pass the +DD64 flag the first time.

I am feeling confused because I want to understand what is going on. The stubs seem to exist in libc.a, but still no success.

Best regards,



Kevin
Kevin Schultz
Advisor

Re: diffutils-2.8.7 __strtoull Unsatisfied Symbol

Dear ITRC forum community:

Just had a realization that I was linking against 32-bit apps in /usr/lib. The libs I want are in /usr/lib/pa20_64. So feeling hopeful (because I want to succeed at this) I modified my test file:

1 /* gcc -v % -I/usr/include -L/usr/lib/pa20_64 -lc */
2 #include
3 #include
4
5 int main(int argc, char argv[])
6 {
7 __strtoull(NULL,NULL,0);
8 return 1;
9 }

yet this produced the same error:

:!gcc -v foo.c -I/usr/include -L/usr/lib/pa20_64 -lc
[No write since last change]
Using built-in specs.
Target: hppa64-hp-hpux11.00
Configured with: ../gcc-4.0.0/configure --prefix=/usr/local/pa20_64 --enable-threads --enable-threads=posix95 --with-gnu-as --with-as=/usr/local/pa20_64/bin/as --disable-nls --with-gmp=/usr/local/pa20_64 --with-mpfr=/usr/local/pa20_64 --disable-shared --enable-languages=c,c++
Thread model: posix95
gcc version 4.0.0
/projects/local/pa20_64/bin/../libexec/gcc/hppa64-hp-hpux11.00/4.0.0/cc1 -quiet -v -I/usr/include -iprefix /projects/local/pa20_64/bin/../lib/gcc/hppa64-hp-hpux11.00/4.0.0/ foo.c -quiet -dumpbase foo.c -auxbase foo -version -o /var/tmp//cchmo52h.s
ignoring nonexistent directory "/projects/local/pa20_64/bin/../lib/gcc/hppa64-hp-hpux11.00/4.0.0/../../../../hppa64-hp-hpux11.00/include"
ignoring nonexistent directory "/usr/local/include"
ignoring duplicate directory "/usr/local/pa20_64/lib/gcc/hppa64-hp-hpux11.00/4.0.0/include"
ignoring nonexistent directory "/usr/local/pa20_64/lib/gcc/hppa64-hp-hpux11.00/4.0.0/../../../../hppa64-hp-hpux11.00/include"
ignoring duplicate directory "/usr/include"
as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
/projects/local/pa20_64/bin/../lib/gcc/hppa64-hp-hpux11.00/4.0.0/include
/usr/local/pa20_64/include
/usr/include
End of search list.
GNU C version 4.0.0 (hppa64-hp-hpux11.00)
compiled by GNU C version 4.0.0.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
/usr/local/pa20_64/bin/as --traditional-format -o /var/tmp//ccS3amyN.o /var/tmp//cchmo52h.s
/projects/local/pa20_64/bin/../libexec/gcc/hppa64-hp-hpux11.00/4.0.0/collect2 +Accept TypeMismatch -z -E -u main /usr/ccs/lib/pa20_64/crt0.o /projects/local/pa20_64/bin/../lib/gcc/hppa64-hp-hpux11.00/4.0.0/crtbegin.o -L/usr/lib/pa20_64 -L/projects/local/pa20_64/bin/../lib/gcc/hppa64-hp-hpux11.00/4.0.0 -L/projects/local/pa20_64/bin/../lib/gcc -L/usr/local/pa20_64/lib/gcc/hppa64-hp-hpux11.00/4.0.0 -L/projects/local/pa20_64/bin/../lib/gcc/hppa64-hp-hpux11.00/4.0.0/../../../../hppa64-hp-hpux11.00/lib -L/usr/local/pa20_64/lib/gcc/hppa64-hp-hpux11.00/4.0.0/../../../../hppa64-hp-hpux11.00/lib -L/usr/ccs/bin -L/usr/ccs/lib/pa20_64 -L/opt/langtools/lib/pa20_64 -L/projects/local/pa20_64/bin/../lib/gcc/hppa64-hp-hpux11.00/4.0.0/../../.. -L/usr/local/pa20_64/lib/gcc/hppa64-hp-hpux11.00/4.0.0/../../.. -L/lib/pa20_64 -L/usr/lib/pa20_64 /var/tmp//ccS3amyN.o -lc -lgcc -lc /usr/lib/pa20_64/milli.a -lgcc /projects/local/pa20_64/bin/../lib/gcc/hppa64-hp-hpux11.00/4.0.0/crtend.o
ld: Unsatisfied symbol "__strtoull" in file /var/tmp//ccS3amyN.o
1 errors.
collect2: ld returned 1 exit status

shell returned 1

Yuck!

I felt even worse to find out that nm -A reports:

schultkl@voltaire: /usr/lib/pa20_64 $ nm -A libc.a | grep -i strtoll
schultkl@voltaire: /usr/lib/pa20_64 $ nm -A libc.a | grep -i strtoull
schultkl@voltaire: /usr/lib/pa20_64 $

No 64-bit libraries with strtoull in /usr/lib/pa20_64.

If you are willing, please let me know if you have any ideas or suggestions.

Best regards,



Kevin
Stephen Keane
Honored Contributor

Re: diffutils-2.8.7 __strtoull Unsatisfied Symbol

Try

# gcc -O -o cmp cmp.o ../lib/libdiffutils.a -lc


Kevin Schultz
Advisor

Re: diffutils-2.8.7 __strtoull Unsatisfied Symbol

Dear Stephen,

Here is the result:

schultkl@voltaire: /projects/oss/pa20_64/objdir/src $ gcc -O -o cmp cmp.o ../lib/libdiffutils.a -lc
ld: Unsatisfied symbol "__strtoull" in file ../lib/libdiffutils.a[xstrtoumax.o]
1 errors.
collect2: ld returned 1 exit status

Best regards,



Kevin
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: diffutils-2.8.7 __strtoull Unsatisfied Symbol

A very easy fix suggests itself:

Download and modify this source code:

http://darwinsource.opendarwin.org/10.3/tcl-14/tcl/compat/strtoul.c


All you need to do change the function from
unsigned long int
strtoul(string, endPtr, base)

to
unsigned long long strtoull(string, endPtr, base)

and


the variable declaration
from
register unsigned long int result = 0;

to

unsigned long long result = 0;

You then either add strtoull.o to a library or simply directly link strtoull.o to your other code.

I would also take the time to convert the K&R C to ANSI --- which should take you less than 2 minutes.
If it ain't broke, I can fix that.
Kevin Schultz
Advisor

Re: diffutils-2.8.7 __strtoull Unsatisfied Symbol

Hi A. Clay Stephenson,

Thanks for the tip, I am investigating now.

It seems like the root cause is that my HP-UX 11.00 libraries are out of date. Does HP supply patches to update C libraries?

Best regards,



Kevin
A. Clay Stephenson
Acclaimed Contributor

Re: diffutils-2.8.7 __strtoull Unsatisfied Symbol

Yes, search the patch database for libc or sometime ANSI/C and /or aCC run-time patches.
You might also do a seach for strtoull in the patch database.

This may or may not help you because I remember sometime back a question similar to yours looking for a long long version of the atol() function (convert an ASCII string to a long long) called atoll() and there was no such animal. It was trivially easy to code from scratch and that was the solution.
If it ain't broke, I can fix that.