lestrrat-p5 / ZMQ

libzmq Perl binding
46 stars 31 forks source link

ZMQ-LibCZMQ1 Bool -> bool #34

Open maage opened 11 years ago

maage commented 11 years ago

This is something I'm not sure that this is proper fix. But I needed this to make it work at RHEL5/RHEL6.

diff -ur ZMQ-LibCZMQ1-0.03-/src/perl_czmq.xs ZMQ-LibCZMQ1-0.03/src/perl_czmq.xs
--- ZMQ-LibCZMQ1-0.03-/src/perl_czmq.xs 2013-01-09 07:31:05.000000000 +0200
+++ ZMQ-LibCZMQ1-0.03/src/perl_czmq.xs  2013-05-12 15:57:38.000000000 +0300
@@ -232,7 +232,7 @@
     OUTPUT:
         RETVAL

-Bool
+bool
 zsocket_poll( socket, msecs)
         PerlLibCZMQ1_zsocket_raw *socket;
         int msecs;
@@ -591,7 +591,7 @@
 zframe_strdup(frame)
         PerlLibCZMQ1_zframe *frame;

-Bool
+bool
 zframe_streq(frame, string)
         PerlLibCZMQ1_zframe *frame;
         char *string;
@@ -600,7 +600,7 @@
 zframe_more(frame)
         PerlLibCZMQ1_zframe *frame;

-Bool
+bool
 zframe_eq(self, other)
         PerlLibCZMQ1_zframe *self;
         PerlLibCZMQ1_zframe *other;
diff -ur ZMQ-LibCZMQ1-0.03-/tools/genfiles.pl ZMQ-LibCZMQ1-0.03/tools/genfiles.pl
--- ZMQ-LibCZMQ1-0.03-/tools/genfiles.pl        2013-01-07 11:32:42.000000000 +0200
+++ ZMQ-LibCZMQ1-0.03/tools/genfiles.pl 2013-05-12 15:56:56.000000000 +0300
@@ -166,7 +166,7 @@
     my (@decl, @input, @output);

     push @decl, "const void * T_PV";
-    push @decl, "Bool         T_BOOL";
+    push @decl, "bool         T_BOOL";
     push @decl, "byte *       T_PV";
     push @decl, "PerlLibCZMQ1_zsocket_raw* PERLCZMQ_ZSOCKET_RAW";
     push @input, <<EOM;
lestrrat commented 11 years ago

Why? This didn't work for you? it's in the typemap.

maage commented 11 years ago

Bool is undeclared and then gcc is confused.

make
cp lib/ZMQ/LibCZMQ1.pm blib/lib/ZMQ/LibCZMQ1.pm
/usr/bin/perl "-Iinc" /usr/lib/perl5/vendor_perl/5.8.8/ExtUtils/xsubpp  -typemap /usr/lib/perl5/5.8.8/ExtUtils/typemap  src/perl_czmq.xs > src/perl_czmq.xsc && mv src/perl_czmq.xsc src/perl_czmq.c
gcc -c  "-I."  "-Isrc" "-I." -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -Wall -Wextra -Wdeclaration-after-statement -Wc++-compat -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic   -DVERSION=\"0.03\" -DXS_VERSION=\"0.03\" -o src/perl_czmq.o -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE"  -DUSE_PPPORT -DHAS_ZSOCKET_MAXMSGSIZE -DHAS_ZSOCKET_RCVHWM -DHAS_ZSOCKET_SET_MAXMSGSIZE -DHAS_ZSOCKET_SET_RCVHWM -DHAS_ZSOCKET_SET_SNDHWM -DHAS_ZSOCKET_SNDHWM src/perl_czmq.c
src/perl_czmq.c: In function 'XS_ZMQ__LibCZMQ1_zsocket_poll':
src/perl_czmq.c:876: error: 'Bool' undeclared (first use in this function)
src/perl_czmq.c:876: error: (Each undeclared identifier is reported only once
src/perl_czmq.c:876: error: for each function it appears in.)
src/perl_czmq.c:876: error: expected ';' before 'RETVAL'
src/perl_czmq.c:916: error: 'RETVAL' undeclared (first use in this function)
src/perl_czmq.c: In function 'XS_ZMQ__LibCZMQ1_zframe_data':
src/perl_czmq.c:4062: warning: pointer targets in passing argument 3 of 'Perl_sv_setpv' differ in signedness
src/perl_czmq.c: In function 'XS_ZMQ__LibCZMQ1_zframe_streq':
src/perl_czmq.c:4282: error: 'Bool' undeclared (first use in this function)
src/perl_czmq.c:4282: error: expected ';' before 'RETVAL'
src/perl_czmq.c:4320: error: 'RETVAL' undeclared (first use in this function)
src/perl_czmq.c: In function 'XS_ZMQ__LibCZMQ1_zframe_eq':
src/perl_czmq.c:4399: error: 'Bool' undeclared (first use in this function)
src/perl_czmq.c:4399: error: expected ';' before 'RETVAL'
src/perl_czmq.c:4473: error: 'RETVAL' undeclared (first use in this function)
make: *** [src/perl_czmq.o] Error 1

It is there but somehow xsubpp does not get it properly.

% head src/typemap
# Do NOT edit this file! This file was automatically generated
# by Makefile.PL on Wed May 15 19:47:30 2013. If you want to
# regenerate it, remove this file and re-run Makefile.PL

TYPEMAP

const void * T_PV
Bool         T_BOOL
byte *       T_PV
PerlLibCZMQ1_zsocket_raw* PERLCZMQ_ZSOCKET_RAW

I tried to see if xsubpp does open it and it seems to.

jpoliv commented 11 years ago

I'm having the same building problem on a Fedora 18 x86_64 linux system.