Re: Problem with compiling gengetopt on OpenSolaris

Lukas Rovensky <[email protected]> Fri, 29 May 2009 18:19:58 +0200
Newsgroups gmane.comp.gnu.gengetopt.general
Message-ID <[email protected]>
No problem + thanks for your help ... Cheers, Lukas

Lorenzo Bettini napsal(a):
> sorry, I forgot to answer: I plan to release this patched version soon 
> (it basically contains only bug fixes)
> 
> Lukas Rovensky wrote:
>> Hi Lorenzo,
>>
>> thanks a lot for both your e-mails.  I just tried the fixed version 
>> and it compiles on my OpenSolaris box without any problems (I tried 
>> again both gcc and SunStudio cc).  When do you plan to have this fixed 
>> version publicly available (gengetopt 2.22.2)?
>>
>> Thanks,
>> Lukas
>>
>> Lorenzo Bettini wrote:
>>> Hi there
>>>
>>> I've uploaded a possibly fixed version here:
>>>
>>> http://rap.dsi.unifi.it/~bettini/gengetopt-2.22.1.tar.gz
>>>
>>> this does not depend on flex library anymore, so you shouldn't 
>>> experience this bug.
>>>
>>> please let me know
>>>
>>> thanks in advance
>>>     Lorenzo
>>>
>>> Lukas Rovensky wrote:
>>>> Hi there,
>>>>
>>>> I tried to compile gengetopt 2.22 on OpenSolaris 2008.11 (both using 
>>>> gcc/g++ and SunStudio cc/CC) and I got the following error during 
>>>> linking:
>>>>
>>>> g++ -g -O2 -o gengetopt parser.o scanner.o argsdef.o cmdline.o 
>>>> gengetopt.o gm.o yyerror.o gm_utils.o fileutils.o acceptedvalues.o 
>>>> ggos.o  ../gl/.libs/libgnu.a -lfl skels/.libs/libgen.a 
>>>> /usr/sfw/lib/libstdc++.so -L/usr/sfw/lib -lgcc_s -lm   -Wl,-R 
>>>> -Wl,/usr/sfw/lib -Wl,-R -Wl,/usr/sfw/lib
>>>> ld: warning: file /usr/sfw/lib/libstdc++.so: attempted multiple 
>>>> inclusion of file
>>>> Undefined            first referenced
>>>>  symbol                  in file
>>>> yylex                               /usr/lib/libfl.so
>>>> ld: fatal: Symbol referencing errors. No output written to gengetopt
>>>> collect2: ld returned 1 exit status
>>>>
>>>> The problem is that C++ compiler creates "mangled" symbol name for 
>>>> yylex:
>>>>
>>>> lukas@myspulin:~/Desktop/t/gengetopt-2.22.1$ elfdump src/scanner.o | 
>>>> grep yylex
>>>>       [99]  0x00000828 0x000000f7  FUNC GLOB  D    0 .text 
>>>> _Z13yylex_destroyv
>>>>      [111]  0x000009c8 0x00000eab  FUNC GLOB  D    0 .text _Z5yylexv
>>>> lukas@myspulin:~/Desktop/t/gengetopt-2.22.1$ elfdump src/parser.o | 
>>>> grep yylex
>>>>       [81]  0x00000000 0x00000000  NOTY GLOB  D    0 UNDEF _Z5yylexv
>>>>   R_386_PC32                    0xcf2             .rel.text      
>>>> _Z5yylexv
>>>>
>>>> While the libfl.so expects just "yylex".  I solved this issue by 
>>>> wrapping the lines declaring yylex function like:
>>>>
>>>> #ifdef __cplusplus
>>>>     extern "C" {
>>>> #endif
>>>> extern int yylex(int);
>>>> #ifdef __cplusplus
>>>>     }
>>>> #endif
>>>>
>>>> in the files parser.cc and scanner.cc.
>>>>
>>>> However, when I compiled gengetopt on Ubuntu 8.10 then the code got 
>>>> compiled and linked without any modifications.
>>>>
>>>> Am I doing something wrong (missing some parameter for configure, 
>>>> etc.)?  I will definitely appreciate any advise.
>>>>
>>>> Another option -- would you be eventually willing to accept a simple 
>>>> patch adding the "#ifdef __cplusplus ..." guards, so gengetopt can 
>>>> get directly compiled on OpenSolaris?
>>>>
>>>> Thanks for any help.
>>>>
>>>> Kind regards,
>>>> Lukas
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Help-gengetopt mailing list
>>>> [email protected]
>>>> http://lists.gnu.org/mailman/listinfo/help-gengetopt
>>>
>>>
>>
>>
>>
>> _______________________________________________
>> Help-gengetopt mailing list
>> [email protected]
>> http://lists.gnu.org/mailman/listinfo/help-gengetopt
> 
>