I'm using ghostscript to generate rather large PDF files, and profiling has lead me to believe that a lot of time is spent compressing data.
For whatever reason, the ghostscript source tree ships with a copy of the zlib 1.2.11 source code, which is then compiled into the resulting gs executable.
I would like to benchmark other zlib implementations, notably Cloudflare's and possibly Intel's.
In ghostscript's Makefile.in, there's an interesting section:
# Define the directory where the zlib sources are stored.
# See zlib.mak for more information.
SHARE_ZLIB=#SHARE_ZLIB#
ZSRCDIR=#ZLIBDIR#
#ZLIB_NAME=gz
ZLIB_NAME=z
ZLIB_CFLAGS=#ZLIBCFLAGS#
And looking in base/zlib.mak:
# makefile for zlib library code.
# Users of this makefile must define the following:
# GSSRCDIR - the GS library source directory
# ZSRCDIR - the source directory
# ZGENDIR - the generated intermediate file directory
# ZOBJDIR - the object directory
# SHARE_ZLIB - 0 to compile zlib, 1 to share
# ZLIB_NAME - if SHARE_ZLIB=1, the name of the shared library
# ZAUXDIR - the directory for auxiliary objects.
So, in theory, one should just compile zlib elsewhere, get an .so file (perhaps?), set SHARE_ZLIB to 1 and ZLIB_name to /foo/bar/zlib_cloudflare/libz.so and everything should be good. Except it doesn't work, and there's zero documentation.
Related
I'm new to Fortran (gfortran on windows) and want to use the random number generator vsrnggaussian.
vsrnggaussian needs the Intel MKL VSL modules 'mkl_vsl_type' and 'mkl_vsl' which are provided in the mkl_vsl.f90 file. This file needs to be included to generate the module files 'mkl_vsl_type.mod' and 'mkl_vsl.mod' which are used to process the Fortran use clauses referencing to the VSL interface:
use mkl_vsl_type
use mkl_vsl
I tried multiple things to include the mkl_vsl.f90 file but none of them work:
I inserted the file into the project directory --> 793 errors occured (can't list all of them here in detail) such as:
Unexpected data declaration statement at (1)
[...] at (1) has no implicit type
expecting [...] statement at (1)
unexpected [...] statement at (1)
and finally Fatal Error: Cannot open module file 'mkl_vsl_type.mod' for reading at (1): No such file or directory. compilation terminated. "gfortran -g -o incl_mkl.exe ../incl_mkl.f90" terminated with exit code 1. Build might be incomplete.
I used the full path in the include statement: INCLUDE 'C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2016.1.146/windows/mkl/include/mkl_vsl.f90' --> Error: Can't open included file
I tried the -Idir compiler command: gfortran -I/Program Files (x86)/IntelSWTools/compilers_and_libraries_2016.1.146/windows/mkl/include/ -g -o incl_mkl.exe --> gfortran: error: Files: no such file or directory
I put this into the makefile: INCLUDES=-I. -I/Program Files (x86)/IntelSWTools/compilers_and_libraries_2016.1.146/windows/mkl/include/ --> Error: Can't open included file
How do I include the mkl_vsl.f90 file??
edit: my simple code to include the mkl_vsl.f90 file
(this code will be compiled first before i compile my main code with vsrnggaussian):
Program INCL
IMPLICIT NONE
INCLUDE 'mkl_vsl.f90'
!INCLUDE 'C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2016.1.146/windows/mkl/include/mkl_vsl.f90'
END Program
You'd need to USE both vsl_type and vsl modules. The reason is that the derived types in vsl are defined in vsl_type. MWE
Program INCL
use mkl_vsl_type
use mkl
IMPLICIT NONE
write(6, *) 'hello world'
END Program
You would need to pass the address to file mkl_vsl.f90 to ifort and the mkl flag.
ifort -mkl foo.f90 <address>/mkl_vsl.f90
For using any specific subroutine of MKL consult their website. There is also extensive examples that come with MKL. You may find it in C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_2016.1.146/windows/mkl/examples or something like that.
I am trying to modify one of the CentOS (7.6) kernel source file and recompile all of them for later installation.
I followed the guide on wiki.centos to do customized kernel:
https://wiki.centos.org/HowTos/Custom_Kernel
I found that in step 5, the RPM method always unpacked source files from tar files and replaced my modification in BUILD/.
Therefore, I changed my way. I put my modification at another place and added a line in kernel.spec file under SPECS/ to copy my file into the BUILD/. Namely, one-line with cp command is put before %build in the kernel.spec (after unpacked). However, the compilation went wrong in the %build section:
...
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.Vd6by5
BUILDING A KERNEL FOR x86_64...
USING ARCH=x86_64
...
###
### Now generating an X.509 key pair to be used for signing modules.
###
### If this takes a long time, you might wish to run rngd in the
### background to keep the supply of entropy topped up. It
### needs to be run as root, and uses a hardware random
### number generator if one is available.
###
Generating a 3072 bit RSA private key
....++
......................................................................................................................................................................................++
writing new private key to 'signing_key.priv'
-----
###
### Key pair generated.
###
- Including cert /home/user/rpmbuild/BUILD/kernel-3.10.0-957.12.2.el7/linux-3.10.0-957.12.2.el7.v2.x86_64/centos-kpatch.x509
- Including cert /home/user/rpmbuild/BUILD/kernel-3.10.0-957.12.2.el7/linux-3.10.0-957.12.2.el7.v2.x86_64/centos-ldup.x509
- Including cert signing_key.x509
RPM build errors:
Could somebody suggest me a better way to replace the source file in the compilation procedure?
Thanks.
I found the solution myself. Instead of directly replacing files, we should apply patch within RPM to indicate the differences between modified file and original file.
Firstly, use diff command to build patch. Then, modify spec file, kernel.spec, applying the patch to the building procedure.
This website shows the example when using this way to compile kernel:
https://www.hiroom2.com/2016/05/29/centos-7-rebuild-kernel-with-src-rpm/
A more clear reference for patching files:
https://rpm-packaging-guide.github.io/#patching-software
I have proxmox containers. Host Debian 9, inside container Debian 8.
I made image to migrate into VMWare.
And now I need to build my initranfs. But if i run update-initranfs -u -v -k 4.9.0-0.bpo.8-amd64 it processed but doesn't copy modules. there is an attempt copying "Copying module directory kernel/drivers/ata" in log with no errors but there are no modules copied.
$update-initranfs -u -v -k 4.9.0-0.bpo.8-amd64
Keeping /boot/initrd.img-4.9.0-0.bpo.8-amd64.dpkg-bak
update-initramfs: Generating /boot/initrd.img-4.9.0-0.bpo.8-amd64
Copying module directory kernel/drivers/usb/host
(excluding hwa-hc.ko sl811_cs.ko sl811-hcd.ko u132-hcd.ko whci-hcd.ko)
Copying module directory kernel/drivers/hid
(excluding hid-*ff.ko hid-a4tech.ko hid-cypress.ko hid-dr.ko hid-elecom.ko hid-gyration.ko hid-icade.ko hid-kensington.ko hid-kye.ko hid-lcpower.ko hid-magicmouse.ko hid-multitouch.ko hid-ntrig.ko hid-petalynx.ko hid-picolcd.ko hid-pl.ko hid-ps3remote.ko hid-quanta.ko hid-roccat-ko*.ko hid-roccat-pyra.ko hid-saitek.ko hid-sensor-hub.ko hid-sony.ko hid-speedlink.ko hid-tivo.ko hid-twinhan.ko hid-uclogic.ko hid-wacom.ko hid-waltop.ko hid-wiimote.ko hid-zydacron.ko)
Copying module directory kernel/drivers/gpio
Copying module directory kernel/drivers/i2c/busses
Copying module directory kernel/drivers/net
(excluding appletalk arcnet bonding can dummy.ko hamradio hippi ifb.ko irda macvlan.ko macvtap.ko pcmcia sb1000.ko team tokenring tun.ko usb veth.ko wan wimax wireless xen-netback.ko)
Copying module directory kernel/drivers/scsi
Copying module directory kernel/drivers/block
Copying module directory kernel/drivers/nvme
Copying module directory kernel/drivers/ata
Copying module directory kernel/drivers/mmc
Copying module directory kernel/drivers/usb/storage
Adding binary /usr/share/initramfs-tools/conf.d/compcache
Adding binary /sbin/modprobe
Adding library /lib/x86_64-linux-gnu/libc.so.6
Adding library /lib64/ld-linux-x86-64.so.2
Adding binary /sbin/rmmod
Calling hook busybox
Adding binary /usr/lib/initramfs-tools/bin/busybox
Calling hook casper
Adding binary /sbin/losetup
Adding library /lib/x86_64-linux-gnu/libsmartcols.so.1
Adding binary /sbin/blkid
Adding library /lib/x86_64-linux-gnu/libblkid.so.1
Adding library /lib/x86_64-linux-gnu/libuuid.so.1
Adding binary /usr/share/casper/casper-reconfigure
Adding binary /usr/share/casper/casper-preseed
Adding binary /usr/share/casper/casper-set-selections
Adding binary /lib/udev/cdrom_id
Adding library /lib/x86_64-linux-gnu/libpthread.so.0
Copying module directory kernel/drivers/net
(excluding appletalk arcnet bonding can dummy.ko hamradio hippi ifb.ko irda macvlan.ko macvtap.ko pcmcia sb1000.ko team tokenring tun.ko usb veth.ko wan wimax wireless xen-netback.ko)
Calling hook fsck
Adding binary /sbin/fsck
Adding library /lib/x86_64-linux-gnu/libmount.so.1
Adding library /lib/x86_64-linux-gnu/libselinux.so.1
Adding library /lib/x86_64-linux-gnu/libpcre.so.3
Adding library /lib/x86_64-linux-gnu/libdl.so.2
Adding binary /sbin/logsave
Adding binary /sbin/sulogin
Adding library /lib/x86_64-linux-gnu/libcrypt.so.1
Adding binary /sbin/e2fsck
Adding library /lib/x86_64-linux-gnu/libext2fs.so.2
Adding library /lib/x86_64-linux-gnu/libcom_err.so.2
Adding library /lib/x86_64-linux-gnu/libe2p.so.2
Calling hook keymap
Calling hook klibc
Calling hook kmod
Adding binary /bin/kmod
Calling hook resume
Calling hook thermal
Calling hook udev
Adding binary /lib/systemd/systemd-udevd
Adding library /lib/x86_64-linux-gnu/libkmod.so.2
Adding library /lib/x86_64-linux-gnu/libacl.so.1
Adding library /lib/x86_64-linux-gnu/libattr.so.1
Adding binary /bin/udevadm
Adding binary /lib/udev/ata_id
Adding binary /lib/udev/scsi_id
Calling hook zz-busybox
Adding binary /bin/busybox
Calling hook dmsetup
Adding binary /sbin/dmsetup
Adding library /lib/x86_64-linux-gnu/libdevmapper.so.1.02.1
Adding library /lib/x86_64-linux-gnu/libudev.so.1
Adding library /lib/x86_64-linux-gnu/librt.so.1
/usr/share/initramfs-tools/scripts/init-bottom/ORDER ignored: not executable
/usr/share/initramfs-tools/scripts/local-premount/ORDER ignored: not executable
/usr/share/initramfs-tools/scripts/init-top/ORDER ignored: not executable
/usr/share/initramfs-tools/scripts/casper-premount/ORDER ignored: not executable
/usr/share/initramfs-tools/scripts/casper-bottom/ORDER ignored: not executable
Building cpio /boot/initrd.img-4.9.0-0.bpo.8-amd64.new initramfs
and there are no modules i need
$lsinitramfs /boot/initrd.img-4.9.0-0.bpo.8-amd64 | grep modules
lib/modules
lib/modules/4.9.0-0.bpo.8-amd64
lib/modules/4.9.0-0.bpo.8-amd64/modules.alias.bin
lib/modules/4.9.0-0.bpo.8-amd64/modules.order
lib/modules/4.9.0-0.bpo.8-amd64/modules.devname
lib/modules/4.9.0-0.bpo.8-amd64/modules.dep
lib/modules/4.9.0-0.bpo.8-amd64/modules.symbols.bin
lib/modules/4.9.0-0.bpo.8-amd64/modules.alias
lib/modules/4.9.0-0.bpo.8-amd64/modules.symbols
lib/modules/4.9.0-0.bpo.8-amd64/modules.dep.bin
lib/modules/4.9.0-0.bpo.8-amd64/modules.builtin.bin
lib/modules/4.9.0-0.bpo.8-amd64/modules.softdep
lib/modules/4.9.0-0.bpo.8-amd64/modules.builtin
conf/modules
My configs
#initramfs.conf
MODULES=most
BUSYBOX=auto
COMPCACHE_SIZE=""
COMPRESS=gzip
DEVICE=
NFSROOT=auto
#update-initramfs.conf
update_initramfs=yes
backup_initramfs=no
$ls /lib/modules/4.9.0-0.bpo.8-amd64/kernel/drivers/ata/ata_generic*
ata_generic.ko
I tried MODULES=list with lsmod | awk '{print $1}' > /etc/initramfs-tools/modules
Why initramfs has no modules?
My trouble was in a broken package kmod!!!!!
apt-get install --reinstall kmod
mkinitramfs -o /boot/initrd.img-4.9.0-0.bpo.8-amd64 4.9.0-0.bpo.8-amd64
I'm using Buildroot 2018.02.7 to build a simple Linux system for i386 PC, as a precursor to doing the same thing for an embedded ARM system. I keep running into problems like this one, in building the util-linux module:
CC lib/libcommon_la-path.lo
lib/pager.c:11:17: fatal error: err.h: No such file or directory
#include <err.h>
^
compilation terminated.
Makefile:8596: recipe for target 'lib/libcommon_la-pager.lo' failed
make[3]: *** [lib/libcommon_la-pager.lo] Error 1
When I look in the linux-headers source tree in .../output/build/linux-headers-4.13.8, the file is found. But Buildroot is pointing to a different set of headers, the one built into its GCC:
devuser#3faf730b4a1b:~/pc/buildroot-2018.02.7/output/build/util-linux-2.31.1$ ../../host/bin/i686-buildroot-linux-uclibc-gcc -print-sysroot
/home/devuser/pc/buildroot-2018.02.7/output/host/i686-buildroot-linux-uclibc/sysroot
devuser#3faf730b4a1b:~/pc/buildroot-2018.02.7/output/build/util-linux-2.31.1$
And the two /usr/include subdirectories are significantly different.
Have I missed a configuration setting somewhere in the defconfig file? This is the defconfig:
BR2_x86_core2=y
BR2_SSP_REGULAR=y
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_13=y
BR2_UCLIBC_CONFIG="board/pc/dsa_pc_i386_uclibc.config"
BR2_TOOLCHAIN_BUILDROOT_USE_SSP=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TARGET_GENERIC_GETTY_PORT="tty1"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/pc/post-image.sh support/scripts/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/pc/genimage-bios.cfg"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.13.8"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/pc/linux.config"
BR2_LINUX_KERNEL_INSTALL_TARGET=y
BR2_LINUX_KERNEL_EXT_XENOMAI=y
BR2_PACKAGE_BUSYBOX_CONFIG="board/pc/dsa_pc_i386_busybox.config"
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_9170=y
BR2_PACKAGE_LINUX_FIRMWARE_ATHEROS_9271=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_3160=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_3168=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_5000=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_6000G2A=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_6000G2B=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_7260=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_7265D=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_8000C=y
BR2_PACKAGE_LINUX_FIRMWARE_IWLWIFI_8265=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT73=y
BR2_PACKAGE_LINUX_FIRMWARE_RALINK_RT2XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_81XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_88XX=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_8169=y
BR2_PACKAGE_ACPID=y
BR2_PACKAGE_DBUS=y
BR2_PACKAGE_ZLIB=y
BR2_PACKAGE_LIBFFI=y
BR2_PACKAGE_PCRE=y
BR2_PACKAGE_PCRE_UCP=y
BR2_PACKAGE_READLINE=y
BR2_PACKAGE_WPA_SUPPLICANT=y
BR2_PACKAGE_WPA_SUPPLICANT_DBUS_NEW=y
BR2_PACKAGE_KMOD=y
BR2_PACKAGE_UTIL_LINUX=y
BR2_PACKAGE_UTIL_LINUX_LIBMOUNT=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
# BR2_TARGET_ROOTFS_TAR is not set
BR2_PACKAGE_HOST_GENIMAGE=y
Enable UCLIBC_HAS_BSD_ERR in uClibc.
You have a custom uClibc configuration. That falls squarely in the "you know what you are doing" category, since it allows you to remove features that other packages rely on.
In this case, util-linux relies on the non-Posix err.h include. This is only installed if UCLIBC_HAS_BSD_ERR is enabled in the uClibc configuration.
There is a high risk of running into similar issues with a custom uClibc configuration.
Setup:
Toolchain: gcc-arm-none-eabi-5_2-2015q4-20151219
Target: STM429i-disco board
I want to run gcov and get real time report generated in target as per below link:
https://mcuoneclipse.com/2014/12/26/code-coverage-for-embedded-target-with-eclipse-gcc-and-gcov/
First, sucessfully have compiled my code (POSIX compliant NUTTX OS) with -fprofile-arcs & -ftest-coverage flags & got generated the .gcno files for my src files.
second, sucesfully have linked with -fprofile-arcs flags enabled and using the libgcov.a file (part of the toolchain) and the final binary is generated.
Now, I dont know what changes are needed in my test application to invoke gcov, generate report & dump report.
Another problem is, gcov functions are with HIDDEN attribute in libgcov.a as below.
9: 00000000 4 FUNC GLOBAL HIDDEN 1 __gcov_flush
9: 00000000 4 FUNC GLOBAL HIDDEN 1 __gcov_init
so, I could not invoke as I need.
Any inputs in getting the .gcda file generated would be of great help.
Can you look for gcov_exit instead? It is similar to __gcov_flush. Typically, it's one of gcov_exit and __gcov_flush that would be there and you can use any.
In case this is not there or is also hidden, you can use this approach which I tried for one of my projects. I picked (and modified for various reasons) the implementation of gcov_exit from gcc source code (of version matching my toolchain) (available at https://github.com/reeteshranjan/libgcov-embedded) and plugged it in my project. With everything else remaining the same (the compiler flags etc.), I was able to then break into gcov_exit and follow the rest of the approach in the blog link you have mentioned.