Problem with compiling gengetopt on OpenSolaris

View: New views
6 Messages — Rating Filter:   Alert me  

Problem with compiling gengetopt on OpenSolaris

by Lukas Rovensky :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: Problem with compiling gengetopt on OpenSolaris

by Lorenzo Bettini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Lukas

thanks for your patch!
Actually another Opensolaris user experienced this problem, which seems
to be due to how flex library is implemented in opensolaris (by googling
a bit I had found other similar problems, not related to gengetopt but
to programs using flex in open solaris);  I wasn't able to find a
solution since I can't reproduce the problem in linux (and I don't have
opensolaris).  Yours seems to be the solution!

However, I'd like to try to get rid of the flex library which is
basically not used by gengetopt; I'll try to provide you with a new
version to test.

cheers
        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
> Help-gengetopt@...
> http://lists.gnu.org/mailman/listinfo/help-gengetopt


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: Problem with compiling gengetopt on OpenSolaris

by Lorenzo Bettini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
> Help-gengetopt@...
> http://lists.gnu.org/mailman/listinfo/help-gengetopt


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: Problem with compiling gengetopt on OpenSolaris

by Lukas Rovensky :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
>> Help-gengetopt@...
>> http://lists.gnu.org/mailman/listinfo/help-gengetopt
>
>



_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: Problem with compiling gengetopt on OpenSolaris

by Lorenzo Bettini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
>>> Help-gengetopt@...
>>> http://lists.gnu.org/mailman/listinfo/help-gengetopt
>>
>>
>
>
>
> _______________________________________________
> Help-gengetopt mailing list
> Help-gengetopt@...
> http://lists.gnu.org/mailman/listinfo/help-gengetopt


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt

Re: Problem with compiling gengetopt on OpenSolaris

by Lukas Rovensky :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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
>>>> Help-gengetopt@...
>>>> http://lists.gnu.org/mailman/listinfo/help-gengetopt
>>>
>>>
>>
>>
>>
>> _______________________________________________
>> Help-gengetopt mailing list
>> Help-gengetopt@...
>> http://lists.gnu.org/mailman/listinfo/help-gengetopt
>
>



_______________________________________________
Help-gengetopt mailing list
Help-gengetopt@...
http://lists.gnu.org/mailman/listinfo/help-gengetopt