config.site for vendor libs on Fedora x86_64 - x86-64

I'm having trouble building a few Autotool-based libraries on Fedora 26, x86_64. The 64-bit Fedora puts third party and vendor libraries in /usr/local/lib64. Ubuntu 17 uses /usr/local/lib so the same projects build OK.
I've been using --libdir=/usr/local/lib64 but three libraries resist it. I lack a config.site for /usr/local so I am trying to add one. The Autoconf manual on Site Defaults is a tad bit confusing to me when it discusses usr/local's config.site. It says:
[discussion of /usr version of confg.site] ...
Likewise, on platforms where 64-bit libraries are built by default,
then installed in /usr/local/lib64 instead of /usr/local/lib, it is
appropriate to install /usr/local/share/config.site:
# /usr/local/share/config.site for platforms that prefer
# the directory /usr/local/lib64 over /usr/local/lib.
test "$libdir" = '${exec_prefix}/lib' && libdir='${exec_prefix}/lib64'
The problem I am having is, is the modification above appended to the /usr/local version of config.site? Or does it replace an existing block of code? Or can I just copy it where it belongs without modification?
Or maybe, what does a cat of /usr/local/share/config.site look like?
Here is the config.site for /usr. Its not clear to me if it needs modification or how to modify it.
$ cat /usr/share/config.site
# This is the config.site file to satisfy FHS defaults when installing below
# /usr.
#
# You may override this file by your config.site using the CONFIG_SITE env
# variable.
#
# Note: This file includes also RHEL/Fedora fix for installing libraries into
# "/lib/lib64" on 64bit systems.
if test -n "$host"; then
# skip when cross-compiling
return 0
fi
if test "$prefix" = /usr \
|| { test "$prefix" = NONE && test "$ac_default_prefix" = /usr ; }
then
test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
test "$sharedstatedir" = '${prefix}/com' && sharedstatedir=/var
test "$localstatedir" = '${prefix}/var' && localstatedir=/var
ARCH=`uname -m`
for i in x86_64 ppc64 s390x aarch64; do
if test $ARCH = $i; then
test "$libdir" = '${exec_prefix}/lib' && libdir='${exec_prefix}/lib64'
break
fi
done
fi

config.site for vendor libs on Fedora x86_64
This answers the question of what config.site looks like for /usr/local/share/config.site. It does not answer the question of why --libdir=/usr/local/lib64 fails to set the directory, as #John Bollinger pointed out in the comments.
The /usr/local/share/config.site is wrong. Though it was copied from Fedora's config.site and placed in /usr/local/share, the prefix directories are wrong. The prefix test should use /usr/local and not /usr.
Below is the corrected one.
$ cat /usr/local/share/config.site
...
if test -n "$host"; then
# skip when cross-compiling
return 0
fi
if test "$prefix" = /usr/local \
|| { test "$prefix" = NONE && test "$ac_default_prefix" = /usr/local ; }
then
test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
test "$sharedstatedir" = '${prefix}/com' && sharedstatedir=/var
test "$localstatedir" = '${prefix}/var' && localstatedir=/var
ARCH=`uname -m`
for i in x86_64 ppc64 s390x aarch64; do
if test $ARCH = $i; then
test "$libdir" = '${exec_prefix}/lib' && libdir='${exec_prefix}/lib64'
break
fi
done
fi
I'm not sure if these are correct, however. They were not modified.
test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
test "$sharedstatedir" = '${prefix}/com' && sharedstatedir=/var
test "$localstatedir" = '${prefix}/var' && localstatedir=/var
Now, the next question is, why Fedora's /usr/share/config.site is not handling prefix=/usr/local properly. That's an open question at Issue 1510073 : Autoconf does not honor libdir in config.site for "libdir=#libdir#" in *.pc file, which has been closed as NOT A BUG.

Related

Yocto & wpa_supplicant - installing libwpa_client.so

I'm working with this Yocto/ Bitbake recipe for wpa_supplicant (v2.9) which is a bbappend for this recipe. I had significant difficulties getting the associated library (libwpa_client.so) included in the install process during my Yocto/ Poky build. Eventually I created my own bbappend which contained:
# Force build of library libwpa_client.so
do_configure_append() {
echo 'CONFIG_BUILD_WPA_CLIENT_SO=y' >> wpa_supplicant/.config
}
# Avoid QA errors:
INSANE_SKIP_${PN} += " ldflags"
INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_SYSROOT_STRIP = "1"
SOLIBS = ".so"
FILES_SOLIBSDEV = ""
# Force install of libwpa_client.so
do_install_append(){
install -d ${D}${libdir}
install -m 0644 ${S}/wpa_supplicant/libwpa_client.so ${D}${libdir}
}
Using the config option CONFIG_BUILD_WPA_CLIENT_SO=y failed to install the library so thats why I went with the do_install_append() method. I find it hard to believe this hasn't come up before for others so I think I'm missing something, I can't find similar hacks/ patches.
Can't someone point out if I'm missing something obvious?? There's a patch file for v2.10 which may be associated with this issue, but I think it's more an issue with the Makefile as the library file was successfully built for v2.9, just not populated to the final image.
If this isn't a waste of half a day perhaps this will help others.
Regards,

Yocto rust recipe also produces -native output that needs packaging

I tried this approach on hardknott but I couldn't get it to work recipe also produces -native output that needs packaging
It is a rust recipe that generates an x86_64 app which I would like to package the right way in sdk, so that it can be used.
I can separate the main package to -native-bin, and I see it in the recipe-sysroot, but I can't get it to populate the recipe-sysroot of the workdir of the file when building the -native-helper recipe. And I suspect the reason is that I get an error that the main recipe for x86_64 can't be found?
ERROR: Manifest xxxxxx.populate_sysroot not found in vs_imx8mp cortexa53 armv8a-crc armv8a aarch64 allarch x86_64_x86_64-nativesdk (variant '')?
So any helpful information would be appreciated!
Hacked like this:
Recipe.bb:
do_install_append() {
# Set permision without run flag so that it doesn't fail on checks
chmod 644 ${D}/usr/bin/#RECIPE#-compiler
}
# #RECIPE# generates a compiler during the target generation step
#separate this to the -native-bin package, and skip the ARCH checks
#also in the image file for stations_sdk move the app to right dir and add execute flag
PACKAGES_prepend = "${PN}-native-bin "
PROVIDES_prepend = "${PN}-native-bin "
INSANE_SKIP_${PN}-native-bin = "arch"
FILES_${PN}-native-bin = "/usr/bin/#RECIPE#-compiler"
SYSROOT_DIRS += "/"
Image.bb:
# #RECIPE# produces a compiler that is produced as a part of the target generation
#so we use the recipe and hack it to supply the -compiler as part of the
#host binaries
TOOLCHAIN_TARGET_TASK_append = " #RECIPE#-native-bin"
do_fix_#RECIPE#() {
mv ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/usr/bin/#RECIPE#-compiler ${SDK_OUTPUT}/${SDKPATHNATIVE}/usr/bin/#RECIPE#-compiler
chmod 755 ${SDK_OUTPUT}/${SDKPATHNATIVE}/usr/bin/#RECIPE#-compiler
}
SDK_POSTPROCESS_COMMAND_prepend = "do_fix_#RECIPE#; "
This produces at the end the binary in the right directory

I couldn't find stress tester in OrientDB 3.x

I have been going through the documentation of OrientDB about Stress tester. But I couldn't find the script for it in my setup's bin folder.
the script for the stress test was present in version older than 3.x
You can take stresstester.sh from, for example, OrientDB 2.2 and adapt it for your version.
Here is /orientdb/bin/stresstester.sh from 2.2.37:
#!/usr/bin/env bash
# resolve links - $0 may be a softlink
PRG="$0"
while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done
# Get standard environment variables
PRGDIR=`dirname "$PRG"`
# Only set ORIENTDB_HOME if not already set
[ -f "$ORIENTDB_HOME"/lib/orientdb-tools-2.2.37.jar ] || ORIENTDB_HOME=`cd "$PRGDIR/.." ; pwd`
export ORIENTDB_HOME
# Set JavaHome if it exists
if [ -f "${JAVA_HOME}/bin/java" ]; then
JAVA=${JAVA_HOME}/bin/java
else
JAVA=java
fi
export JAVA
exec "$JAVA" -XX:MaxDirectMemorySize=512g -cp "$ORIENTDB_HOME/lib/*" \
com.orientechnologies.orient.stresstest.OStressTester $*
In my case I only had to change orientdb-tools-2.2.37.jar to orientdb-tools-3.0.33.jar in order to run this script with OrientDB 3.0.33 I have installed.

Installing cpan Modules in cygwin fails

I am trying to install different Perl Modules from CPAN in a cygwin-32bit enviroment and always get Errors of the same kind. This one is from trying to install Net::SSLeay, did make, install and tried force install too, nothing seemed to work.
drmariad#drmariad-MOBL ~/.cpan/build/Net-SSLeay-1.70-eDSzRW$ make install
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
chmod 755 /usr/lib/perl5/site_perl/5.14/i686-cygwin-threads-64int/auto//Net/SSLeay/SSLeay.dll
/bin/find /usr/lib/perl5/site_perl/5.14/i686-cygwin-threads-64int/auto/ -xdev -name \*.dll /bin/rebase -sOT -
/bin/find: paths must precede expression: /bin/rebase
Usage: /bin/find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
Makefile:731: recipe for target 'pure_install' failed
make: *** [pure_install] Error 1
Most of the time it is the bin/find fails message i get in the installations, but i don't know how to change that behaviour. I got errors and failures with most of the modules i tryed to install.
My update-to-date Cygwin comes with
ExtUtils::MakeMaker 6.57_05
ExtUtils::MM_Cygwin 6.57_07
That's odd for a few reason, but what we care about is that version of MM_Cygwin is buggy.
sub install {
my($self, %attribs) = #_;
my $s = ExtUtils::MM_Unix::install($self, %attribs);
return '' unless $s;
return $s unless %{$self->{XS}};
my $INSTALLDIRS = $self->{INSTALLDIRS};
my $INSTALLLIB = $self->{"INSTALL". ($INSTALLDIRS eq 'perl' ? 'ARCHLIB' : uc($INSTALLDIRS)."ARCH")};
my $dop = "\$\(DESTDIR\)$INSTALLLIB/auto/";
my $dll = "$dop/$self->{FULLEXT}/$self->{BASEEXT}.$self->{DLEXT}";
$s =~ s|^(pure_install :: pure_\$\(INSTALLDIRS\)_install\n\t)\$\(NOECHO\) \$\(NOOP\)\n|$1\$(CHMOD) \$(PERM_RWX) $dll\n\t/bin/find $dop -xdev -name \\*.$self->{DLEXT} /bin/rebase -sOT -\n|m if (( $Config{myarchname} eq 'i686-cygwin') and not ( exists $ENV{CYGPORT_PACKAGE_VERSION} ));
$s;
}
You could add the missing | to /usr/lib/perl5/5.14/ExtUtils/MM_Cygwin.pm as a quick permanent fix.
Alternatively, Cygwin has a package named perl-ExtUtils-MakeMaker that upgrade the distribution to 7.04_01.
...Except the bug is still present there. If you have this package installed, the file to fix is /usr/lib/perl5/vendor_perl/5.14/ExtUtils/MM_Cygwin.pm.
Alternatively, you can upgrade ExtUtils::MakeMaker to the latest dev release (which uses a completely different command).
cpan B/BI/BINGOS/ExtUtils-MakeMaker-7.05_22.tar.gz

Is aubio cross-compilable for iPhone/Android/ARM? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Anyone know of:
A build of the Aubio library for iPhone/ARM processor?
An intro-to-cross-compiling resource so I can try it myself?
Try using the latest git:
$ git clone git://git.aubio.org/git/aubio
$ cd aubio/
$ ./waf configure build --with-target-platform ios
I've succeeded in cross-compiling it without errors. I haven't tested the library itself, but the example executables seem to work, so that's a good sign!
The script I've put together (largely thanks to the invaluable information in this link) should work for a lot of other projects using Autotools (like Aubio's dependencies).
Note that both libsndfile and libsamplerate need a patch to cross-compile successfully, which I'm sure is ugly, but it works.
To use it, modify the script according to your system (should be pretty straightforward, I hope), download all the dependencies (listed in the build xxxxx lines at the end, your versions may vary) in the same directory as the script and run the script without arguments. At the end, everything should be inside the $SYS_ROOT directory.
Okay, the main dish is below :
#!/bin/bash
# Taken and improved from :
# http://cmumobileapps.com/2011/08/31/compiling-open-source-libraries-with-android-ndk-part-2
# The designation for the host, usually "linux-x86" for standard linuxes, and
# "darwin-x86" for OSX.
HOST="linux-x86"
# The target architecture. Here we're compiling for ARM using GCC 4.7 and
# platform version 14.
TARGET_ARCH="arm"
TARGET_HOST="arm-eabi"
TARGET_TOOLCHAIN="arm-linux-androideabi"
TARGET_GCC_VERSION="4.7"
TARGET_NDK_VERSION="14"
# Add the toolchain to the path to be able to use the ARM compiler.
export PATH="$ANDROID_NDK/toolchains/$TARGET_TOOLCHAIN-$TARGET_GCC_VERSION/prebuilt/$HOST/bin:$PATH"
# Where to find the platform-specific files?
export PLATFORM="$ANDROID_NDK/platforms/android-$TARGET_NDK_VERSION/arch-$TARGET_ARCH/"
# Where to copy the platform-specific files?
# Will be used later as the target system root for cross-compilation.
export SYS_ROOT="`pwd`/sysroot/"
# Executable names for the compilation toolchain
export CC="$TARGET_TOOLCHAIN-gcc --sysroot=$SYS_ROOT"
export CXX="$TARGET_TOOLCHAIN-g++ --sysroot=$SYS_ROOT"
export CPP="$TARGET_TOOLCHAIN-cpp --sysroot=$SYS_ROOT"
export LD="$TARGET_TOOLCHAIN-ld"
export AR="$TARGET_TOOLCHAIN-ar"
export RANLIB="$TARGET_TOOLCHAIN-ranlib"
export STRIP="$TARGET_TOOLCHAIN-strip"
# Add the STLPort library to the search path (needed for C++ files)
export CXXFLAGS="-I$ANDROID_NDK/sources/cxx-stl/stlport/stlport/"
export LDFLAGS="-L$ANDROID_NDK/sources/cxx-stl/stlport/libs/armeabi/ -lstlport_static"
# Where to install the cross-compiled packages?
# When running `make install`, all the files (executables, libraries,
# documentation,...) will be in this directory.
export INSTALL_DIR="$SYS_ROOT/usr/"
# Where will pkg-config look for information about installed packages?
export PKG_CONFIG_LIBDIR="$SYS_ROOT/usr/lib/pkgconfig/"
#################
# Configuration #
#################
# If the sysroot doesn't exist, create it and copy all the files from the NDK
# distribution.
if [[ ! -e "$SYS_ROOT" ]]; then
echo "Creating sysroot [$SYS_ROOT]"
cp -Rf "$PLATFORM" "$SYS_ROOT" || exit 2
fi
# If it doesn't exist, create the installation directory.
if [[ ! -e "$INSTALL_DIR" ]]; then
echo "Creating installation directory [$INSTALL_DIR]"
mkdir -p $INSTALL_DIR || exit 3
fi
###############
# Compilation #
###############
build() {
# Change directory to the package directory (in argument)
echo "Building $1"
pushd $1
# Clean things up (optional)
make clean 1>/dev/null 2>&1
# Configure the package
./configure --host=$TARGET_HOST LIBS="-lc -lgcc" --prefix=$INSTALL_DIR || exit 1
# Compile
make || exit 1
# Install in $INSTALL_DIR
make install || exit 1
# Return to the original directory
popd
}
# Build all things
build libogg-1.3.0
build libvorbis-1.3.3
build flac-1.2.1
build libsndfile-1.0.25-patch
build libsamplerate-0.1.8-patch
build fftw-3.3.3
build aubio-0.3.2
libsndfile patch
--- libsndfile-1.0.25/programs/sndfile-play.c 2012-12-31 17:03:34.289908113 +0100
+++ libsndfile-1.0.25-patch/programs/sndfile-play.c 2012-12-31 17:04:05.326412364 +0100
## -55,7 +55,7 ##
#if defined (__linux__) || defined (__FreeBSD_kernel__) || defined (__FreeBSD__)
#include <fcntl.h>
#include <sys/ioctl.h>
- #include <sys/soundcard.h>
+ #include <linux/soundcard.h>
#elif (defined (__MACH__) && defined (__APPLE__))
#include <Carbon.h>
--- libsndfile-1.0.25/src/sndfile.c 2012-12-31 17:03:34.343241171 +0100
+++ libsndfile-1.0.25-patch/src/sndfile.c 2013-01-01 18:53:37.436544846 +0100
## -309,7 +309,7 ##
{ SF_PRIVATE *psf ;
/* Ultimate sanity check. */
- assert (sizeof (sf_count_t) == 8) ;
+ /* assert (sizeof (sf_count_t) == 8) ; */
if ((psf = calloc (1, sizeof (SF_PRIVATE))) == NULL)
{ sf_errno = SFE_MALLOC_FAILED ;
libsamplerate patch
--- libsamplerate-0.1.8/examples/audio_out.c 2011-07-13 01:57:31.000000000 +0200
+++ libsamplerate-0.1.8-patch/examples/audio_out.c 2013-01-01 17:24:58.257526888 +0100
## -44,7 +44,7 ##
#include <fcntl.h>
#include <sys/ioctl.h>
-#include <sys/soundcard.h>
+#include <linux/soundcard.h>
#define LINUX_MAGIC MAKE_MAGIC ('L', 'i', 'n', 'u', 'x', 'O', 'S', 'S')
Here is a build script that worked for me:
#! /bin/sh
"""
build the toold chain home with:
build/tools/make-standalone-toolchain.sh --platform=android-9 --install-dir=../android-9-toolchain
"""
NDK_HOME=~/dev/SDKs/android-9-toolchain
set -x
set -e
export CC=$NDK_HOME/bin/arm-linux-androideabi-gcc
export CFLAGS=-I$NDK_HOME/include
export LDFLAGS="-L$NDK_HOME/lib"
export AR=$NDK_HOME/bin/arm-linux-androideabi-ar
./waf distclean
./waf configure --with-target-platform android --disable-jack
./waf build --verbose
./waf install --destdir dist-android
it will default to toolchain / gcc version 4.6, I changed this to 4.9 as that is the latest I have.
it should pull down the libraries it needs to finish compiling
the main part of the script was kindly provided by Paul Brossier author of Aubio