How to convert perl modules into deb packages? - linux

My team is delivering a product that requires some perl modules, and since we deliver a full OS installer (Ubuntu 12.04) we want those modules as .deb packages. I've been able to build some other perl (like Algorithm::LUHN, Env::C, Linux::PID and Config::Properties) by following the instructions here, but having problems with Apache2::SizeLimit
Tried with Apache-SizeLimit-0.96 and Apache-SizeLimit-0.97... and all the methods described in the doc. Also tried in different OSs versions; Ubuntu 14.04.2, Ubuntu 12.04.5 (clean install), all the attempts ended with the same error:
test#test:~$ dh-make-perl --build --cpan Apache::SizeLimit
Going to read '/home/test/.cpan/Metadata'
Database was generated on Thu, 19 Mar 2015 02:17:02 GMT
CPAN: Digest::SHA loaded ok (v5.61)
Checksum for /home/test/.cpan/sources/authors/id/P/PH/PHRED/Apache-SizeLimit-0.97.tar.gz ok
Apache-SizeLimit-0.97/
Apache-SizeLimit-0.97/Changes
Apache-SizeLimit-0.97/INSTALL
Apache-SizeLimit-0.97/lib/
Apache-SizeLimit-0.97/LICENSE
Apache-SizeLimit-0.97/Makefile.PL
Apache-SizeLimit-0.97/MANIFEST
Apache-SizeLimit-0.97/MANIFEST.SKIP
Apache-SizeLimit-0.97/META.json
Apache-SizeLimit-0.97/META.yml
Apache-SizeLimit-0.97/README
Apache-SizeLimit-0.97/t/
Apache-SizeLimit-0.97/t/apache/
Apache-SizeLimit-0.97/t/apache2/
Apache-SizeLimit-0.97/t/pod.t
Apache-SizeLimit-0.97/t/response/
Apache-SizeLimit-0.97/t/response/TestApache/
Apache-SizeLimit-0.97/t/response/TestApache2/
Apache-SizeLimit-0.97/t/response/TestApache2/basic.pm
Apache-SizeLimit-0.97/t/response/TestApache2/check_n_requests2.pm
Apache-SizeLimit-0.97/t/response/TestApache2/deprecated.pm
Apache-SizeLimit-0.97/t/response/TestApache2/zzz_check_n_requests.pm
Apache-SizeLimit-0.97/t/response/TestApache/basic.pm
Apache-SizeLimit-0.97/t/response/TestApache/check_n_requests2.pm
Apache-SizeLimit-0.97/t/response/TestApache/deprecated.pm
Apache-SizeLimit-0.97/t/response/TestApache/zzz_check_n_requests.pm
Apache-SizeLimit-0.97/t/apache2/all.t
Apache-SizeLimit-0.97/t/apache/all.t
Apache-SizeLimit-0.97/lib/Apache/
Apache-SizeLimit-0.97/lib/Apache2/
Apache-SizeLimit-0.97/lib/Apache2/SizeLimit.pm
Apache-SizeLimit-0.97/lib/Apache/SizeLimit/
Apache-SizeLimit-0.97/lib/Apache/SizeLimit.pm
Apache-SizeLimit-0.97/lib/Apache/SizeLimit/Core.pm
CPAN: File::Temp loaded ok (v0.22)
======================================================================
Unpacked tarball already existed, directory renamed to /home/test/Apache-SizeLimit-0.97.13910
======================================================================
Using META.json
Found: Apache2-SizeLimit 0.97 (libapache2-sizelimit-perl arch=all)
cat: /etc/mailname: No such file or directory
No APT contents can be loaded.
Please install 'apt-file' package (at least version 2.5.0) and
run 'apt-file update' as root.
Dependencies not updated.
Using maintainer: test
Found docs: README
cat: /etc/mailname: No such file or directory
Using rules: /usr/share/dh-make-perl/rules.dh7.tiny
cat: /etc/mailname: No such file or directory
make: Entering directory `/home/test/Apache-SizeLimit-0.97'
dh clean
dh_testdir
dh_auto_clean
dh_clean
make: Leaving directory `/home/test/Apache-SizeLimit-0.97'
make: Entering directory `/home/test/Apache-SizeLimit-0.97'
dh build
dh_testdir
dh_auto_configure
Can't find mod_perl installed
The error was: Can't locate mod_perl2.pm in #INC (#INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at Makefile.PL line 147.
dh_auto_configure: perl Makefile.PL INSTALLDIRS=vendor returned exit code 2
make: *** [build] Error 2
make: Leaving directory `/home/test/Apache-SizeLimit-0.97'
Cannot create deb package: 'debian/rules build' failed.
Will appreciate any help on fixing it

Sharing how it was solved. As #grant-mclean answered; I was missing a -dev package: the "apache2-dev" (apache2-threaded-dev).
With it, and skipping tests I was able to build the .deb package.
sudo apt-get install devscripts dh-make-perl libapache2-mod-perl2 libapache2-mod-perl2-dev apache2-threaded-dev
export DEB_BUILD_OPTIONS="$DEB_BUILD_OPTIONS nocheck"
dh-make-perl --build --cpan Apache::SizeLimit

Usually when you're trying to build something on Debian and get a message about something being missing, you need to install a 'dev' package - one that contains things like header files that aren't needed by the runtime.
I'm just guessing, but in your case perhaps you need to install: libapache2-mod-perl2-dev

Related

How to not use /usr/local/lib after uninstalling self build package?

Initially, I had pcl-1.10 in /usr/(installed using sudo apt install libpcl-dev). Then I self-built pcl-1.12 in /usr/local/ for some reason. Now I uninstalled pcl-1.12 using sudo make uninstall and wanted to use the default pcl-1.10. But when I compiled my project, the error message showed
$ colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
Starting >>> lidarslam_msgs
Starting >>> ndt_omp_ros2
--- stderr: ndt_omp_ros2
make[2]: *** No rule to make target '/usr/local/lib/libpcl_surface.so', needed by 'align'. Stop.
make[1]: *** [CMakeFiles/Makefile2:80: CMakeFiles/align.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---
Failed <<< ndt_omp_ros2 [0.16s, exited with code 2]
It seems that the PATH stills points to the /usr/local/lib even if I uninstalled the package. Is there a way I can reset PATH to the global package path? For this case, I believe the pcl-1.10's libpcl_surface.so is in /usr/lib/x86_64-linux-gnu/libpcl_outofcore.so .
I am working on ROS2 and compiling the CMakeList.txt using colcon. So I can't modify the makefile. I assume it is a PATH problem.
A way is to use symlink to link all the .so file in /usr/lib/x86_64-linux-gnu/ to /usr/local/lib but I found it kind of stupid...

Yocto bitbake build error when adding fftw package

I am using Yocto Warrior release to build linux for Dart-imx8m SOM. Documentation can be found here : https://variwiki.com/index.php?title=DART-MX8M_Yocto&release=RELEASE_WARRIOR_V1.1_DART-MX8M.
I want to add fftw package whose recipe is in meta-oe layer. Whenever I add this package in my local.conf file, I get an error with bitbake regarding a dnf related task.
I add the package like this in my local.conf file : IMAGE_INSTALL_append = " fftw"
I get the following error when building image with bitbake fsl-image-gui :
ERROR: fsl-image-gui-1.0-r0 do_rootfs: Could not invoke dnf. Command '/home/safetyn/safetynYoctoGenerator/warrior/var-fsl-yocto/build_xwayland/tmp/work/imx8mq_var_dart-poky-linux/fsl-image-gui/1.0-r0/recipe-sysroot-native/usr/bin/dnf -v --rpmverbosity=info -y -c /home/safetyn/safetynYoctoGenerator/warrior/var-fsl-yocto/build_xwayland/tmp/work/imx8mq_var_dart-poky-linux/fsl-image-gui/1.0-r0/rootfs/etc/dnf/dnf.conf --setopt=reposdir=/home/safetyn/safetynYoctoGenerator/warrior/var-fsl-yocto/build_xwayland/tmp/work/imx8mq_var_dart-poky-linux/fsl-image-gui/1.0-r0/rootfs/etc/yum.repos.d --installroot=/home/safetyn/safetynYoctoGenerator/warrior/var-fsl-yocto/build_xwayland/tmp/work/imx8mq_var_dart-poky-linux/fsl-image-gui/1.0-r0/rootfs --setopt=logdir=/home/safetyn/safetynYoctoGenerator/warrior/var-fsl-yocto/build_xwayland/tmp/work/imx8mq_var_dart-poky-linux/fsl-image-gui/1.0-r0/temp --repofrompath=oe-repo,/home/safetyn/safetynYoctoGenerator/warrior/var-fsl-yocto/build_xwayland/tmp/work/imx8mq_var_dart-poky-linux/fsl-image-gui/1.0-r0/oe-rootfs-repo --nogpgcheck install packagegroup-core-tools-profile packagegroup-fsl-tools-audio packagegroup-core-ssh-dropbear tree rpm packagegroup-fsl-tools-benchmark boost gstreamer1.0 packagegroup-fsl-tools-gpu packagegroup-fsl-gstreamer1.0 psplash gpsd packagegroup-base-extended collectd kernel-image-4.19.35-imx8mq+gdc7a2fd packagegroup-core-tools-testapps packagegroup-core-boot tcf-agent packagegroup-fsl-tools-gpu-external packagegroup-core-full-cmdline packagegroup-tools-bluetooth packagegroup-fsl-tools-testapps opencv fftw libsdl-1.2-0 packagegroup-fsl-gstreamer1.0-full lftp packagegroup-core-tools-debug libgpiod2 dnf weston-init run-postinsts mosquitto packagegroup-core-nfs-server sshfs-fuse spitools kernel-devicetree android-tools htop poco tmux openssh-sftp-server weston-xwayland xterm locale-base-en-us locale-base-en-gb' returned 1:
DNF version: 4.1.0
cachedir: /home/safetyn/safetynYoctoGenerator/warrior/var-fsl-yocto/build_xwayland/tmp/work/imx8mq_var_dart-poky-linux/fsl-image-gui/1.0-r0/rootfs/var/cache/dnf
Added oe-repo repo from /home/safetyn/safetynYoctoGenerator/warrior/var-fsl-yocto/build_xwayland/tmp/work/imx8mq_var_dart-poky-linux/fsl-image-gui/1.0-r0/oe-rootfs-repo
repo: using cache for: oe-repo
not found other for:
not found modules for:
not found deltainfo for:
not found updateinfo for:
oe-repo: using metadata from Wed 28 Oct 2020 09:16:57 AM UTC.
Last metadata expiration check: 0:00:01 ago on Wed 28 Oct 2020 09:16:57 AM UTC.
No module defaults found
No match for argument: fftw
Error: Unable to find a match
ERROR: fsl-image-gui-1.0-r0 do_rootfs:
ERROR: fsl-image-gui-1.0-r0 do_rootfs: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /home/safetyn/safetynYoctoGenerator/warrior/var-fsl-yocto/build_xwayland/tmp/work/imx8mq_var_dart-poky-linux/fsl-image-gui/1.0-r0/temp/log.do_rootfs.2614
ERROR: Task (/home/safetyn/safetynYoctoGenerator/warrior/var-fsl-yocto/sources/meta-fsl-bsp-release/imx/meta-sdk/recipes-fsl/images/fsl-image-gui.bb:do_rootfs) failed with exit code '1'
Woud you have any clue where this error come from ?
Thanks,
Paul
Edit :
Found a way to make it compile for those who are intereseted. (inspired by Yocto build for a static library fails with error "No Match Found")
I edited my *.bb file and added ALLOW_EMPTY_${PN} = "1"
I am not sure I got it completely but it looks like dnf package manager needs folders created for all added packages even if empty.
https://www.yoctoproject.org/docs/latest/ref-manual/ref-manual.html#var-ALLOW_EMPTY
The fftw recipe is set up to create a few different packages (RPM) like libfftw, libfftwl, libfftwf, fftw-wisdom, fftwl-wisdom, fftwf-wisdom, and fftw-wisdom-to-conf.
You probably want to add one or more of those. It seems there is no actual fftw package.
It is important to remember that IMAGE_INSTALL and RDEPEND lists items from the package namespace, while DEPENDS lists items from the recipe namespace.
If you are unsure about which package you want to install you can inspect the packages-split folder for fftw in tmp/work to see which files are included in which package.

Error installing nokogiri: Failed to build gem native extension

I want to execute the following command
bundle install && rake install
but an error comes up and I try to figure out whats going on. I found that i need to install nokogiri. But when I try to install it an error comes up again. Any ideas? :/
sudo gem install nokogiri -v '1.8.5'
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.5.0/gems/nokogiri-1.8.5/ext/nokogiri
/usr/bin/ruby2.5 -r ./siteconf20181210-12550-orku3c.rb extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
Using mini_portile version 2.3.0
checking for gzdopen() in -lz... no
zlib is missing; necessary for building libxml2
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)2.5
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-1.8.5/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.5.0/gems/nokogiri-1.8.5 for inspection.
Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/nokogiri-1.8.5/gem_make.out

How to build OpenSSH with no dependence on OpenSSL?

I am trying to build OpenSSH 7.3 without OpenSSL.
I ran $ ./configure --without-openssl.
And then running either $ make OPENSSL=no or $ make give the following error:
In file included from ../entropy.h:30:0,
from ../includes.h:174,
from arc4random.c:27:
../buffer.h:50:29: fatal error: openssl/objects.h: No such file or directory
compilation terminated.
make[1]: *** [arc4random.o] Error 1
make[1]: Leaving directory /local/store/openssh/openssh-7.3p1/openbsd-compat'
make: *** [openbsd-compat/libopenbsd-compat.a] Error 2
These includes are not properly wrapped with #ifdef WITH_OPENSSL, so are still reachable. What am I doing wrong?
How do I configure and build OpenSSH 7.3 without OpenSSL dependencies?
It seems that as of version 6.8 OpenSSH can be built without OpenSSL. From 6.8 release notes:
Support --without-openssl at configure time
Disables and removes dependency on OpenSSL. Many features,
including SSH protocol 1 are not supported and the set of crypto
options is greatly restricted. This will only work on systems
with native arc4random or /dev/urandom.
Also I found this message on OpenBSD CVS:
CVSROOT: /cvs
Module name: src
Changes by: markus#cvs.openbsd.org 2014/04/29 12:01:49
Modified files:
usr.bin/ssh : Makefile.inc auth.c authfd.c authfile.c
bufaux.c cipher.c cipher.h hostfile.c kex.c
key.c mac.c monitor.c monitor_wrap.c
myproposal.h packet.c roaming_client.c
ssh-agent.c ssh-keygen.c ssh-keyscan.c
ssh-keysign.c ssh-pkcs11.h ssh.c sshconnect.c
sshconnect2.c sshd.c
usr.bin/ssh/lib: Makefile
usr.bin/ssh/ssh: Makefile
usr.bin/ssh/sshd: Makefile
Log message:
make compiling against OpenSSL optional (make OPENSSL=no);
reduces algorithms to curve25519, aes-ctr, chacha, ed25519;
allows us to explore further options; with and ok djm
I built OpenSSH 7.7p1 without openssl using:
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-privsep-path=/var/empty --libexecdir=/usr/lib/openssh --without-openssl
I also used the patch from Linux From Scratch.

build octave package from source

I want to install octaviz package in octave software.
From the documentation there is stated:
-You'll need octave 2.1.53 or later and VTK CVS to build octaviz. To compile octaviz, run ccmake . in the root directory of the source tree, then make and finally make install.
I first ran ccmake ., and it completed successfully after I installed some libs that I was missing.
But, the I ran "make" and it exits with the following errors:
>> make
[ 1%] Built target vtkWrapOctave
[ 1%] Building CXX object Common/CMakeFiles/octaviz.dir/octaviz.o
/home/user12345/octave/octaviz/Common/octaviz.cc:31:24: fatal error: octave/oct.h: No such file or directory
#include <octave/oct.h>
^
compilation terminated.
make[2]: *** [Common/CMakeFiles/octaviz.dir/octaviz.o] Error 1
make[1]: *** [Common/CMakeFiles/octaviz.dir/all] Error 2
make: *** [all] Error 2
Any idea what I am missing here?
You are missing the octave/oct.h header. This usually means that you don't have Octave installed. If you do have it installed, maybe you are missing the header files and shared libraries (if you are using Linux, did you install octave's -dev or -devel packaqes?) If you have them installed, you must have ran the configure script incorrectly. Either specify the correct options or set the CXX_FLAGS. If you don't know about compiler flags you probably should not change them and instead figure out how to install the octave libraries correctly.

Resources