Thanks tye.
So I've made an attempt at this, but am still getting XS errors that I can't figure out, and am hoping I'm doing something blatantly wrong, or someone with understanding can spot something else. Here's my Makefile.PL:
use ExtUtils::MakeMaker; my %options = %{ { 'INC' => '-I/home/pi/repos/scripts/c/rpi/dht11/library -I/usr/local/ +lib -I/home/pi/repos/wiringPi/wiringPi', 'NAME' => 'perl_pl_b1a3', 'TYPEMAPS' => [ '/home/pi/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/ExtUtils/typ +emap' ], 'VERSION' => '0.00', 'CCFLAGS' => ' -fwrapv -fno-strict-aliasing -pipe -fstack-protector- +strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=6 +4 -D_FORTIFY_SOURCE=2 -lwiringPi' } }; WriteMakefile(%options); # Remove the Makefile dependency. Causes problems on a few systems. sub MY::makefile { '' }
The library I'm trying to load is wiringPi. I've tried also libwiringPi. I've also tried adding -I/usr/local/lib to the CCFLAGS, as well as -L/usr/local/lib. Here's the /usr/local/lib dir that I've included in INC:
libwiringPiDev.so -> libwiringPiDev.so.2.32 libwiringPiDev.so.2.32 libwiringPi.so -> libwiringPi.so.2.32 libwiringPi.so.2.32
...and the error:
Running Mkbootstrap for perl_pl_b1a3 () chmod 644 "perl_pl_b1a3.bs" cc -c -I/home/pi/repos/scripts/c/rpi/dht11/library -I/usr/local/lib - +I/home/pi/repos/wiringPi/wiringPi -fwrapv -fno-strict-aliasing -pipe +-fstack-protector-strong -I/usr/local/include -I/usr/local/lib -D_LAR +GEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -lwiringPi +-O2 -DVERSION=\"0.00\" -DXS_VERSION=\"0.00\" -fPIC "-I/home/pi/perl +5/perlbrew/perls/perl-5.24.0/lib/5.24.0/armv7l-linux/CORE" perl_pl_ +b1a3.c In file included from perl_pl_b1a3.xs:3:0: /home/pi/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.0/armv7l-linux/CORE +/XSUB.h:142:31: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute_ +_’ before ‘void’ # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unu +sed__) ^ perl_pl_b1a3.c:163:1: note: in expansion of macro ‘XS_EXTERNAL’ XS_EXTERNAL(boot_perl_pl_b1a3); /* prototype to pass -Wmissing-protot +ypes */ ^ Makefile:331: recipe for target 'perl_pl_b1a3.o' failed make: *** [perl_pl_b1a3.o] Error 1
It's like it's not finding the library or something, as I can reproduce this exact behaviour with this simple script, by trying to link to a non-existent library:
use warnings; use strict; use Inline C => Config => ccflagsex => '-lblah'; use Inline C => 'END'; say(); __END__ __C__ void say() { int x = myget(); printf("myvar: %d\n", x); }
In reply to Re^2: With Inline::C, how to link to external library? (XS)
by stevieb
in thread With Inline::C, how to link to external library?
by stevieb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |