Message ID | 20200102114347.2403649-1-chrismcc@gmail.com |
---|---|
State | Changes Requested |
Headers | show |
Series | [1/2] package/perl-dbd-mysql: bump to version 4.050 | expand |
On Thu, Jan 2, 2020 at 3:44 AM Christopher McCrory <chrismcc@gmail.com> wrote: > version 4.046_01 fixes compiling against mariadb and also introduces a > patch > that brakes with cross compiling, see patch 0001. > Also the buildroot host-perl ModuleManager gets somthing wrong looking for > libraries. Instead of checking in the build sysroot, it looks in the host > systems /lib, /usr/lib, etc. For a successful build, the host system will > also need the matching mysql libraries installed. Running ldd on mysql.so > should show libmysqlclient, and libmariadb for MariaDB. If the result spits > out an error about missing libraries, this is the reason. > This is probably the only builtroot package where this is an issue. > > Signed-off-by: Christopher McCrory <chrismcc@gmail.com> > - > > > I am successfully using this on a raspberrypi 3 using MariaDB. php-mysql works there also. For MariaDB I also needed:: chrismcc@centos8-lxc git]$ cat external/packages/fixup-mariadb/ fixup-mariadb.mk ################################################################################ # # fixup-mariadb # ################################################################################ ifeq ($(BR2_PACKAGE_FIXUP_MARIADB),y) define MARIADB_POST_INSTALL_STAGING_MORE $(RM) -v $(STAGING_DIR)/usr/bin/mariadb_config endef MARIADB_POST_INSTALL_STAGING_HOOKS += MARIADB_POST_INSTALL_STAGING_MORE define MARIADB_POST_INSTALL_MORE $(RM) -r $(TARGET_DIR)/usr/data endef MARIADB_POST_INSTALL_TARGET_HOOKS += MARIADB_POST_INSTALL_MORE endif $(eval $(generic-package))
Hello, +François Perrad in Cc. On Thu, 2 Jan 2020 11:43:46 +0000 Christopher McCrory <chrismcc@gmail.com> wrote: > diff --git a/package/perl-dbd-mysql/0001-Allow-cross-compile-on-buildroot.patch b/package/perl-dbd-mysql/0001-Allow-cross-compile-on-buildroot.patch > new file mode 100644 > index 0000000000..0431e0092a > --- /dev/null > +++ b/package/perl-dbd-mysql/0001-Allow-cross-compile-on-buildroot.patch > @@ -0,0 +1,46 @@ > +From e6689e55fb56a83f227e59d3fa258553d32524fa Mon Sep 17 00:00:00 2001 > +From: Christopher McCrory <chrismcc@gmail.com> > +Date: Thu, 2 Jan 2020 07:53:20 +0000 > +Subject: [PATCH 1/1] Allow cross compile on buildroot > + > +starting in 4.046_01 Devel::CheckLib is used to check if all needed libraries > +are available. It is not cross compile friendly. Disable it and hope for the > +best. > + > +Signed-off-by: Christopher McCrory <chrismcc@gmail.com> Has this issue been reported upstream? Can we make the Makefile.PL smarter and avoid this check when cross-compiling ? > diff --git a/package/perl-dbd-mysql/perl-dbd-mysql.mk b/package/perl-dbd-mysql/perl-dbd-mysql.mk > index 98521a78cf..c17788598c 100644 > --- a/package/perl-dbd-mysql/perl-dbd-mysql.mk > +++ b/package/perl-dbd-mysql/perl-dbd-mysql.mk > @@ -4,9 +4,19 @@ > # > ################################################################################ > > -PERL_DBD_MYSQL_VERSION = 4.046 > +# version 4.046_01 fixes compiling against mariadb and also introduces a patch > +# that brakes with cross compiling, see patch 0001. This comment is not relevant in the .mk file. > +# Also the buildroot host-perl ModuleManager gets somthing wrong looking for > +# libraries. Instead of checking in the build sysroot, it looks in the host > +# systems /lib, /usr/lib, etc. For a successful build, the host system will > +# also need the matching mysql libraries installed. This is not acceptable for Buildroot, and needs to be fixed before we can apply this version bump. Thomas
On Thu, 2 Jan 2020 03:55:43 -0800 Christopher McCrory <chrismcc@gmail.com> wrote: > For MariaDB I also needed:: > > chrismcc@centos8-lxc git]$ cat external/packages/fixup-mariadb/ > fixup-mariadb.mk > ################################################################################ > # > # fixup-mariadb > # > ################################################################################ > > ifeq ($(BR2_PACKAGE_FIXUP_MARIADB),y) > > define MARIADB_POST_INSTALL_STAGING_MORE > $(RM) -v $(STAGING_DIR)/usr/bin/mariadb_config > endef > > MARIADB_POST_INSTALL_STAGING_HOOKS += MARIADB_POST_INSTALL_STAGING_MORE Why is it necessary to remove this file from staging? This doesn't seem right. > define MARIADB_POST_INSTALL_MORE > $(RM) -r $(TARGET_DIR)/usr/data > endef What is this removing? Why is it important? Do we want to have this removal in mariadb.mk in upstream Buildroot? Best regards, Thomas
On Thu, Jan 2, 2020 at 5:35 AM Thomas Petazzoni < thomas.petazzoni@bootlin.com> wrote: > On Thu, 2 Jan 2020 03:55:43 -0800 > Christopher McCrory <chrismcc@gmail.com> wrote: > > > For MariaDB I also needed:: > > > > chrismcc@centos8-lxc git]$ cat external/packages/fixup-mariadb/ > > fixup-mariadb.mk > > > ################################################################################ > > # > > # fixup-mariadb > > # > > > ################################################################################ > > > > ifeq ($(BR2_PACKAGE_FIXUP_MARIADB),y) > > > > define MARIADB_POST_INSTALL_STAGING_MORE > > $(RM) -v $(STAGING_DIR)/usr/bin/mariadb_config > > endef > > > > MARIADB_POST_INSTALL_STAGING_HOOKS += MARIADB_POST_INSTALL_STAGING_MORE > > Why is it necessary to remove this file from staging? This doesn't seem > right. > > When selecting mariadb to provide mysql instead of oracle-mysql, every package in buildroot that wants to link against libmysqlclient will fail. mysql (from both providers) creates mysql_config, a fancy shell script to output the same as pkgconf would. -I/foo/bar, -L/baz, etc. MariaDB also creates mariadb_config which does the same thing, but instead of a shell script, is written in C. mariadb's mysql_config looks for mariadb_config and if it exists, uses it. When cross compiling for a different architecture, this will fail and most output is blank. If it does not exist, the rest of the shell script is used and outputs the correct bits - chrismcc@centos8-lxc bin]$ ./mariadb_config -bash: ./mariadb_config: cannot execute binary file: Exec format error [chrismcc@centos8-lxc bin]$ file ./mariadb_config ./mariadb_config: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 4.19.0, stripped [chrismcc@centos8-lxc rpi3]$ ./staging/usr/bin/mysql_config Usage: ./staging/usr/bin/mysql_config [OPTIONS] Options: --cflags [-I/home/chrismcc/git/rpi3/staging/usr/include/mysql -I/home/chrismcc/git/rpi3/staging/usr/include/mysql/.. ] --include [-I/home/chrismcc/git/rpi3/staging/usr/include/mysql -I/home/chrismcc/git/rpi3/staging/usr/include/mysql/..] --libs [-L/home/chrismcc/git/rpi3/staging/usr/lib/mysql -lmariadb -lpthread -lz -ldl -lm -lssl -lcrypto] --libs_r [-L/home/chrismcc/git/rpi3/staging/usr/lib/mysql -lmariadb -lpthread -lz -ldl -lm -lssl -lcrypto] etc. [chrismcc@centos8-lxc rpi3]$ cp target/usr/bin/mariadb_config staging/usr/bin/ -vb 'target/usr/bin/mariadb_config' -> 'staging/usr/bin/mariadb_config' [chrismcc@centos8-lxc rpi3]$ ./staging/usr/bin/mysql_config ./staging/usr/bin/mysql_config: line 100: /home/chrismcc/git/rpi3/staging/usr/bin/mariadb_config: cannot execute binary file: Exec format error ./staging/usr/bin/mysql_config: line 101: /home/chrismcc/git/rpi3/staging/usr/bin/mariadb_config: cannot execute binary file: Exec format error ./staging/usr/bin/mysql_config: line 102: /home/chrismcc/git/rpi3/staging/usr/bin/mariadb_config: cannot execute binary file: Exec format error ./staging/usr/bin/mysql_config: line 103: /home/chrismcc/git/rpi3/staging/usr/bin/mariadb_config: cannot execute binary file: Exec format error ./staging/usr/bin/mysql_config: line 104: /home/chrismcc/git/rpi3/staging/usr/bin/mariadb_config: cannot execute binary file: Exec format error ./staging/usr/bin/mysql_config: line 105: /home/chrismcc/git/rpi3/staging/usr/bin/mariadb_config: cannot execute binary file: Exec format error ./staging/usr/bin/mysql_config: line 106: /home/chrismcc/git/rpi3/staging/usr/bin/mariadb_config: cannot execute binary file: Exec format error Usage: ./staging/usr/bin/mysql_config [OPTIONS] Options: --cflags [] --include [] --libs [] --libs_r [] --plugindir [] --socket [] --port [] --version [] --libmysqld-libs [-L/home/chrismcc/git/rpi3/staging/usr/lib/mysql -lmysqld] --variable=VAR VAR is one of: pkgincludedir [/home/chrismcc/git/rpi3/staging/usr/include/mysql] pkglibdir [/home/chrismcc/git/rpi3/staging/usr/lib/mysql] plugindir [] make rsyslog ... aking all in plugins/ommysql CC ommysql_la-ommysql.lo ommysql.c:37:10: fatal error: mysql.h: No such file or directory #include <mysql.h> ^~~~~~~~~ compilation terminated. make[4]: *** [Makefile:553: ommysql_la-ommysql.lo] Error 1 make[3]: *** [Makefile:918: all-recursive] Error 1 make[2]: *** [Makefile:745: all] Error 2 make[1]: *** [package/pkg-generic.mk:260: /home/chrismcc/git/rpi3/build/rsyslog-8.1911.0/.stamp_built] Error 2 make: *** [Makefile:23: _all] Error 2 grep -r mysql_config buildroot/package/should show a few others. Other packages would have it in the source code. So, When selecting mariadb to provide mysql instead of oracle-mysql, every package in buildroot that wants to link against libmysqlclient via mysql_config will fail. $(RM) -v $(STAGING_DIR)/usr/bin/mariadb_config fixes that. I suspect the autobuilders never select the alternate for a virtual package. mysql, libssl, etc. Otherwise this should have shown up earlier. > > define MARIADB_POST_INSTALL_MORE > > $(RM) -r $(TARGET_DIR)/usr/data > > endef > > What is this removing? Why is it important? Do we want to have this > removal in mariadb.mk in upstream Buildroot? > > Its extra from all the tests that make install spews out. Yes it could be in the mariasd.mk file. > Best regards, > > Thomas > -- > Thomas Petazzoni, CTO, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com >
diff --git a/package/perl-dbd-mysql/0001-Allow-cross-compile-on-buildroot.patch b/package/perl-dbd-mysql/0001-Allow-cross-compile-on-buildroot.patch new file mode 100644 index 0000000000..0431e0092a --- /dev/null +++ b/package/perl-dbd-mysql/0001-Allow-cross-compile-on-buildroot.patch @@ -0,0 +1,46 @@ +From e6689e55fb56a83f227e59d3fa258553d32524fa Mon Sep 17 00:00:00 2001 +From: Christopher McCrory <chrismcc@gmail.com> +Date: Thu, 2 Jan 2020 07:53:20 +0000 +Subject: [PATCH 1/1] Allow cross compile on buildroot + +starting in 4.046_01 Devel::CheckLib is used to check if all needed libraries +are available. It is not cross compile friendly. Disable it and hope for the +best. + +Signed-off-by: Christopher McCrory <chrismcc@gmail.com> +--- + Makefile.PL | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/Makefile.PL b/Makefile.PL +index 0bf733c..668d722 100644 +--- a/Makefile.PL ++++ b/Makefile.PL +@@ -9,7 +9,8 @@ use Config; + use Getopt::Long; + use ExtUtils::MakeMaker; + use Data::Dumper; +-use Devel::CheckLib; ++# broken on cross compile ++# use Devel::CheckLib; + use File::Path; + use File::Copy; + use File::Basename; +@@ -207,9 +208,11 @@ MSG + + print "Checking if libs are available for compiling...\n"; + +-assert_lib( +- LIBS => ($opt->{'embedded'} ? $opt->{'embedded'} : $opt->{libs}), +-); ++print "Skipping, broken on cross compile\n"; ++ ++#assert_lib( ++# LIBS => ($opt->{'embedded'} ? $opt->{'embedded'} : $opt->{libs}), ++#); + + print "Looks good.\n\n"; + +-- +2.18.1 + diff --git a/package/perl-dbd-mysql/perl-dbd-mysql.hash b/package/perl-dbd-mysql/perl-dbd-mysql.hash index 51de476095..a2048ce5ff 100644 --- a/package/perl-dbd-mysql/perl-dbd-mysql.hash +++ b/package/perl-dbd-mysql/perl-dbd-mysql.hash @@ -1,6 +1,6 @@ # retrieved by scancpan from http://cpan.metacpan.org/ -md5 bdf4f4d899b8af29ebd8ebfb7438d05f DBD-mysql-4.046.tar.gz -sha256 6165652ec959d05b97f5413fa3dff014b78a44cf6de21ae87283b28378daf1f7 DBD-mysql-4.046.tar.gz +md5 29b1f61321d0892885ccfd0e7bc07f7f DBD-mysql-4.050.tar.gz +sha256 4f48541ff15a0a7405f76adc10f81627c33996fbf56c95c26c094444c0928d78 DBD-mysql-4.050.tar.gz # computed by scancpan sha256 7a9ba29702b957805cfa8aa63bca43175625824263232dbade0010d385ab888c LICENSE diff --git a/package/perl-dbd-mysql/perl-dbd-mysql.mk b/package/perl-dbd-mysql/perl-dbd-mysql.mk index 98521a78cf..c17788598c 100644 --- a/package/perl-dbd-mysql/perl-dbd-mysql.mk +++ b/package/perl-dbd-mysql/perl-dbd-mysql.mk @@ -4,9 +4,19 @@ # ################################################################################ -PERL_DBD_MYSQL_VERSION = 4.046 +# version 4.046_01 fixes compiling against mariadb and also introduces a patch +# that brakes with cross compiling, see patch 0001. +# Also the buildroot host-perl ModuleManager gets somthing wrong looking for +# libraries. Instead of checking in the build sysroot, it looks in the host +# systems /lib, /usr/lib, etc. For a successful build, the host system will +# also need the matching mysql libraries installed. Running ldd on mysql.so +# should show libmysqlclient, and libmariadb for MariaDB. If the result spits +# out an error about missing libraries, this is the reason. +# This is probably the only builtroot package where this is an issue. + +PERL_DBD_MYSQL_VERSION = 4.050 PERL_DBD_MYSQL_SOURCE = DBD-mysql-$(PERL_DBD_MYSQL_VERSION).tar.gz -PERL_DBD_MYSQL_SITE = $(BR2_CPAN_MIRROR)/authors/id/C/CA/CAPTTOFU +PERL_DBD_MYSQL_SITE = $(BR2_CPAN_MIRROR)/authors/id/D/DV/DVEEDEN PERL_DBD_MYSQL_DEPENDENCIES = \ host-perl-dbi \ mysql
version 4.046_01 fixes compiling against mariadb and also introduces a patch that brakes with cross compiling, see patch 0001. Also the buildroot host-perl ModuleManager gets somthing wrong looking for libraries. Instead of checking in the build sysroot, it looks in the host systems /lib, /usr/lib, etc. For a successful build, the host system will also need the matching mysql libraries installed. Running ldd on mysql.so should show libmysqlclient, and libmariadb for MariaDB. If the result spits out an error about missing libraries, this is the reason. This is probably the only builtroot package where this is an issue. Signed-off-by: Christopher McCrory <chrismcc@gmail.com> --- ...001-Allow-cross-compile-on-buildroot.patch | 46 +++++++++++++++++++ package/perl-dbd-mysql/perl-dbd-mysql.hash | 4 +- package/perl-dbd-mysql/perl-dbd-mysql.mk | 14 +++++- 3 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 package/perl-dbd-mysql/0001-Allow-cross-compile-on-buildroot.patch