Operating System - HP-UX
1834679 Members
2459 Online
110069 Solutions
New Discussion

ld: Unsatisfied symbol "getopt_long" in file

 
badversion
Visitor

ld: Unsatisfied symbol "getopt_long" in file

I am compling from source code. I am getting the below error. I have tried multiple things but nothing has worked.

ld: Unsatisfied symbol "getopt_long" in file ./.libs/liboathtool_cmd.a[liboathtool_cmd_la-oathtool_cmd.o]
1 error.
collect2: ld returned 1 exit status
*** Error exit code 1

Stop.
*** Error exit code 1

Stop.
*** Error exit code 1

Stop.
*** Error exit code 1

Stop.
*** Error exit code 1

 

6 REPLIES 6
Steven Schweda
Honored Contributor

Re: ld: Unsatisfied symbol "getopt_long" in file

> [...] I have tried multiple things [...]

   That's not very informative.

   I know nothing, but isn't getopt_long() a GNU libc feature?
Presumably, one could extract some getopt_long()-containing C source
code from the glibc source collection, rather than trying to build/find
the whole thing.

badversion
Visitor

Re: ld: Unsatisfied symbol "getopt_long" in file


@Steven Schweda wrote:

> [...] I have tried multiple things [...]

   That's not very informative.

   I know nothing, but isn't getopt_long() a GNU libc feature?
Presumably, one could extract some getopt_long()-containing C source
code from the glibc source collection, rather than trying to build/find
the whole thing.


I am sorry for the useless information I gave. I'll Describe my problem in Breif.

I am trying to compile oathtool from source code in HP-UX 11.31. While Compling I am getting the error ld: Unsatisfied symbol "getopt_long" in file. I am not trying to compile getopt_long.

Things to note -

I manually copy pasted the getopt.h from the web. As I couldn't find it in the HP-UX machine and had put it in the lib directory. 

Things I tried -

Tried Hashing it out in the Makefile.

tried manually running it with aCC

aclocal autoheader autoconf autoreconf and none worked till now.

Steven Schweda
Honored Contributor

Re: ld: Unsatisfied symbol "getopt_long" in file

> [...] I am not trying to compile getopt_long.

   You may need to.  If it's not in the HP-UX C RTL, and you don't have
the GNU C RTL, then compiling the source seems to me like the thing to
do.

> I manually copy pasted the getopt.h from the web.  [...]

   That's a start.  Keep going.

> [...] had put it in the lib directory.

   I'd keep it separate from the standard HP-UX files.  That may force
you to play with your compile (-I) and/or link (-L,-l) options, but I
wouldn't mess with the standard files.

> Things I tried -
> [...]

   If the code wants getopt_long(), then you need to change the code, or
else give it a getopt_long().  On a GNU/Linux system, you'd have the GNU
C RTL (glibc), which should include it.  On HP-UX, if it's not already
there, then you need to get it.

badversion
Visitor

Re: ld: Unsatisfied symbol "getopt_long" in file


@Steven Schweda wrote:

> [...] I am not trying to compile getopt_long.

   You may need to.  If it's not in the HP-UX C RTL, and you don't have
the GNU C RTL, then compiling the source seems to me like the thing to
do.

> I manually copy pasted the getopt.h from the web.  [...]

   That's a start.  Keep going.

> [...] had put it in the lib directory.

   I'd keep it separate from the standard HP-UX files.  That may force
you to play with your compile (-I) and/or link (-L,-l) options, but I
wouldn't mess with the standard files.

> Things I tried -
> [...]

   If the code wants getopt_long(), then you need to change the code, or
else give it a getopt_long().  On a GNU/Linux system, you'd have the GNU
C RTL (glibc), which should include it.  On HP-UX, if it's not already
there, then you need to get it.


I am not a developer. I just downloaded the source code from the website and compiled the code. It would be helpful if you could help elobrate on the solution.

 

Edit - So, I did do a little digging and found that the Makefile was excuting the below command

./libtool --silent --tag=CC --mode=link gcc -std=gnu99  -g -O2 -o oathtool oathtool.o gl/libgnu.la liboathtool_cmd.la

and throwing the exact below error while make-"ing".

libtool: link: gcc -std=gnu99 -g -O2 -o .libs/oathtool oathtool.o -L../liboath/.libs -loath gl/.libs/libgnu.a ./.libs/liboathtool_cmd.a -Wl,+b -Wl,/usr/local/lib
ld: Unsatisfied symbol "getopt_long" in file ./.libs/liboathtool_cmd.a[liboathtool_cmd_la-oathtool_cmd.o]
1 error.
collect2: ld returned 1 exit status

Steven Schweda
Honored Contributor

Re: ld: Unsatisfied symbol "getopt_long" in file

> I am not a developer.

   Find one?  Become one?

>  I just downloaded the source code from the website and compiled the
> code.

   Complain to the people who provide this package?

> It would be helpful if you could help elobrate on the solution.

   There's not much to elaborate.  The program uses getopt_long().  If
that's not provided in the HP-UX run-time libraries, then you would need
to provide it yourself.  You found getopt.h.  I'd guess that something.c
with getopt_long() in it shouldn't be far away.

   Assuming that "the website" is http://www.nongnu.org/oath-toolkit/ ,
I didn't notice anything there about operating systems where the program
is expected to run, so they may assume that if GNU/Linux has it, then
everyone else must have it, too.

> Edit - So, I did do a little digging [...]

   Yes, that's where it would happen.

Dennis Handly
Acclaimed Contributor

Re: ld: Unsatisfied symbol "getopt_long", missing Linux feature

> isn't getopt_long() a GNU libc feature?

 

Yes.  It would have to be ported.  Or converted to use getopt(3).