I'm trying to create a statically linked version of pngquant in Oracle Linux Server release 7.1. I've compiled the static version of zlib and the static version of libpng.
Then, when I configure pngquant, I always get the information that it will be linked with a shared version of zlib.
$ ./configure --with-libpng=../libpng-1.6.21 --extra-cflags="-I../zlib-1.2.8" --extra-ldflags="../zlib-1.2.8/libz.a"
Compiler: gcc
Debug: no
SSE: yes
OpenMP: no
libpng: static (1.6.21)
zlib: shared (1.2.7)
lcms2: no
If I execute make, in the output it seems that the options are correctly passed to the compiler. However, the resulting binary requires libz.so to be executed. It seems that my directives are ignored or that the installed version always takes precedence.
Is there any way of forcing pngquant to be compiled with the static version of zlib?
I'm not sure, if I got it right, but here's a patch to pngquant's configure that worked for me. configure now accepts --with-zlib=<dir> as parameter. Store it to pngquant.patch and apply it with patch -uN -p1 -i pngquant.patch.
diff -ur pngquant-2.9.0/configure pngquant-2.9.0.fixed/configure
--- pngquant-2.9.0/configure 2017-03-06 09:37:30.000000000 +0100
+++ pngquant-2.9.0.fixed/configure 2017-03-07 09:57:20.246012152 +0100
## -48,6 +48,7 ##
help "--with-cocoa/--without-cocoa use Cocoa framework to read images"
fi
help "--with-libpng=<dir> search for libpng in directory"
+ help "--with-zlib=<dir> search for zlib in directory"
echo
help "CC=<compiler> use given compiler command"
help "CFLAGS=<flags> pass options to the compiler"
## -97,6 +98,9 ##
--with-libpng=*)
LIBPNG_DIR=${i#*=}
;;
+ --with-zlib=*)
+ ZLIB_DIR=${i#*=}
+ ;;
--prefix=*)
PREFIX=${i#*=}
;;
## -238,6 +242,19 ##
echo "${MAJ}${MIN}"
}
+# returns full zlib.h version string
+zlibh_string() {
+ echo "$(grep -m1 "define ZLIB_VERSION" "$1" | \
+ grep -Eo '"[^"]+"' | grep -Eo '[^"]+')"
+}
+
+# returns major minor version numbers from png.h
+zlibh_majmin() {
+ local MAJ=$(grep -m1 "define ZLIB_VER_MAJOR" "$1" | grep -Eo "[0-9]+")
+ local MIN=$(grep -m1 "define ZLIB_VER_MINOR" "$1" | grep -Eo "[0-9]+")
+ echo "${MAJ}${MIN}"
+}
+
error() {
status "$1" "error ... $2"
echo
## -420,11 +437,42 ##
error "libpng" "not found (try: $LIBPNG_CMD)"
fi
-# zlib
-if ! find_library "zlib" "z" "zlib.h" "libz.a" "libz.$SOLIBSUFFIX*"; then
- error "zlib" "not found (please install zlib-devel package)"
+# try if given flags are enough for zlib
+HAS_ZLIB=0
+if echo "#include \"zlib.h\"
+ int main(){
+ uLong test = zlibCompileFlags();
+ return 0;
+}" | "$CC" -xc -std=c99 -o /dev/null $CFLAGS $LDFLAGS - &> /dev/null; then
+ status "zlib" "custom flags"
+ HAS_ZLIB=1
fi
+if [ "$HAS_ZLIB" -eq 0 ]; then
+ # try static in the given directory
+ ZLIBH=$(find_h "$ZLIB_DIR" "zlib.h")
+ if [ -n "$ZLIBH" ]; then
+ ZLIBH_STRING=$(zlibh_string "$ZLIBH")
+ ZLIBH_MAJMIN=$(zlibh_majmin "$ZLIBH")
+ if [[ -n "$ZLIBH_STRING" && -n "$ZLIBH_MAJMIN" ]]; then
+ ZLIBA=$(find_f "$ZLIB_DIR" "libz${ZLIBH_MAJMIN}.a")
+ if [ -z "$ZLIBA" ]; then
+ ZLIBA=$(find_f "$ZLIB_DIR" "libz.a")
+ fi
+ if [ -n "$ZLIBA" ]; then
+ cflags "-I${ZLIBH%/*}"
+ lflags "${ZLIBA}"
+ status "zlib" "static (${ZLIBH_STRING})"
+ HAS_ZLIB=1
+ fi
+ fi
+ fi
+fi
+# zlib
+if ! find_library "zlib" "z" "zlib.h" "libz.a" "zlib.$SOLIBSUFFIX*"; then
+ error "zlib" "not found (please install zlib-devel package)"
+fi
+
# lcms2
if [ "$LCMS2" != 0 ]; then
if find_library "lcms2" "lcms2" "lcms2.h" "liblcms2.a" "liblcms2.$SOLIBSUFFIX*"; then
Sorry, the configure script does not support it. It shouldn't be too hard to modify configure to pass appropriate flags to pkg-config or do the same workaround it does for libpng.
Related
I trying to enable AB OTA in AOSP11 source code.
Followed below steps:
Step 1:
BOARD_USES_AB_IMAGE := true
Step 2 : CONFIG_ANDROID_AB=y in u boot source code.
Getting below compilation error :
libcameradevice curr board is yy356x
[ 91% 48807/53497] Target boot image from recovery: out/target/product/xx/boot.img
FAILED: out/target/product/xx/boot.img
/bin/bash -c "(out/host/linux-x86/bin/mkbootimg --kernel out/target/product/xx/kernel --ramdis
k out/target/product/xx/ramdisk-recovery.img --cmdline "console=ttyFIQ0 androidboot.baseband=N/
A androidboot.wificountrycode=CN androidboot.veritymode=enforcing androidboot.hardware=yy30board andro
idboot.console=ttyFIQ0 androidboot.verifiedbootstate=orange firmware_class.path=/vendor/etc/firmware i
nit=/init rootwait ro init=/init androidboot.selinux=permissive buildvariant=userdebug" --recovery_dt
bo out/target/product/xx/rebuild-dtbo.img --dtb out/target/product/xx/dtb.img --os_version
11 --os_patch_level 2021-08-05 --second kernel/resource.img --header_version 2 --output out/target/
product/xx/boot.img ) && (size=$(for i in out/target/product/xx/boot.img; do stat -c "%s" "$i" | tr -d '\n'; echo +; done; echo 0); total=$(( $( echo "$size" ) )); printname=$(ec
ho -n " out/target/product/xx/boot.img" | tr " " +); maxsize=$(( 100663296-0)); if [ "
$total" -gt "$maxsize" ]; then echo "error: $printname too large ($total > $maxsize)"; false;
elif [ "$total" -gt $((maxsize - 32768)) ]; then echo "WARNING: $printname approaching size li
mit ($total now; limit $maxsize)"; fi )"
error: +out/target/product/xx/boot.img too large (103485440 > 100663296)
[ 91% 48808/53497] //libcore/mmodules/intracoreapi:art-module-intra-core-api-stubs-source metalava mer
metalava detected access to files that are not explicitly specified. See /home/test/aosp/aa_android/
out/soong/.intermediates/libcore/mmodules/intracoreapi/art-module-intra-core-api-stubs-source/android_
common/art-module-intra-core-api-stubs-source-violations.txt for details.
01:25:09 ninja failed with: exit status 1
failed to build some targets (02:42:20 (hh:mm:ss))
I am working with Yocto 2.4.2 (rocko), Ubuntu 14.04 LTS, Linux kernel LTSI 4.4, arm cortexA15. There are many issues while building core-image-weston. One of them is:
ERROR: core-image-weston-1.0-r0 do_rootfs: Unable to install packages. Command '/home/server-build/RZG_YoctoProject/build/tmp/work/iwg20m-poky-linux-gnueabi/core-image-weston/1.0-r0/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f /home/server-build/RZG_YoctoProject/build/tmp/work/iwg20m-poky-linux-gnueabi/core-image-weston/1.0-r0/opkg.conf -t /home/server-build/RZG_YoctoProject/build/tmp/work/iwg20m-poky-linux-gnueabi/core-image-weston/1.0-r0/temp/ipktemp/ -o /home/server-build/RZG_YoctoProject/build/tmp/work/iwg20m-poky-linux-gnueabi/core-image-weston/1.0-r0/rootfs --force_postinstall --prefer-arch-to-version install
libkms1
run-postinsts
gstreamer1.0-plugins-good-video4linux2
weston
opkg
psplash
libclutter-1.0-examples
alsa-tools
gtk+3-demo
gles-user-module
packagegroup-core-boot
libdrm-tests
kernel-module-gles
alsa-utils
weston-init
packagegroup-base-extended
bash
packagegroup-core-ssh-dropbear'
returned 2:
Collected errors:
* Solver encountered 2 problem(s):
* Problem 1/2:
- nothing provides libgbm >= 1.0 needed by weston-2.0.0-r0.cortexa15hf-neon
* Solution 1:
- do not ask to install a package providing weston
* Problem 2/2:
- nothing provides libgbm >= 1.0 needed by weston-2.0.0-r0.cortexa15hf-neon
* Solution 1:
- do not ask to install a package providing weston-init
ERROR: core-image-weston-1.0-r0 do_rootfs: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /home/server-build/RZG_YoctoProject/build/tmp/work/iwg20m-poky-linux-gnueabi/core-image-weston/1.0-r0/temp/log.do_rootfs.20697
ERROR: Task (/home/server-build/RZG_YoctoProject/build/../poky/meta/recipes-graphics/images/core-image-weston.bb:do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3411 tasks of which 3410 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/home/server-build/RZG_YoctoProject/build/../poky/meta/recipes-graphics/images/core-image-weston.bb:do_rootfs
The packages weston and weston-init require libgbm >= 1.0. In our current system, libgbm.bb was already existent. And, I can build libgbm succesfully.
SUMMARY = "gbm library"
LICENSE = "MIT"
SECTION = "libs"
LIC_FILES_CHKSUM = "file://gbm.c;beginline=4;endline=22;md5=5cdaac262c876e98e47771f11c7036b5"
SRCREV = "84984e873a134ee67b4c99859f052bb42834245c"
SRC_URI = "git://github.com/thayama/libgbm;protocol=git;branch=master"
PV = "1.0"
S = "${WORKDIR}/git"
DEPENDS = "wayland-kms udev"
inherit autotools pkgconfig
PACKAGES = " \
${PN} \
${PN}-dev \
${PN}-dbg \
${PN}-staticdev \
"
FILES_${PN} = " \
${libdir}/libgbm.so.* \
${libdir}/gbm/libgbm_kms.so.* \
${libdir}/gbm/*.so \
${libdir}/*.so \
"
PROVIDES += "gbm"
FILES_${PN}-dev += "${libdir}/gbm/*.la"
FILES_${PN}-dbg += "${libdir}/gbm/.debug/*"
FILES_${PN}-staticdev += "${libdir}/gbm/*.a"
INSANE_SKIP_${PN} += "dev-so"
But the error happened. Could you help ? Thanks!
I wrote a SQL extension following the instructions on PGXN, but I always get a make install error as following:
/bin/mkdir -p '/usr/share/postgresql/9.5/extension'
/bin/mkdir -p '/usr/share/postgresql/9.5/extension'
/bin/mkdir -p '/usr/share/doc/postgresql-doc-9.5/extension'
/usr/bin/install -c -m 644 .//myextname.control '/usr/share/postgresql/9.5/extension/'
/usr/bin/install -c -m 644 .//sql/myextname--1.0.0.sql .//sql/myextname--1.0.0.sql '/usr/share/postgresql/9.5/extension/'
/usr/bin/install: will not overwrite just-created ‘/usr/share/postgresql/9.5/extension/myextname--1.0.0.sql’ with ‘.//sql/myextname--1.0.0.sql’
make: *** [install] Error 1
My Makefile is as following:
EXTENSION = myextname
EXTVERSION = $(shell grep default_version $(EXTENSION).control | \
sed -e "s/default_version[[:space:]]*=[[:space:]]*'\([^']*\)'/\1/")
DATA = $(filter-out $(wildcard sql/*--*.sql),$(wildcard sql/*.sql))
TESTS = $(wildcard test/sql/*.sql)
REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
REGRESS_OPTS = --inputdir=test
DOCS = $(wildcard doc/*.md)
MODULES = $(patsubst %.c,%,$(wildcard src/*.c))
PG_CONFIG = pg_config
PG91 = $(shell $(PG_CONFIG) --version | grep -qE " 8\\.| 9\\.0" && echo no || echo yes)
ifeq ($(PG91),yes)
all: sql/$(EXTENSION)--$(EXTVERSION).sql
sql/$(EXTENSION)--$(EXTVERSION).sql: $(strip sql/tables.sql \
sql/types.sql \
sql/domains.sql \
)
cat $^ > $#
DATA = $(wildcard sql/*--*.sql) sql/$(EXTENSION)--$(EXTVERSION).sql
EXTRA_CLEAN = sql/$(EXTENSION)--$(EXTVERSION).sql
endif
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
This blog says this error is caused by this line:
DATA = $(wildcard sql/*--*.sql) sql/$(EXTENSION)--$(EXTVERSION).sql
which evaluates into the same filename twice (and /usr/bin/install refuses to overwrite the first instance of the file).
But how can I fix it?
You seem to have copied the Makefile from PGXN, and it is probably much more complicated than you need.
For example, do you target PostgreSQL versions below 9.1?
You'll be much better off with a small, simple custom tailored Makefile like this:
MODULES = src/myextname
EXTENSION = myextname
DATA = sql/myextname--1.0.sql
DOCS = doc/myextname.md
REGRESS = myextname
REGRESS_OPTS = --inputdir=test
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
This (untested) Makefile sticks with the file organization suggested by PGXN.
+ PATH=/sbin:/usr/sbin:/bin:/usr/bin
+ export PATH
+ id -u
+ [ 0 -ne 0 ]
+ name=logstash
+ pidfile=/var/run/logstash.pid
+ LS_USER=logstash
+ LS_GROUP=logstash
+ LS_HOME=/var/lib/logstash
+ LS_HEAP_SIZE=1g
+ LS_LOG_DIR=/var/log/logstash
+ LS_LOG_FILE=/var/log/logstash/logstash.log
+ LS_CONF_DIR=/etc/logstash/conf.d
+ LS_OPEN_FILES=16384
+ LS_NICE=19
+ LS_OPTS=
+ [ -r /etc/default/logstash ]
+ . /etc/default/logstash
+ KILL_ON_STOP_TIMEOUT=0
+ [ -r /etc/sysconfig/logstash ]
+ program=/opt/logstash/bin/logstash
+ args=agent -f /etc/logstash/conf.d -l /var/log/logstash/logstash.log
+ status
+ [ -f /var/run/logstash.pid ]
+ cat /var/run/logstash.pid
+ pid=12716
+ kill -0 12716
+ return 2
+ code=2
+ [ 2 -eq 0 ]
+ start
+ LS_JAVA_OPTS= -Djava.io.tmpdir=/var/lib/logstash
+ HOME=/var/lib/logstash
+ export PATH HOME LS_HEAP_SIZE LS_JAVA_OPTS LS_USE_GC_LOGGING
+ id -Gn logstash
+ + sed s/,$//
tr ,
+ echo
+ SGROUPS=logstash
+ [ ! -z logstash ]
+ EXTRA_GROUPS=--groups logstash
+ ulimit -n 16384
+ echo 22073
+ echo logstash started.
logstash started.
+ return 0
+ code=0
+ exit 0
+ nice -n 19 chroot --userspec logstash:logstash --groups logstash / sh -c
cd /var/lib/logstash
ulimit -n 16384
exec "/opt/logstash/bin/logstash" agent -f /etc/logstash/conf.d -l /var/log/logstash/logstash.log
The above is the command output when the logstash service is started.
(Got this by adding -x switch to the start of the init.d script - #!/bin/sh -x)
Logstash v2.2.0 is installed using the DEB package on Ubuntu 14.04
When I run the exec command that is used by the init script (as seen in the above output) logstash startups pretty fine and works flawlessly
"/opt/logstash/bin/logstash" agent -f /etc/logstash/conf.d -l /var/log/logstash/logstash.log
There is something in the init.d service script that causes logstash to fail as a service. I suspect the nice command that the init script uses.
Do you guys see any issues with the 'nice' command that is being used in the init script ?
+ nice -n 19 chroot --userspec logstash:logstash --groups logstash / sh -c
cd /var/lib/logstash
ulimit -n 16384
exec "/opt/logstash/bin/logstash" agent -f /etc/logstash/conf.d -l /var/log/logstash/logstash.log
When you have uninstalled older version, the logstash user and group was also removed. Now with new installation a new logstash user and group was created with different uid and gid. Yet the ownership of common logstash directories belongs to the old logstash uid and gid.
Now when you start new logstash it tries to read/write to this dir and fails hence logstash not running.
Try changing ownership of these dir and start logstash
chown -R logstash:logstash /var/log/logstash
chown -R logstash:logstash /var/lib/logstash
chown -R logstash:logstash /etc/logstash
rm -rf /var/run/logstash.pid
/etc/init.d/logstash start
I tried to compile uefi code using gnu-efi. But I don't understand how to compile my uefi application code.
I get gnu-efi 3.0.2, decompress and type make && make install. I write hello world code:
#include <efi.h>
#include <efilib.h>
EFI_STATUS efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) {
InitializeLib(ImageHandle, SystemTable);
Print(L"Hello, world!\n");
return EFI_SUCCESS;
}
My OS is Ubuntu 15.04.
Include the gnu-efi files
#include <efi.h>
#include <efilib.h>
it looks like your includes where removed by SO
create the make file;
If you were building a "Hello, World" program for Linux in a Linux
environment, you could compile it without a Makefile. Building the
program in Linux for EFI, though, is essentially a cross-compilation
operation. As such, it necessitates using unusual compilation and
linker options, as well as a post-linking operation to convert the
program into a form that the EFI will accept. Although you could type
all the relevant commands by hand, a Makefile helps a lot.
ARCH = $(shell uname -m | sed s,i[3456789]86,ia32,)
OBJS = main.o
TARGET = hello.efi
EFIINC = /usr/include/efi
EFIINCS = -I$(EFIINC) -I$(EFIINC)/$(ARCH) -I$(EFIINC)/protocol
LIB = /usr/lib64
EFILIB = /usr/lib64/gnuefi
EFI_CRT_OBJS = $(EFILIB)/crt0-efi-$(ARCH).o
EFI_LDS = $(EFILIB)/elf_$(ARCH)_efi.lds
CFLAGS = $(EFIINCS) -fno-stack-protector -fpic \
-fshort-wchar -mno-red-zone -Wall
ifeq ($(ARCH),x86_64)
CFLAGS += -DEFI_FUNCTION_WRAPPER
endif
LDFLAGS = -nostdlib -znocombreloc -T $(EFI_LDS) -shared \
-Bsymbolic -L $(EFILIB) -L $(LIB) $(EFI_CRT_OBJS)
all: $(TARGET)
hello.so: $(OBJS)
ld $(LDFLAGS) $(OBJS) -o $# -lefi -lgnuefi
%.efi: %.so
objcopy -j .text -j .sdata -j .data -j .dynamic \
-j .dynsym -j .rel -j .rela -j .reloc \
--target=efi-app-$(ARCH) $^ $#
reference:
http://www.rodsbooks.com/efi-programming/hello.html
In Ubuntu 18.04, these two lines:
LIB = /usr/lib64
EFILIB = /usr/lib64/gnuefi
need to be changed to:
LIB = /usr/lib
EFILIB = /usr/lib