salsaman / LiVES

LiVES is a feature rich application which combines elements of VJ and video editing software. The current version runs on Linux / BSD. Check_out_the_new_discussion_area https://github.com/salsaman/LiVES/discussions
http://lives-video.com
GNU General Public License v3.0
89 stars 11 forks source link

Attempting to cross-compile in OpenEmbedded #41

Closed bkauler closed 2 years ago

bkauler commented 2 years ago

I maintain EasyOS, a distro that is built from packages almost totally cross-compiled in OpenEmbedded. This includes big packages, such as LibreOffice and Gnumeric, over 860 packages so far. For anyone interested:

https://bkhome.org/news/202112/how-to-cross-compile-850-packages-using-yoctoopenembedded.html

I would like to add LiVES, but have immediately hit two problems, in configure.ac...

Firstly, AC_CHECK_FILE does not work in a cross-compile environment. I did a search, and there are other means of testing file existence that do work. I created a patch that simply removes that test.

Secondly:

automake (GNU automake) 1.16.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl-2.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Tom Tromey <tromey@redhat.com>
       and Alexandre Duret-Lutz <adl@gnu.org>.
AUTOV is 1.16
autoreconf: Entering directory  '.'
autoreconf: running: aclocal --system-acdir=/mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/recipe-sysroot/usr/share/aclocal/ --automake-acdir=/mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/recipe-sysroot-native/usr/share/aclocal-1.16 -I /mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/lives-20211222/m4/ -I /mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/recipe-sysroot-native/usr/share/aclocal/ --force -I m4
ERROR: Use of AM_GNU_GETTEXT without [external] argument is no longer supported.

...this problem is occurring at line 122 in configure.ac

I am not familiar enough with autotools to know what to do to fix this.

bkauler commented 2 years ago

I looked in claws-mail source package and found a fix. Doing this:

sed -i -e 's%^AM_GNU_GETTEXT$%AM_GNU_GETTEXT([external])%' ${S}/configure.ac

Got past that one, but now it stops at:

configure.ac:1130: error: required file 'intl/Makefile.in' not found

Hmmm, yes, 'intl' folder is missing. I got the source today from master.

salsaman commented 2 years ago

I think your patch is correct, but incomplete, when I tried it, I got a warning "intl should not be in SUBDIRS in Makefile.am". After removing it from SUBDIRS, it seemed to work. The missing file problem can be solved by removing line 1130 from configure.ac.

bkauler commented 2 years ago

Something is really odd. I used "git clone" to obtain the source, and it has top-level 'intl' folder. However, I converted into a .tar.gz tarball and uploaded to my own source repo, and somehow the 'intl' folder got missed out. Went through it again, and this time do have 'intl' folder. Very odd.

Anyway, the two patches as I have posted about above, work, and it is now compiling. But now OSC compile fails:

x86_64-poky-linux-gcc: error: ../../libOSC/client/.libs/libOSC_client.a: No such file or directory
| make[2]: *** [Makefile:518: sendOSC] Error 1

...that folder only has:

# ls
libOSC_client.la                libOSC_client.so
libOSC_client.lai               libOSC_client.so.0
libOSC_client_la-OSC-client.o   libOSC_client.so.0.0.0
libOSC_client_la-OSC-timetag.o

...the static library hasn't been created. I suppose could disable OSC, but it would be nice to fix this issue.

bkauler commented 2 years ago

Ah, I see what could be the cause: I only specified "--disable-doxygen --enable-threads=posix", but I see in configure.log what OpenEmbedded has composed:

../lives-20211222/configure --build=x86_64-linux --host=x86_64-poky-linux --target=x86_64-poky-linux --prefix=/usr --exec_prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include --oldincludedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/recipe-sysroot --disable-doxygen --enable-threads=posix --disable-static --enable-nls

Looks like I will have to try and override that --disable-static

bkauler commented 2 years ago

OK, have a fix, quoting from: https://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html

Any recipe that needs to opt-out of having the "--disable-static" option specified on the configure command line either because it is not a supported option for the configure script or because static libraries are needed should set the following variable:

     DISABLE_STATIC = ""

Now, compile gets further, and stops at this:

| Making all in intl
| make[1]: Entering directory '/mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/build/intl'
| make[1]: *** No rule to make target 'all-@USE_INCLUDED_LIBINTL@', needed by 'all'.  Stop.
| make[1]: Leaving directory '/mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/build/intl'
| make: *** [Makefile:602: all-recursive] Error 1
bkauler commented 2 years ago

I gor past the above problem by editing the intl/Makefile. Should really have fixed it before Makefile gets created, but this works, in the OpenEmbedded recipe:

do_compile_prepend() {
 #| make[1]: Entering directory '/mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/build/intl'
 #| make[1]: *** No rule to make target 'all-@USE_INCLUDED_LIBINTL@', needed by 'all'.  Stop.
 sed -i -e 's%@USE_INCLUDED_LIBINTL@%no%' ${B}/intl/Makefile
 sed -i -e 's%@BUILD_INCLUDED_LIBINTL@%no%' ${B}/intl/Makefile
}
bkauler commented 2 years ago

Compile progresses to the next error:

| ../../lives-20211222/src/intents.c:8:10: fatal error: weed-utils.h: No such file or directory
|     8 | #include "weed-utils.h"
|       |          ^~~~~~~~~~~~~~
| compilation terminated.
bkauler commented 2 years ago

A quick hack to get past the above error:

do_compile_prepend() {
 #| make[1]: Entering directory '/mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/build/intl'
 #| make[1]: *** No rule to make target 'all-@USE_INCLUDED_LIBINTL@', needed by 'all'.  Stop.
 sed -i -e 's%@USE_INCLUDED_LIBINTL@%no%' ${B}/intl/Makefile
 sed -i -e 's%@BUILD_INCLUDED_LIBINTL@%no%' ${B}/intl/Makefile

 #../../lives-20211222/src/intents.c:8:10: fatal error: weed-utils.h: No such file or directory
 #     8 | #include "weed-utils.h"
 cp -a -f ${S}/libweed/weed.h ${S}/src/
 cp -a -f ${S}/libweed/weed-utils.h ${S}/src/
}
bkauler commented 2 years ago

Looks like have got to the final link step, stops with this error:

| make[1]: *** No rule to make target '/mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/build/../lives-20211222/libweed/libweed.la', needed by 'lives-exe'. Stop.

...it's looking in the wrong place for libweed.la. OpenEmbedded defaults to creating a 'build' folder and doing the build out of the source, this is the problem. The build path is ${B}, and ${B}/libweed/libweed.la exists.

I can try another hack, force OE to not do the build in a separate folder. Putting that force override into the recipe... yes, that works. But another error.

bkauler commented 2 years ago

It seems to be looking at libjack.so in the host system, instead of inside OE:

| /mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/recipe-sysroot-native/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/9.3.0/ld: /usr/lib/libjack.so: undefined reference to `PW_LOG_TOPIC_DEFAULT'
| collect2: error: ld returned 1 exit status
| make[1]: *** [Makefile:1065: lives-exe] Error 1

In my host system, jack libraries are provided by pipewire. The OE build is trying to use the host library and is seeing missing symbols.

I tried with "--disable-jack" but oh no, that introduces so many new compile errors!

bkauler commented 2 years ago

Like this one:

 main.c: At top level:
| main.c:2552:3: error: expected identifier or '(' before 'if'
|  2552 |   if (future_prefs->jack_opts & JACK_INFO_TEST_SETUP) {
|       |   ^~

Seems that lives cannot handle disabling jack.

bkauler commented 2 years ago

A fix for OE trying to access /usr/lib/libjack.so in host system, though once again it would have been better to fix before the Makefile gets created:

do_compile_prepend() {
 #| make[1]: Entering directory '/mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/build/intl'
 #| make[1]: *** No rule to make target 'all-@USE_INCLUDED_LIBINTL@', needed by 'all'.  Stop.
 sed -i -e 's%@USE_INCLUDED_LIBINTL@%no%' ${B}/intl/Makefile
 sed -i -e 's%@BUILD_INCLUDED_LIBINTL@%no%' ${B}/intl/Makefile

 #../../lives-20211222/src/intents.c:8:10: fatal error: weed-utils.h: No such file or directory
 #     8 | #include "weed-utils.h"
 cp -a -f ${S}/libweed/weed.h ${S}/src/
 cp -a -f ${S}/libweed/weed-utils.h ${S}/src/

 #| /mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/recipe-sysroot-native/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/9.3.0/ld: /usr/lib/libjack.so: undefined reference to `PW_LOG_TOPIC_DEFAULT'
 #| collect2: error: ld returned 1 exit status
 sed -i -e 's%-L/usr/lib%%' ${S}/Makefile
 sed -i -e 's%-L/usr/lib%%' ${S}/src/Makefile
}

This is the line in the Makefile that is wrong:

JACK_SERVER_LIBS = -L/usr/lib -ljackserver

bkauler commented 2 years ago

Onto the next error:

| x86_64-poky-linux-libtool: compile:  x86_64-poky-linux-gcc -m64 -march=nocona -mtune=nocona -mno-sse3 -mfpmath=sse -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/recipe-sysroot -DPACKAGE_NAME=\"LiVES\" -DPACKAGE_TARNAME=\"lives\" -DPACKAGE_VERSION=\"3.2.1-pre\" "-DPACKAGE_STRING=\"LiVES 3.2.1-pre\"" -DPACKAGE_BUGREPORT=\"https://github.com/salsaman/LiVES/issues\" -DPACKAGE_URL=\"http://lives-video.com\" -DPACKAGE=\"lives\" -DVERSION=\"3.2.1-pre\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -D__EXTENSIONS__=1 -D_ALL_SOURCE=1 -D_GNU_SOURCE=1 -D_POSIX_PTHREAD_SEMANTICS=1 -D_TANDEM_SOURCE=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DSTDC_HEADERS=1 -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DGETTEXT_PACKAGE=\"lives\" -DLOCALEDIR=\"/usr/share/locale\" -DPREFIX=\"/usr\" -DLiVES_VERSION=\"3.2.1-pre\" -DENABLE_NLS=1 -DHAVE_GETTEXT=1 -DHAVE_DCGETTEXT=1 -DHAVE_LIBDL=1 -DHAVE_POSIX_MEMALIGN=1 -DHAVE_POSIX_FADVISE=1 -DHAVE_POSIX_FALLOCATE=1 -DHAVE_GETENTROPY=1 -DHAVE_SYS_PRCTL_H=1 -DHAVE_LINUX_JOYSTICK_H=1 -DHAVE_JACK_TRANSPORT_H=1 -DHAVE_BZLIB_H=1 -DHAVE_LINUX_VIDEODEV2_H=1 -DHAVE_LIBRAW1394_RAW1394_H=1 -DHAVE_LIBAVC1394_AVC1394_H=1 -DHAVE_LIBAVC1394_ROM1394_H=1 -I. -DHAVE_LIBAV_LIBS=1 -Wno-unused-function -DHAVE_AVCODEC_OPEN2=1 -DHAVE_AVCODEC_ALLOC_CONTEXT3=1 -DHAVE_AVCODEC_GET_NAME=1 -DHAVE_AVCODEC_SEND_PACKET=1 -DHAVE_AV_CODEC_SET_PKT_TIMEBASE=1 -DHAVE_AVFORMAT_NEW_STREAM=1 -DHAVE_AVPACKET_UNREF=1 -DHAVE_AVFRAME_UNREF=1 -DHAVE_AVFORMAT_FIND_STREAM_INFO=1 -DHAVE_AVFORMAT_CLOSE_INPUT=1 -DHAVE_AVPRIV_SET_PTS_INFO=1 -fPIC -DPIC -DNEED_LOCAL_WEED=1 -DNEED_LOCAL_WEED_COMPAT=1 -DNEED_LOCAL_WEED_PLUGIN=1 -Wno-deprecated-declarations -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6=/usr/src/debug/lives/20211222-r6 -fdebug-prefix-map=/mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6=/usr/src/debug/lives/20211222-r6 -fdebug-prefix-map=/mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/recipe-sysroot= -fdebug-prefix-map=/mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/recipe-sysroot-native= -Wall -c mkv_decoder.c  -fPIC -DPIC -o .libs/mkv_decoder_la-mkv_decoder.o
| mkv_decoder.c: In function 'get_frame':
| mkv_decoder.c:2663:30: error: 'lives_mkv_priv_t' {aka 'struct <anonymous>'} has no member named 'last_fryame'; did you mean 'last_frame'?
|  2663 |     } else nextframe = priv->last_fryame + 1;
|       |                              ^~~~~~~~~~~
|       |                              last_frame
| make[3]: *** [Makefile:808: mkv_decoder_la-mkv_decoder.lo] Error 1
bkauler commented 2 years ago

For comparison, I have attempted to compile lives in the host system. It hit that same bug, missing weed.h and weed-utils.h, as documented above.

Then hit the same error as previous post, a missing struct member.

So, two errors that are nothing to do with the cross-compile environment.

bkauler commented 2 years ago

Success, compiled in OpenEmbedded!

For the record, if anyone else wants to cross-compile lives, my source is from master at 26 December 2021. This is the recipe, file 'lives_20211222.bb':

# Recipe created by recipetool
# recipetool create -o lives_20211222.bb https://distro.ibiblio.org/easyos/source/alphabetical/l/lives-20211222.tar.gz

LICENSE = "GPLv3 & LGPLv3 & LGPLv2.1"
LIC_FILES_CHKSUM = "file://COPYING;md5=f27defe1e96c2e1ecd4e0c9be8967949 \
                    file://COPYING.LGPL;md5=59cf55ceb3219acc195418308b48f82e \
                    file://src/giw/COPYING;md5=22c72e3134a91cc1a6afc9e296b50069 \
                    file://lives-plugins/plugins/encoders/COPYING;md5=f27defe1e96c2e1ecd4e0c9be8967949 \
                    file://lives-plugins/plugins/playback/video/COPYING;md5=f27defe1e96c2e1ecd4e0c9be8967949 \
                    file://lives-plugins/weed-plugins/COPYING;md5=f27defe1e96c2e1ecd4e0c9be8967949"

SRC_URI = "https://distro.ibiblio.org/easyos/source/alphabetical/l/lives-${PV}.tar.gz \
           file://cross-compile-fix.patch"

SRC_URI[md5sum] = "607740eb4a0f615a8de0d502e85838ba"
SRC_URI[sha256sum] = "c430c8675aa7e43bdd8c1524518821953b17256fdac37af2c10e4f568eb379bc"

# NOTE: unable to map the following pkg-config dependencies:
#  libweed-compat libvisual libweed-plugin liboil-0.3 libweed-utils libvisual-0.4 
#  gdk-wayland-3.0 libprojectM libfreenect opencv4 libweed libexplain opencv
DEPENDS = "glib-2.0 gtk+3 libtheora fftw unicap libsdl libxrender libpng \
           libogg ffmpeg mesa mjpegtools orc libdv pulseaudio zlib libx11 \
           alsa-lib schroedinger libtirpc ghostscript unicap jack \
           libebml glib-2.0-native libdv sox mpv libmatroska v4l-utils \
           libsdl-mixer libsdl-ttf libsdl-gfx bzip2 jpeg cups cups-filters \
           imagemagick"

#error with separate 'build' folder, so use 'autotools-brokensep'
#| make[1]: *** No rule to make target '/mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/build/../lives-20211222/libweed/libweed.la', needed by 'lives-exe'.  Stop.

inherit gettext perlnative pkgconfig autotools-brokensep

EXTRA_OECONF = "--disable-doxygen --enable-threads=posix"

#attempting to fix:
# error: ../../libOSC/client/.libs/libOSC_client.a: No such file or directory
#PARALLEL_MAKE = "-j1"
#No, this fixes it:
# ref: https://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html
DISABLE_STATIC = ""

do_configure_prepend() {
 #ERROR: Use of AM_GNU_GETTEXT without [external] argument is no longer supported.
 sed -i -e 's%^AM_GNU_GETTEXT$%AM_GNU_GETTEXT([external])%' ${S}/configure.ac
}

do_compile_prepend() {
 #| make[1]: Entering directory '/mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/build/intl'
 #| make[1]: *** No rule to make target 'all-@USE_INCLUDED_LIBINTL@', needed by 'all'.  Stop.
 sed -i -e 's%@USE_INCLUDED_LIBINTL@%no%' ${B}/intl/Makefile
 sed -i -e 's%@BUILD_INCLUDED_LIBINTL@%no%' ${B}/intl/Makefile

 #../../lives-20211222/src/intents.c:8:10: fatal error: weed-utils.h: No such file or directory
 #     8 | #include "weed-utils.h"
 cp -a -f ${S}/libweed/weed.h ${S}/src/
 cp -a -f ${S}/libweed/weed-utils.h ${S}/src/

 #| /mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/recipe-sysroot-native/usr/bin/x86_64-poky-linux/../../libexec/x86_64-poky-linux/gcc/x86_64-poky-linux/9.3.0/ld: /usr/lib/libjack.so: undefined reference to `PW_LOG_TOPIC_DEFAULT'
 #| collect2: error: ld returned 1 exit status
 sed -i -e 's%-L/usr/lib % %' ${S}/Makefile
 sed -i -e 's%-L/usr/lib % %' ${S}/src/Makefile

 #fix typo
 sed -i -e 's%last_fryame%last_frame%' ${S}/lives-plugins/plugins/decoders/mkv_decoder.c
}

#ERROR: lives-20211222-r6 do_package_qa: QA Issue: /usr/lib/lives/plugins/effects/rendered/wave contained in package lives requires /usr/bin/perl, but no providers found in RDEPENDS_lives? [file-rdeps]
ERROR_QA_remove = "file-rdeps"

HOMEPAGE = "http://lives-video.com/"
SUMMARY = "Video editing"

And here is the patch file 'cross-compile-fix.patch':

diff -Naur lives-3.2.0ORIG/configure.ac lives-3.2.0/configure.ac
--- lives-3.2.0ORIG/configure.ac    2020-11-08 23:11:10.000000000 +0800
+++ lives-3.2.0/configure.ac    2021-12-19 02:56:46.100277625 +0800
@@ -95,14 +95,6 @@
 AM_CONDITIONAL(IS_MINGW,$IS_MINGW)
 AM_CONDITIONAL(IS_FREEBSD,$IS_FREEBSD)

-if test "$IS_MINGW" = "false"; then
-AC_CHECK_FILE(lives-plugins/Makefile.am,,[
-echo "LiVES plugins were not found. Please make sure you have checked them out."
-echo
-echo
-exit
-])
-fi

 IS_X86_64="false"
salsaman commented 2 years ago

Phew, a lot of messages ! I'll tackle them one by one. 1) if you did the full patch as I seuggested then "intl" won't get compiled, so all of those errors are moot.

2) adding --disable-static will break compilation, as LiVES needs to statically link libOSC, which is why you are seeing that error.

3) not finding weed-utils.h -- looks like something got messed up. You should run autoconf, automake, configure, and make clean, before trying to build the package. Same thing with libweed.

You have two options really - build lives and libweed together, this will force the program to link with the local weed libraries. The alternative is to run configure / make install twice - in this case libweed will get installed on the first pass, and then on the second, lives will link with the system installed libs.

For building packages the recomended way is the latter. make install once, then separate the libweed files and compiled libs and package them as libweed / libweed-dev. Then run configure / make install a second time. This time lives will link with the preinstalled weed libs / includes and you can build a package excluding libweed.

The missing libweed.a message is generated during the first pass, LiVES is trying to link with the local copy of the library, and not finding it - most likely due to an interrupted build, make clean should resolve this and allow you to complete the first pass.

salsaman commented 2 years ago

Regarding jack issues. all of the jack values, eg. JACK_SERVER_LIBS are set via pkg-config, eg. pkg-config --variable=server_libs jack

If you are cross compiling then likely you need to set one or more of: PKG_CONFIG, PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR to point to the correct locations on the target rather than on the host.

salsaman commented 2 years ago

So what I recommend is the following start with a fresh build: sudo make uninstall && sudo make clean ./autogen.sh export PKG_CONFIG= export PKG_CONFIG_LIBDIR=... (colon separated list of pkgconfig dirs on target)

./configure [options without --disable-static] the only other flags needed would be to define directories on the target system, --enable- and --disable- should work automatically provided PKG_CONFIG_LIBDIR is set correctly

then try running make / make install again.

If that works, then you can do as I recommended....package up libweed, and then run ./configure / make /make install again and packege the remaining files (without libweed). You shouldn't need to package intl, since the new patch makes that unnecessary.

salsaman commented 2 years ago

I'll check out the jack issues, it may be that there are some new issues arising when jack is not detected or is disabled.

bkauler commented 2 years ago

Thanks for the feedback.

Regarding missing weed-utils.h, as I posted above, I also got that when compiled lives on the host system, using the normal steps, autogen.sh, followed by configure, then make.

OpenEmbedded does not run the autogen.sh script if it exists in the source code, as OE has to do a lot of stuff to make sure the build will work in a cross-compile environment. Hence, it runs its own equivalent to autogen.sh, and imposes its own options to the configure step.

It is theoretically possible to override what OE does and create my own code for autogen and configure in the recipe file, but that is not easy.

OE also uses pkg-config to find correct settings for dependencies, but something is wrong with jack detection.

Note, I have compiled lots of packages in OE with jack dependency, without issue, so OE is doing it right.

For example, yesterday I compiled OBS-Studio, a video recorder and live streamer, and every dep. got detected correctly, including jack.

The only issue that I got with OBS-Studio, is it failed to test if gcc supports "-pthread". Worked around that one, and the build succeeded:

https://bkhome.org/news/202112/obs-studio-compiled-in-openembedded.html

I understand your point about bypassing 'intl' folder, that would have been better.

bkauler commented 2 years ago

I had a closer look at that problem created Makefile with "JACK_SERVER_LIBS = -L/usr/lib -ljackserver"

It looks like it might be an issue with OE. OE has a wrapper around pkg-config, and prepends paths for the -I include paths, and screens out -L parameters. I looked at audacious music players, which has jack as a dep, and it doesn't query "server_libs", only "libs", which is ok.

/usr/lib/pkgconfig/jack.pc:

prefix=/usr
exec_prefix=/usr
libdir=/usr/lib
includedir=/usr/include
server_libs=-L/usr/lib -ljackserver

Name: jack
Description: the Jack Audio Connection Kit: a low-latency synchronous callback-based media server
Version: 1.9.14
Libs: -L/usr/lib -ljack
Cflags: -I/usr/include

...it seems that OE does not parse that "server_libs" entry, and the "-L/usr/lib" gets through into the Makefile.

For example, the 'orc' package in the Makefile, shows how -I gets a path prepended, and screened out the -L parameter:

ORC_CFLAGS = -I/mnt/sda1/nvme/oe-builds/oe-quirky/build-amd64/tmp/work/nocona-64-poky-linux/lives/20211222-r6/recipe-sysroot/usr/include/orc-0.4
ORC_LIBS = -lorc-0.4

This is orc-0.4.pc:

prefix=/usr
exec_prefix=/usr
libdir=/usr/lib
includedir=/usr/include/orc-0.4
toolsdir=${exec_prefix}/bin

Name: orc-0.4
Description: Library of Optimized Inner Loops Runtime Compiler
Version: 0.4.31
Libs: -L${libdir} -lorc-0.4
Libs.private: -lm  -lpthread
Cflags: -I${includedir}

orcc=${toolsdir}/orcc
salsaman commented 2 years ago

Well I would say there is a bug in your pkg-config wrapper. It should certainly pass in any parameters unaltered. We need to get the jack_server flags, and it is the only correct way to do so. If the wrapper needs to set and ./ or add paths, the correct way is to export PKG_CONFIG, PKG_CONFIG_PATH, and PKG_CONFIG_LIBDIR as mentioned above, which would allow these to be overridden on the commandline. Obviously you are going to have problems if the paths are hardcoded, and you are compiling for a different target.

weed-utils.h should either be in libweed (first build pass), or else installed in /usr/include/weed/ (set by pkg-config --cflags libweed-utils) on subsequent builds. Another pkg-config issue maybe ?

I did some testing with --disable-jack and also --disable-pulse. Indeed, the code needs readjusting to properly handle those. Fixing things so that --disable-jack worked was not so difficult, but --disable-pulse threw out a lot of errors. I'll need to look further into this, but I may not get a chance until the new year.

(Fixing jack issues is mainly just adding #ifdef ENABLE_JACK / #endif)

bkauler commented 2 years ago

Thanks for the feedback. I suppose this issue can now be closed, as I achieved the goal of a successful cross-compile build, although the recipe could do with some improvements.

I see your commits yesterday, Dec. 26, that's great.