GNOME Bugzilla – Bug 703885
[osx build] error: redefinition of typedef
Last modified: 2013-07-11 08:25:51 UTC
Created attachment 248748 [details] [review] rewrite forward declarations gst-1.0 building gst-plugins-gl on macosx mountain lion gives errors: "redefinition of typedef" I am using macports to build gstreamer See the 2 attached patchs. 0001-cocoa-fix-build-when-GNUSTEP-is-not-defined.patch 0002-build-fix-repeated-typedefs.patch The first one is not really related to the subject of this bug but it helps to build it. In the last one I wrote "forward declarations" in an other way. I would like to have your review before to push it. Cheers, Julien
Created attachment 248749 [details] [review] fix cocoa build
Comment on attachment 248748 [details] [review] rewrite forward declarations I don't think that's the correct solution to this. What exactly is the problem? Circular header includes?
Yes circular header includes. I only get the complier error with i686-apple-darwin11-llvm-gcc-4.2. It seems to reject the current use of forward declaration.
Ah, so the Apple compiler does not like duplicated typedefs? I wonder why we don't have that in GStreamer, I'm sure the same is used there in some places for circular includes... Is it a compiler warning or an error? And which are the circular includes and types involved?
(In reply to comment #4) > Ah, so the Apple compiler does not like duplicated typedefs? Yes: The one that comes with Xcode to build apps on ios (Iphone/Ipad) i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) Using built-in specs. Target: i686-apple-darwin11 Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1 Thread model: posix gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) Same result when using Xcode and making a C project for OSX: "redefinition of typedef is a C11 feature". And it seems that the apple compiler does not support C11 I do not have the error with gcc that comes from macports: gcc-mp-4.7 (MacPorts gcc47 4.7.3_1) 4.7.3 Using built-in specs. COLLECT_GCC=gcc-mp-4.7 COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin12/4.7.3/lto-wrapper Target: x86_64-apple-darwin12 Configured with: ../gcc-4.7.3/configure --prefix=/opt/local --build=x86_64-apple-darwin12 --enable-languages=c,c++,objc,obj-c++,lto,fortran,java --libdir=/opt/local/lib/gcc47 --includedir=/opt/local/include/gcc47 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.7 --with-libiconv-prefix=/opt/local --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.7 --with-gxx-include-dir=/opt/local/include/gcc47/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-ppl=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl --disable-cloog-version-check --enable-stage1-checking --disable-multilib --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --disable-ppl-version-check --with-pkgversion='MacPorts gcc47 4.7.3_1' Thread model: posix gcc version 4.7.3 (MacPorts gcc47 4.7.3_1) > I wonder why we > don't have that in GStreamer, I'm sure the same is used there in some places > for circular includes... I thought too so I did a quick search and I could not find one example from GStreamer. > > Is it a compiler warning or an error? And which are the circular includes and > types involved? Apparently GstGLDisplay, GstGLWindow, GstGLShader, GstGLDownload etc ... Also I forgot to add lot of files in my patch, so a new patch follows!
Maybe add a single file with all the typedefs then instead of adding 20 files :)
Created attachment 248820 [details] [review] rewrite forward declarations
Please put all the forward declarations into a single file. Also gl/gstgl.h should probably be gl/gl.h for consistency with the other gstreamer include-all headers.
Created attachment 248841 [details] [review] fix cocoa build
Created attachment 248842 [details] [review] rewrite forward declarations
commit 5ced1567c070636372486adf3aa0371df5a12b13 Author: Julien Isorce <julien.isorce@gmail.com> Date: Wed Jul 10 16:03:04 2013 +0100 build: fix repeated typedefs Write forward declarations in another way to avoid repeated typedefs "error: redefinition of typedef". Raised when using i686-apple-darwin11-llvm-gcc-4.2 It seems that C apple compiler does not support C11 feature. https://bugzilla.gnome.org/show_bug.cgi?id=703885 commit 6a98bc46bd4a10296d3ec03443eba817612f20c2 Author: Julien Isorce <julien.isorce@gmail.com> Date: Wed Jul 10 15:47:23 2013 +0100 cocoa: fix build when GNUSTEP is not defined