Hi,
I've run cytypesgen successfully for the Assimilation project for 12
different Linux platforms (including Fedora 21 and 22). So, many
thanks!
Recently I started porting on Fedora 23. There are two issues -
possibly related - possibly not...
I use cmake to generate the bindings and do the building. On F23, I
get these results...
[ 76%] Generating
../cma/AssimCtypes.py
('Running', 'ctypesgen.py "--no-macro-warnings" "--cpp=gcc
-E -DCTYPESGEN -D__signed__=signed" "-o"
"/root/assimilation/src/cma/AssimCtypes.py"
"--runtime-libdir" "/root/assimilation/src/clientlib"
"--compile-libdir" "/root/assimilation/src/clientlib"
"-I/root/assimilation/src/include" "-L" "-lglib-2.0" "-l"
"libassimilationclientlib.so" "-I/usr/include/glib-2.0"
"-I/usr/lib64/glib-2.0/include"
"-I/root/assimilation/src/include"
"-I/root/assimilation/src/include"
"/usr/include/glib-2.0/glib.h"
"/root/assimilation/src/include/frametypes.h"
"/root/assimilation/src/include/framesettypes.h"
"/root/assimilation/src/include/projectcommon.h"
"/root/assimilation/src/include/address_family_numbers.h"
"/root/assimilation/src/include/resourcecmd.h"
"/root/assimilation/src/include/tlvhelper.h"
"/root/assimilation/src/include/authlistener.h"
"/root/assimilation/src/include/resourceocf.h"
"/root/assimilation/src/include/childprocess.h"
"/root/assimilation/src/include/seqnoframe.h"
"/root/assimilation/src/include/server_dump.h"
"/root/assimilation/src/include/jsondiscovery.h"
"/root/assimilation/src/include/resourcelsb.h"
"/root/assimilation/src/include/hbsender.h"
"/root/assimilation/src/include/cryptcurve25519.h"
"/root/assimilation/src/include/cstringframe.h"
"/root/assimilation/src/include/cmalib.h"
"/root/assimilation/src/include/misc.h"
"/root/assimilation/src/include/discovery.h"
"/root/assimilation/src/include/resourcequeue.h"
"/root/assimilation/src/include/gmainfd.h"
"/root/assimilation/src/include/tlv_valuetypes.h"
"/root/assimilation/src/include/cryptframe.h"
"/root/assimilation/src/include/netioudp.h"
"/root/assimilation/src/include/netio.h"
"/root/assimilation/src/include/netaddr.h"
"/root/assimilation/src/include/arpdiscovery.h"
"/root/assimilation/src/include/logsourcefd.h"
"/root/assimilation/src/include/packetdecoder.h"
"/root/assimilation/src/include/pcap_GSource.h"
"/root/assimilation/src/include/assimobj.h"
"/root/assimilation/src/include/fsqueue.h"
"/root/assimilation/src/include/nvpairframe.
h" "/root/assimilation/src/include/compressframe.h"
"/root/assimilation/src/include/reliableudp.h"
"/root/assimilation/src/include/generic_tlv_min.h"
"/root/assimilation/src/include/resourcenagios.h"
"/root/assimilation/src/include/proj_classes.h"
"/root/assimilation/src/include/configcontext.h"
"/root/assimilation/src/include/fsprotocol.h"
"/root/assimilation/src/include/frame.h"
"/root/assimilation/src/include/nanoprobe.h"
"/root/assimilation/src/include/pcap_min.h"
"/root/assimilation/src/include/unknownframe.h"
"/root/assimilation/src/include/listener.h"
"/root/assimilation/src/include/lldp.h"
"/root/assimilation/src/include/addrframe.h"
"/root/assimilation/src/include/frameset.h"
"/root/assimilation/src/include/hblistener.h"
"/root/assimilation/src/include/cdp.h"
"/root/assimilation/src/include/ipportframe.h"
"/root/assimilation/src/include/intframe.h"
"/root/assimilation/src/include/signframe.h"
"/root/assimilation/src/include/netgsource.h"
"/root/assimilation/src/include/switchdiscovery.h"')
Status: Preprocessing /tmp/tmpQRWHfU.h
Status: gcc -E -DCTYPESGEN -D__signed__=signed -U __GNUC__
-dD -I/root/assimilation/src/include -I/usr/include/glib-2.0
-I/usr/lib64/glib-2.0/include
-I/root/assimilation/src/include
-I/root/assimilation/src/include "-Dinline=" "-D__inline__="
"-D__extension__=" "-D_Bool=uint8_t" "-D__const=const"
"-D__asm__(x)=" "-D__asm(x)=" "-DCTYPESGEN=1"
/tmp/tmpQRWHfU.h
Status: Parsing /tmp/tmpQRWHfU.h
Error:
/usr/lib/gcc/x86_64-redhat-linux/5.3.1/include/stddef.h:427:
Syntax error at '__attribute__'
Error:
/usr/lib/gcc/x86_64-redhat-linux/5.3.1/include/stddef.h:427:
Syntax error at '('
Error:
/usr/lib/gcc/x86_64-redhat-linux/5.3.1/include/stddef.h:428:
Syntax error at '__attribute__'
Error:
/usr/lib/gcc/x86_64-redhat-linux/5.3.1/include/stddef.h:428:
Syntax error at '('
Status: Processing description list.
Status: Writing to
/root/assimilation/src/cma/AssimCtypes.py.
Status: Wrapping complete.
[ 78%] Built target generate_ctypes_src
And later on, when I run the test code, I get crashes in the C code
called from the Python (in my tests) - immediately after crossing
the Python/C boundary via ctypes. Here's the version of gcc
involved:
# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/5.3.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto
--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enab
le-shared --enable-threads=posix --enable-checking=release
--enable-multilib --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id --with-linker-hash-style=
gnu --enable-plugin --enable-initfini-array --disable-libgcj
--with-isl --enable-libmpx --enable-gnu-indirect-function
--with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 5.3.1 20151207 (Red Hat 5.3.1-2) (GCC)
Here are the relevant lines from stddef.h:
419 #if
(defined (__STDC_VERSION__)
&& __STDC_VERSION__ >= 201112L) \
420 ||
(defined(__cplusplus) && __cplusplus >= 201103L)
421 #ifndef
_GCC_MAX_ALIGN_T
422 #define
_GCC_MAX_ALIGN_T
423 /* Type
whose alignment is supported in every context and is at
least
424 as
great as that of any standard type not using alignment
425 specifiers.
*/
426 typedef struct {
427 long long
__max_align_ll __attribute__((__aligned__(__alignof__(long long))));
428 long double
__max_align_ld __attribute__((__aligned__(__alignof__(long double))));
429 }
max_align_t;
430 #endif
431 #endif /* C11 or
C++11. */
This is the exact same code which passes tests on 12 other versions
of Linux :-(. The build methods for all the Fedora versions are
identical. But I get these different results - whether in Docker or
a VM. The outputs from the two generated python files have the same
number of lines and are very similar - but not identical. The
obvious differences are that some anonymous things (enums, structs)
have different number in the generated names.
Any thoughts?