Ronny has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I have an assignment about parallel port using perl.
I searched CPAN and found Device::ParallelPort.
Installing this module is successful.

But then I realized that it also requires Device::ParallelPort::drv::linux.
But when I run "make" for this module, I have this error message:

cc -c -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-s +trict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE +_OFFSET_BITS=64 -O2 -DVERSION=\"1.00\" -DXS_VERSION=\"1.00\" -fPIC +"-I/usr/lib/perl/5.8/CORE" linux.c In file included from linux.xs:2: /usr/lib/perl/5.8/CORE/perl.h:420:24: error: sys/types.h: No such file + or directory /usr/lib/perl/5.8/CORE/perl.h:451:19: error: ctype.h: No such file or +directory /usr/lib/perl/5.8/CORE/perl.h:463:23: error: locale.h: No such file or + directory /usr/lib/perl/5.8/CORE/perl.h:480:20: error: setjmp.h: No such file or + directory /usr/lib/perl/5.8/CORE/perl.h:486:26: error: sys/param.h: No such file + or directory /usr/lib/perl/5.8/CORE/perl.h:491:23: error: stdlib.h: No such file or + directory /usr/lib/perl/5.8/CORE/perl.h:496:23: error: unistd.h: No such file or + directory /usr/lib/perl/5.8/CORE/perl.h:776:23: error: string.h: No such file or + directory /usr/lib/perl/5.8/CORE/perl.h:925:27: error: netinet/in.h: No such fil +e or directory /usr/lib/perl/5.8/CORE/perl.h:929:26: error: arpa/inet.h: No such file + or directory /usr/lib/perl/5.8/CORE/perl.h:939:25: error: sys/stat.h: No such file +or directory /usr/lib/perl/5.8/CORE/perl.h:961:21: error: time.h: No such file or d +irectory /usr/lib/perl/5.8/CORE/perl.h:968:25: error: sys/time.h: No such file +or directory /usr/lib/perl/5.8/CORE/perl.h:975:27: error: sys/times.h: No such file + or directory /usr/lib/perl/5.8/CORE/perl.h:982:19: error: errno.h: No such file or +directory /usr/lib/perl/5.8/CORE/perl.h:997:25: error: sys/socket.h: No such fil +e or directory /usr/lib/perl/5.8/CORE/perl.h:1024:21: error: netdb.h: No such file or + directory /usr/lib/perl/5.8/CORE/perl.h:1127:24: error: sys/ioctl.h: No such fil +e or directory /usr/lib/perl/5.8/CORE/perl.h:1156:23: error: dirent.h: No such file o +r directory In file included from /usr/lib/gcc/i486-linux-gnu/4.1.3/include/syslim +its.h:7, from /usr/lib/gcc/i486-linux-gnu/4.1.3/include/limits +.h:11, from /usr/lib/perl/5.8/CORE/perl.h:1510, from linux.xs:2: /usr/lib/gcc/i486-linux-gnu/4.1.3/include/limits.h:122:61: error: limi +ts.h: No such file or directory In file included from /usr/lib/perl/5.8/CORE/perl.h:2120, from linux.xs:2: /usr/lib/perl/5.8/CORE/handy.h:136:25: error: inttypes.h: No such file + or directory


.... and so on.


my code:

#!/usr/bin/perl use Device::ParallelPort; use Device::ParallelPort::drv::linux; my $parport = Device::ParallelPort->new('linux'); $parport->set_byte(0, char(255));


I'm a newbie to UNIX system and perl, but very eager to learn. Please shed some light on this problem.

Replies are listed 'Best First'.
Re: Device::ParallelPort::drv::linux make problem
by shmem (Chancellor) on Nov 24, 2007 at 10:51 UTC
    This is a problem within the build environment of your OS: the system header files in /usr/include are missing. Depending on the OS type, they are in separate installable packages; on Fedora Linux they are in the glibc-headers rpm.

    Consult your system documentation about ways to get and install them. I could probably have told you more, but since you didn't post your OS type and version, you'll have to find out yourself.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re: Device::ParallelPort::drv::linux make problem
by okram (Monk) on Nov 24, 2007 at 09:40 UTC

    Hi

    You have to install glibc-devel and maybe kernel-headers too. If make still gives errors then install libstdc++-devel as well.

    Your problem is not with Perl, but with the C (XS) part of that module

    Depending on which Linux distribution you have, those packages might be called in different names as well..

    Let me know how you get on with it ;)

Re: Device::ParallelPort::drv::linux make problem
by Ronny (Initiate) on Nov 26, 2007 at 01:48 UTC
    Thank you for the answers, monks ;)
    I'll be sure to update after I tried the solution.
Re: Device::ParallelPort::drv::linux make problem
by Ronny (Initiate) on Nov 29, 2007 at 08:09 UTC
    I've installed the necessary packages and now my problem is solved. BTW, I'm using Ubuntu.

    At first, it still has an error message, cannot find asm/io.h. Since I don't know what package to install to fix that in Ubuntu, I changed the linux.xs file includes to sys/io.h.

    Again, thank you monks!