bugGNU Gengetopt - Bugs: bug #34430, Build errors on Mac OS X 10.6.8

 
 

bug #34430: Build errors on Mac OS X 10.6.8

Submitted by:  None
Submitted on:  Thu 29 Sep 2011 02:40:15 AM UTC  
 
Category: NoneSeverity: 5 - Blocker
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Lorenzo Bettini <bettini>
Originator Name: Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Fri 02 Nov 2012 01:07:11 PM UTC, comment #11:

The original reported did not provide any feedback, however, I'm sure this was fixed also for test files, especially in this commit

http://git.savannah.gnu.org/cgit/gengetopt.git/commit/?h=devel&id=d4c9548d7f78052cf75055147eb031106a8adff9

Lorenzo Bettini <bettini>
Project AdministratorIn charge of this item.
Tue 27 Mar 2012 08:41:58 AM UTC, comment #10:

Yes, the patch is against the git repo. Without it we would get the redefinition error:

Alternatively include these lines
also in doc/main1.cc.

Anonymous
Tue 27 Mar 2012 07:58:08 AM UTC, comment #9:

Hi, but have you tried the latest git repository version? everything should compile fine now... or is the problem only in tests?

Lorenzo Bettini <bettini>
Project AdministratorIn charge of this item.
Tue 27 Mar 2012 07:16:40 AM UTC, comment #8:

I attached a quick'n'dirty fix for MacOSX. A proper fix (gl-redef-fix.diff) would probably involve not building and linking against gnulib at all, if the system's libc already supports getopt_long.

(file #25473)

Anonymous
Thu 10 Nov 2011 04:15:56 AM UTC, comment #7:

(I filed the original report.)

I'm maintaining a build script for gengetopt for the Homebrew package manager for Mac OS X, and encountered this during my normal "notice new version -> test build" cycle. So no rush or anything, I just wanted to make sure that someone upstream was aware of it.

Jack Nagel <jacknagel>
Thu 03 Nov 2011 05:19:13 PM UTC, comment #6:

I'll try to deal with that as soon as possible; however, these files are only built for testing purposes: by the time 'make' gets there the main gengetopt executable should have been already generated and you should be able to use gengetopt (if you want to use gengetopt personally); or do you need to build a binary package for Mac for OSX?

I'll try to fix tests as soon as possible anyway.

Lorenzo Bettini <bettini>
Project AdministratorIn charge of this item.
Thu 03 Nov 2011 11:55:25 AM UTC, comment #5:

Would also like a fix for this on OSX thanks.

make sample1
gcc -DHAVE_CONFIG_H -I. -I.. -I../gl -I../gl -g -O2 -MT cmdline1.o -MD -MP -MF .deps/cmdline1.Tpo -c -o cmdline1.o cmdline1.c
mv -f .deps/cmdline1.Tpo .deps/cmdline1.Po
g++ -DHAVE_CONFIG_H -I. -I.. -I../gl -I../gl -g -O2 -MT main1.o -MD -MP -MF .deps/main1.Tpo -c -o main1.o main1.cc
In file included from ../gl/unistd.h:98,
from /usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/os_defines.h:61,
from /usr/include/c++/4.2.1/i686-apple-darwin10/x86_64/bits/c++config.h:41,
from /usr/include/c++/4.2.1/iostream:44,
from main1.cc:5:
../gl/getopt.h:194: error: redefinition of ‘struct option’
/usr/include/getopt.h:54: error: previous definition of ‘struct option’
make[3]: *** [main1.o] Error 1
make[2]: *** [sample1.output.texinfo] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Rick Frank <rickfrank>
Thu 06 Oct 2011 05:12:31 AM UTC, comment #4:

Sorry for the delay.

This build now fails here:

/usr/bin/g++-4.2 -DHAVE_CONFIG_H -I. -I.. -I../gl -I../gl -O3 -march=prescott -mfpmath=sse -w -pipe -c -o main1.o main1.cc
In file included from ../gl/unistd.h:98,
from /usr/include/c++/4.2.1/i686-apple-darwin10/bits/os_defines.h:61,
from /usr/include/c++/4.2.1/i686-apple-darwin10/bits/c++config.h:41,
from /usr/include/c++/4.2.1/iostream:44,
from main1.cc:5:
../gl/getopt.h:194: error: redefinition of ‘struct option’
/usr/include/getopt.h:54: error: previous definition of ‘struct option’

(in doc/main1.cc).

Anonymous
Sat 01 Oct 2011 12:25:44 PM UTC, comment #3:

Please try the attached version, which should fix compilation problems.
If it works I'll release a new version.
Thanks

Lorenzo Bettini <bettini>
Project AdministratorIn charge of this item.
Thu 29 Sep 2011 09:17:09 PM UTC, comment #2:

Of course. By "three files" I meant the three affected gengetopt cpp source files.

Anonymous
Thu 29 Sep 2011 09:41:34 AM UTC, comment #1:

Hi

the lines

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

should be added to fileutils.cpp

NOT to the system header files!

I'll check this issue as soon as possible (probably those lines will have to be added to all .cpp files in gengetopt sources).

Lorenzo Bettini <bettini>
Project AdministratorIn charge of this item.
Thu 29 Sep 2011 02:40:15 AM UTC, original submission:

On Mac OS X 10.6.8 with gcc 4.2, building version 2.22.5 fails when compiling src/fileutils.cpp:

libtool: compile: /usr/bin/g++-4.2 -DHAVE_CONFIG_H -I. -I.. -I../gl -I../gl -O3 -march=prescott -mfpmath=sse -w -pipe -c fileutils.cpp -fno-common -DPIC -o .libs/fileutils.o
In file included from ../gl/unistd.h:98,
from /usr/include/c++/4.2.1/i686-apple-darwin10/bits/os_defines.h:61,
from /usr/include/c++/4.2.1/i686-apple-darwin10/bits/c++config.h:41,
from /usr/include/c++/4.2.1/cstdio:50,
from fileutils.cpp:13:
../gl/getopt.h:194: error: redefinition of ‘struct option’
/usr/include/getopt.h:54: error: previous definition of ‘struct option’

The same error happens when compiling src/acceptedvalues.cpp and doc/main1.cc.

Adding

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

to each of the three aformentioned files (as the first include) allows the build to complete successfully.

This problem is not present in 2.22.4.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #25473:  gl-redef-fix.diff added by None (1KiB - application/octet-stream)
file #24066:  gengetopt-2.22.6.tar.gz added by bettini (1007KiB - application/octet-stream - possible fix)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jacknagel (Posted a comment)
  • -unavailable- added by rickfrank (Posted a comment)
  • -unavailable- added by bettini (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 02 Nov 2012 01:07:11 PM UTCbettiniStatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
    Tue 27 Mar 2012 07:16:39 AM UTCNoneAttached File-=>Added gl-redef-fix.diff, #25473
    Sat 01 Oct 2011 12:24:39 PM UTCbettiniAttached File-=>Added gengetopt-2.22.6.tar.gz, #24066
    Thu 29 Sep 2011 09:42:16 AM UTCbettiniSeverity3 - Normal=>5 - Blocker
      StatusNone=>In Progress
      Assigned toNone=>bettini

    Back to the top


    Powered by Savane 3.1-cleanup1