Discussion:
[GCC-XML] Compiling gccxml with homebrewed gcc4.9
michkapopoff
2014-10-18 20:56:12 UTC
Permalink
Hi

I am trying to use gccxml with homebrewed gcc4.9 on OS X 10.9.
Seems I am not able to build it. I don?t know if it?s a cmake problem or a gccxml problem
(or the way gcc is installed with homebrew).

Cmake was called with:
cmake -DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc/4.9.1/bin/g++-4.9 -DCMAKE_C_COMPILER=/usr/local/Cellar/gcc/4.9.1/bin/gcc-4.9


-- Check size of unsigned short
-- Check size of unsigned short - failed
-- Check size of unsigned int
-- Check size of unsigned int - failed
-- Check size of unsigned long
-- Check size of unsigned long - failed
CMake Error at /usr/local/Cellar/cmake/3.0.2/share/cmake/Modules/TestBigEndian.cmake:51 (message):
no suitable type found
Call Stack (most recent call first):
GCC/config_cmake/CMakeLists.txt:158 (TEST_BIG_ENDIAN)


-- Configuring incomplete, errors occurred!
See also "/Users/michkapopoff/repo/builds/mini-iw/gccxml/src/GCC_XML-build/CMakeFiles/CMakeOutput.log".
See also "/Users/michkapopoff/repo/builds/mini-iw/gccxml/src/GCC_XML-build/CMakeFiles/CMakeError.log".
make[2]: *** [gccxml/src/GCC_XML-stamp/GCC_XML-configure] Error 1
make[1]: *** [CMakeFiles/GCC_XML.dir/all] Error 2
make: *** [all] Error 2


Here are the CMakeError.log and CMakeOutput.log files.

https://gist.github.com/iMichka/6761702a580681f92994
https://gist.github.com/iMichka/f890a890a7acf4db15bf

I think the error is coming from: gcc-4.9: error: unrecognized command line option '-no-cpp-precomp?
Don?t know though where this flag is added ?

Thanks in advance

Michka

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/gccxml/attachments/20141018/38676c5a/attachment.html>
Brad King
2014-10-20 13:20:50 UTC
Permalink
Post by michkapopoff
I think the error is coming from: gcc-4.9: error: unrecognized command
line option '-no-cpp-precomp?
That is in gccxml in GCC/CMakeLists.txt:

IF(APPLE AND CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang)$")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -no-cpp-precomp")
ENDIF()

It looks like the addition of that flag dates back to 2003 so
I suspect it is no longer necessary. Try dropping that block.

-Brad
michkapopoff
2014-10-20 15:17:32 UTC
Permalink
I removed the flag and it is ok. Cmake went to the end of the configuration step, and I was able to compile gccxml.

The tests are all failing, here is the first one (the others are failing with the same error):

1: Test command: /Users/michkapopoff/repo/builds/gccxml/bin/gccxml "-I/Users/michkapopoff/repo/builds/gccxml/GCC_XML/GXFront" "-I/Users/michkapopoff/repo/builds/gccxml/GCC_XML" "-I/Users/michkapopoff/repo/builds/gccxml/GCC_XML/GXFront" "-I/Users/michkapopoff/repo/gccxml/GCC_XML/GXFront" "/Users/michkapopoff/repo/gccxml/GCC_XML/GXFront/gxConfiguration.cxx" "-fxml=gxConfiguration.cxx.gcc.xml"
1: Test timeout computed to be: 1500
1: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/wchar.h:90,
1: from /usr/local/Cellar/gcc/4.9.1/lib/gcc/x86_64-apple-darwin13.4.0/4.9.1/include/c++/cwchar:44,
1: from /usr/local/Cellar/gcc/4.9.1/lib/gcc/x86_64-apple-darwin13.4.0/4.9.1/include/c++/bits/postypes.h:40,
1: from /usr/local/Cellar/gcc/4.9.1/lib/gcc/x86_64-apple-darwin13.4.0/4.9.1/include/c++/iosfwd:40,
1: from /Users/michkapopoff/repo/builds/gccxml/GCC_XML/gxsys/ios/iosfwd:23,
1: from /Users/michkapopoff/repo/builds/gccxml/GCC_XML/gxsys/SystemTools.hxx:15,
1: from /Users/michkapopoff/repo/gccxml/GCC_XML/GXFront/gxSystemTools.h:22,
1: from /Users/michkapopoff/repo/gccxml/GCC_XML/GXFront/gxConfiguration.h:20,
1: from /Users/michkapopoff/repo/gccxml/GCC_XML/GXFront/gxConfiguration.cxx:17:
1: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/stdio.h:274: error: wrong number of arguments specified for 'deprecated' attribute
1: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/stdio.h:389: error: wrong number of arguments specified for 'deprecated' attribute
1/11 Test #1: gxConfiguration.cxx ..............***Failed 0.67 sec

I added a -DCMAKE_OSX_SYSROOT=?? flag when running cmake, to make sure it does not try to find the OS X SDK folder, but that did not help (because even if I ask cmake to use gcc49, it will look for the OS X SDK):

ccmake -DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc/4.9.1/bin/g++-4.9 -DCMAKE_C_COMPILER=/usr/local/Cellar/gcc/4.9.1/bin/gcc-4.9 -DCMAKE_OSX_SYSROOT=""

Here are the locations of the stdio.h files:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/c++/4.2.1/tr1/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/sys/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/c++/4.2.1/tr1/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/sys/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/tr1/stdio.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/stdio.h
/usr/local/Cellar/gcc/4.9.1/lib/gcc/x86_64-apple-darwin13.4.0/4.9.1/include/c++/tr1/stdio.h
/usr/local/Cellar/gcc/4.9.1/lib/gcc/x86_64-apple-darwin13.4.0/4.9.1/include/ssp/stdio.h

Michka
Post by Brad King
Post by michkapopoff
I think the error is coming from: gcc-4.9: error: unrecognized command
line option '-no-cpp-precomp?
IF(APPLE AND CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang)$")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -no-cpp-precomp")
ENDIF()
It looks like the addition of that flag dates back to 2003 so
I suspect it is no longer necessary. Try dropping that block.
-Brad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/gccxml/attachments/20141020/2af94969/attachment.html>
Brad King
2014-10-20 15:29:23 UTC
Permalink
Post by michkapopoff
1: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/stdio.h:274: error: wrong number of arguments specified for 'deprecated' attribute
This is likely due to gccxml still using the GCC 4.2 parser
which does not understand such constructs. There has been
some discussion before about updating the internal parser,
but I have no time to do it myself.

-Brad
Mark Moll
2014-10-21 16:59:48 UTC
Permalink
I ran into the same problem. I have a hacky fix that at least makes the tests pass. After the build/install is completed, I patch ${prefix}/share/gccxml-0.9 to look like this:

GCCXML_COMPILER="/opt/local/bin/g++-mp-4.9"
GCCXML_CXXFLAGS="-m64 -pipe -Os -include /opt/local/share/gccxml-0.9/gccxml.h"

(As you can probably guess, I am using MacPorts, not HomeBrew.) The gccxml.h currently contains this:

#define __deprecated_msg(msg) deprecated
#undef __SIZEOF_INT128__
#define _POSIX_C_SOURCE 199506L
#define BOOST_MATH_DISABLE_FLOAT128 1
#define __atomic_thread_fence(order) {}
#define __atomic_signal_fence(order) {}

It is still a work in progress. I am trying to use gccxml with Py++ to generate python bindings. The code for which I am trying to generate bindings heavily relies on Boost. The installed version of Boost has been compiled with clang. This causes all kinds of problems. I am now stuck at this error:

xml_find_template_parm encountered unsupported type identifier_node
/opt/local/include/boost/ratio/detail/mpl/abs.hpp:83: sorry, unimplemented: call_expr cannot be mangled due to a defect in the C++ ABI
--
Mark Moll
Mark Moll
2014-10-21 18:54:25 UTC
Permalink
Here are couple more errors when parsing boost headers:

/opt/local/include/boost/unordered/detail/allocate.hpp:223: sorry, unimplemented: call_expr cannot be mangled due to a defect in the C++ ABI
/opt/local/include/boost/unordered/detail/allocate.hpp:223: sorry, unimplemented: call_expr cannot be mangled due to a defect in the C++ ABI
/opt/local/include/boost/math/constants/constants.hpp:90: sorry, unimplemented: call_expr cannot be mangled due to a defect in the C++ ABI

This is Boost 1.56 on OS X 10.10. The first error corresponds to this code:

template <typename T, T Value>
struct integral_constant { enum { value = Value }; };

which looks pretty harmless to me. I keep hoping that there is some magic combination of compile flags that will make everything just work. On OS X 10.9 I used llvm-gcc-4.2 to compile gccxml and as the compiler that gccxml would simulate. This all worked with the latest clang and boost on 10.9. Unfortunately, llvm-gcc-4.2 doesn?t compile on 10.10.
Post by Mark Moll
GCCXML_COMPILER="/opt/local/bin/g++-mp-4.9"
GCCXML_CXXFLAGS="-m64 -pipe -Os -include /opt/local/share/gccxml-0.9/gccxml.h"
#define __deprecated_msg(msg) deprecated
#undef __SIZEOF_INT128__
#define _POSIX_C_SOURCE 199506L
#define BOOST_MATH_DISABLE_FLOAT128 1
#define __atomic_thread_fence(order) {}
#define __atomic_signal_fence(order) {}
xml_find_template_parm encountered unsupported type identifier_node
/opt/local/include/boost/ratio/detail/mpl/abs.hpp:83: sorry, unimplemented: call_expr cannot be mangled due to a defect in the C++ ABI
--
Mark Moll
--
Mark Moll
Loading...