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
|
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.
|
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?
|
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)
|
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.
|
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.
|
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
|
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).
|
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
|
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.
|
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).
|
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.
|