Rebuilding mariadb fails on aarch64

Problems with packages? Post here, using [tags] of the package name.

Rebuilding mariadb fails on aarch64

Postby jernst » Mon Dec 30, 2024 12:55 am

Unchanged mariadb PKGBUILD from github.com/archlinuxarm/PKGBUILDs. The build fails at the very end:

```
[ 98%] Built target symlink_libmysqld.a
[ 98%] Building CXX object libmysqld/CMakeFiles/libmysqld.dir/libmysqld_exports_file.cc.o
[ 98%] Linking CXX shared library libmariadbd.so
/usr/bin/ld: warning: -z pack-relative-relocs ignored
/usr/bin/ld: ../tpool/libtpool.a(aio_simulated.cc.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_ZTVN5tpool13simulated_aioE' which may bind externally can not be used when making a shared object; recompile with -fPIC
../tpool/libtpool.a(aio_simulated.cc.o): in function `tpool::simulated_aio::simulated_aio(tpool::thread_pool*)':
```

and then lots of linker messages like this one.

Ends with:

```
collect2: error: ld returned 1 exit status
make[2]: *** [libmysqld/CMakeFiles/libmysqld.dir/build.make:107: libmysqld/libmariadbd.so.19] Error 1
make[1]: *** [CMakeFiles/Makefile2:9548: libmysqld/CMakeFiles/libmysqld.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
```

I don't know much about compiler/linker settings on ARM. But how is it possible that there is a built package in the repo, but the PKGBUILD from git does not build?
jernst
 
Posts: 78
Joined: Tue Aug 20, 2013 4:22 pm
Location: Silicon Valley

Re: Rebuilding mariadb fails on aarch64

Postby graysky » Mon Dec 30, 2024 9:54 am

Built fine for me in a clean chroot. Not sure what your environment has that might be messing with it. Recommend you build in a clean chroot and see if it helps.

...
[ 97%] Built target symlink_libmysqld.a
[ 97%] Building CXX object libmysqld/examples/CMakeFiles/mariadb-embedded.dir/__/__/client/mysql.cc.o
[ 97%] Linking CXX shared library libmariadbd.so
[ 97%] Building CXX object libmysqld/examples/CMakeFiles/mariadb-embedded.dir/__/__/client/readline.cc.o
[ 97%] Building C object libmysqld/examples/CMakeFiles/mariadb-client-test-embedded.dir/__/__/tests/mysql_client_test.c.o
[ 98%] Linking CXX executable mariadb-embedded
/build/mariadb/src/mariadb/client/mysqltest.cc: In function 'int check_result()':
/build/mariadb/src/mariadb/client/mysqltest.cc:2292:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
/build/mariadb/src/mariadb/client/mysqltest.cc:2294:3: note: here
/build/mariadb/src/mariadb/client/mysqltest.cc:2295:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
/build/mariadb/src/mariadb/client/mysqltest.cc:2298:3: note: here
/build/mariadb/src/mariadb/client/mysqltest.cc: In function 'int main(int, char**)':
/build/mariadb/src/mariadb/client/mysqltest.cc:10526:2: warning: this statement may fall through [-Wimplicit-fallthrough=]
/build/mariadb/src/mariadb/client/mysqltest.cc:10533:7: note: here
[ 98%] Linking CXX executable mariadb-test-embedded
[ 98%] Linking CXX executable mariadb-client-test-embedded
[ 98%] Built target sql
[ 98%] Building CXX object unittest/embedded/CMakeFiles/test-connect-t.dir/test-connect.cc.o
...
graysky
Developer
 
Posts: 1879
Joined: Sun Jun 26, 2011 6:56 am
Location: /run/user/1000

Re: Rebuilding mariadb fails on aarch64

Postby darksky » Mon Dec 30, 2024 8:36 pm

"I don't know much about compiler/linker settings on ARM. But how is it possible that there is a built package in the repo, but the PKGBUILD from git does not build?"

I highly suspect you have fallen victim to having the latest /etc/makepkg.conf. It actually has been that way for a while. Maybe you have a newer install or have edited /etc/makepkg.conf with the latest changes from the .pacnew file after a pacman upgrade. I have to make some changes in a few PKGBUILD's here. Kodi being one of them to name one.

I compiled mariadb today and got the same as you with the errors and then add these last 2 lines unsetting and redefining the LDFLAGS here in the PKGBUILD and it compiled ok.

```
# this uses malloc_usable_size, which is incompatible with fortification level 3
export CFLAGS="${CFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
export CXXFLAGS="${CXXFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
unset LDFLAGS
LDFLAGS+="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now"
```

Build log snippet:

```
[ 97%] Building CXX object sql/CMakeFiles/sql.dir/semisync_master.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/semisync_slave.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/semisync_master_ack_receiver.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/sp_instr.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/sql_schema.cc.o
Creating mysqltest_embedded link
Creating mysql_client_test_embedded link
[ 98%] Built target mariadb-test-embedded
[ 98%] Built target mariadb-client-test-embedded
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/lex_charset.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/charset_collations.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/sql_type.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/sql_mode.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/sql_type_json.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/sql_type_string.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/sql_type_geom.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/item_windowfunc.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/sql_window.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/sql_cte.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/item_vers.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/sql_sequence.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/sql_tvc.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/opt_split.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/rowid_filter.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/opt_trace.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/table_cache.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/encryption.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/temporary_tables.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/json_table.cc.o
[ 98%] Building CXX object sql/CMakeFiles/sql.dir/proxy_protocol.cc.o
[ 99%] Building CXX object sql/CMakeFiles/sql.dir/backup.cc.o
[ 99%] Building CXX object sql/CMakeFiles/sql.dir/xa.cc.o
[ 99%] Building C object sql/CMakeFiles/sql.dir/socketpair.c.o
[ 99%] Building CXX object sql/CMakeFiles/sql.dir/threadpool_generic.cc.o
[ 99%] Building CXX object sql/CMakeFiles/sql.dir/threadpool_common.cc.o
[ 99%] Linking CXX static library libsql.a
[ 99%] Built target sql
[ 99%] Building CXX object sql/CMakeFiles/mariadbd.dir/main.cc.o
[ 99%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/xtrabackup.cc.o
[ 99%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/datasink.cc.o
[ 99%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/innobackupex.cc.o
[ 99%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/ds_buffer.cc.o
[ 99%] Linking CXX executable mariadbd
[ 99%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/ds_compress.cc.o
[ 99%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/ds_local.cc.o
[ 99%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/ds_stdout.cc.o
[ 99%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/ds_tmpfile.cc.o
[ 99%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/ds_xbstream.cc.o
[ 99%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/fil_cur.cc.o
[ 99%] Building C object extra/mariabackup/CMakeFiles/mariadb-backup.dir/quicklz/quicklz.c.o
[ 99%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/read_filt.cc.o
[ 99%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/write_filt.cc.o
[ 99%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/wsrep.cc.o
[ 99%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/xbstream_write.cc.o
[ 99%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/backup_mysql.cc.o
[ 99%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/backup_copy.cc.o
[ 99%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/encryption_plugin.cc.o
[100%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/__/__/sql/sql_builtin.cc.o
[100%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/aria_backup_client.cc.o
[100%] Building CXX object extra/mariabackup/CMakeFiles/mariadb-backup.dir/thread_pool.cc.o
Creating mysqld link
[100%] Built target mariadbd
...
...
==> Leaving fakeroot environment.
==> Finished making: mariadb 11.6.2-2 (Mon 30 Dec 2024 02:15:03 PM CST)

real 47m12.847s
user 14m10.651s
sys 3m1.676s
```
darksky
 
Posts: 48
Joined: Thu Oct 15, 2020 5:57 pm


Return to Packages

Who is online

Users browsing this forum: No registered users and 17 guests