#1 2020-06-15 13:23:58

damiand
Member
From: Greece
Registered: 2018-09-21
Posts: 94

TestSQL3.lpi build fails on GNU/Linux x64

TestSQL3.lpi build fails with the following link error:

(9015) Linking /home/damian/mORMot/SQLite3/fpc/bin/x86_64-linux/TestSQL3
/usr/bin/ld: /home/damian/mORMot/./static/x86_64-linux/sqlite3.o:(.data+0x22b0): undefined reference to `fcntl64'

FPC 3.2.0 / Lazarus 2.0.9, OpenSUSE Leap 15.1

Any ideas?

Offline

#2 2020-06-15 13:47:16

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: TestSQL3.lpi build fails on GNU/Linux x64

Please update your .o files.

Offline

#3 2020-06-15 13:59:00

damiand
Member
From: Greece
Registered: 2018-09-21
Posts: 94

Re: TestSQL3.lpi build fails on GNU/Linux x64

ab wrote:

Please update your .o files.

I've got them from the (synced) git repo. Do I have to get them from somewhere else?

Offline

#4 2020-06-15 14:09:34

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: TestSQL3.lpi build fails on GNU/Linux x64

No, github from today is fine.
My main system is Debian/Ubuntu and I don't have such problem.
Your issue is when linking the libc.

Here are my static folder:
https://gist.github.com/synopse/90ada32 … 5b1e76b720

Offline

#5 2020-06-15 14:35:52

damiand
Member
From: Greece
Registered: 2018-09-21
Posts: 94

Re: TestSQL3.lpi build fails on GNU/Linux x64

My static folder follows. File sizes are the same I think:

damian@ifestos:~/mORMot/static/x86_64-linux> ls -al
σύνολο 4824
drwxr-xr-x  2 damian users     269 Ιούν 13 12:24 .
drwxr-xr-x 15 damian users     284 Ιούν 13 12:24 ..
-rw-r--r--  1 damian users   15328 Ιούν 13 12:24 crc32c64.o
-rw-r--r--  1 damian users   98416 Ιούν 13 12:24 ecclin64O2.o
-rw-r--r--  1 damian users    5272 Ιούν 13 12:24 entropy_common.o
-rw-r--r--  1 damian users   16840 Ιούν 13 12:24 fse_compress.o
-rw-r--r--  1 damian users    7736 Ιούν 13 12:24 fse_decompress.o
-rw-r--r--  1 damian users   13072 Ιούν 13 12:24 huf_compress.o
-rw-r--r--  1 damian users   37968 Ιούν 13 12:24 huf_decompress.o
-rw-r--r--  1 damian users 3003478 Ιούν 13 12:24 libgcc.a
-rw-r--r--  1 damian users  139656 Ιούν 13 12:24 lizard_compress.o
-rw-r--r--  1 damian users   44880 Ιούν 13 12:24 lizard_decompress.o
-rw-r--r--  1 damian users   16016 Ιούν 13 12:24 sha512-x64sse4.o
-rw-r--r--  1 damian users 1512960 Ιούν 13 12:24 sqlite3.o

I repeated the problem in another Linux distro (Linux Lite, which is Ubuntu based). I can't figure out what's happening... neutral

Offline

#6 2020-06-15 14:46:08

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: TestSQL3.lpi build fails on GNU/Linux x64

What is your libc version?

ab@devlaptop:~/dev/lib/SQLite3/amalgamation$ ldd --version
ldd (Ubuntu GLIBC 2.31-0ubuntu9) 2.31

Offline

#7 2020-06-15 17:45:39

damiand
Member
From: Greece
Registered: 2018-09-21
Posts: 94

Re: TestSQL3.lpi build fails on GNU/Linux x64

In my Linux Lite old netbook is 2.23. In my OpenSUSE desktop is 2.26.

Last edited by damiand (2020-06-15 17:54:56)

Offline

#8 2020-06-15 18:18:11

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: TestSQL3.lpi build fails on GNU/Linux x64

I know this old libc issue - binaries compiled on Ubuntu 18.04 not compatible with libc 2.23. For compatibility with libc 2.23 (it comes with CentOS 7 and many production still use CeonOS 7)  I build libraries/program using Ubuntu 16.04
Such binaries compatible with most OS (verified with CentOS 7/8, Oracle Linux, Ubuntu up to 20.04)

Last edited by mpv (2020-06-15 18:19:32)

Offline

#9 2020-06-15 18:38:07

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: TestSQL3.lpi build fails on GNU/Linux x64

I'm currently working on systemd socket activation support for SynCrtSock, so dig a little into systemd and wonder how easy is to run a (for example) Ubuntu 16 with all build tools on any systemd compartible host OS. Hope it helps smile

#create a OCI container file system in /var/lib/machines/ubuntu_16_dev
sudo debootstrap --variant=buildd xenial /var/lib/machines/ubuntu_16_dev http://archive.ubuntu.com/ubuntu/
#set root password
sudo systemd-nspawn -D /var/lib/machines/ubuntu_16_dev
passwd
#type new password for root and when Ctrl+[ 3 times to exit

#run an Ubuntu 16
sudo systemd-nspawn -D /var/lib/machines/ubuntu_16_dev

All data is persisted, sources can be copied into container fs just from main OS results copied back and so on. As more I dig into Linux as more I wonder smile
It took me 6 minutes to install Ubuntu16 on Ubuntu 18.04.

Last edited by mpv (2020-06-15 18:40:19)

Offline

#10 2020-06-16 10:14:47

damiand
Member
From: Greece
Registered: 2018-09-21
Posts: 94

Re: TestSQL3.lpi build fails on GNU/Linux x64

Thanks mpv. So, should I expect the libraries to be rebuilt with Ubuntu 16.04 and update the repository, or do I have to rebuild them myself? In the latter case, how can I do this? roll

Offline

#11 2020-06-16 10:54:03

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: TestSQL3.lpi build fails on GNU/Linux x64

I will rebuild the libraries using another compiler with an older libc...
Then push the new static files...

Offline

#12 2020-06-16 11:20:10

damiand
Member
From: Greece
Registered: 2018-09-21
Posts: 94

Re: TestSQL3.lpi build fails on GNU/Linux x64

Thanks a lot, ab! smile Sorry for the fuss. sad

Offline

#13 2020-06-20 14:01:44

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: TestSQL3.lpi build fails on GNU/Linux x64

Ups, @ab - the same error on Ubuntu 18.04 with GLIBC 2.27-3ubuntu1

Offline

#14 2020-06-24 15:02:03

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: TestSQL3.lpi build fails on GNU/Linux x64

We now use the fpcupdeluxe GCC Windows cross-compilers for the Linux target, even on Linux - using Wine.

It is easier to tune than trying to tweak the built-in GCC compiler.
I was not able to fix Ubuntu 20.04 GCC compiler linking expectations, and a separate compiler was a nightmare - whereas the FPCUpdeluxe Windows cross-compilers are just stand-alone and portable.
We even have a version with very old libc to be able to run Linux exectables on systems from dozen of years age...

We also added preliminary support of FreeBSD and OpenBSD compilation, with the FPCUpDeluxe cross-compilers - running on Linux natively this time, not using Wine.
Thanks Alfred for the help!

Please check the latest static files and https://synopse.info/fossil/info/7da305dde0fc552c
Feedback is welcome.

Offline

#15 2020-06-24 16:51:10

damiand
Member
From: Greece
Registered: 2018-09-21
Posts: 94

Re: TestSQL3.lpi build fails on GNU/Linux x64

I've just built the TestSQL3.lpi project in my old Linux Lite netbook with 2.23 libc. Thanks a lot ab and whoever else helped to solve this problem! smile

Offline

#16 2020-06-25 08:18:46

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: TestSQL3.lpi build fails on GNU/Linux x64

Hi Ab,

Just added relocatable binutils and gcc for Linux x64 meant to run on Linux x64 itself.
These utils might help you in building the static sqlite3 on Linux itself, without dependencies on glibc.

https://github.com/LongDirtyAnimAlf/fpc … nuxx64.zip

Offline

#17 2020-06-25 08:20:46

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: TestSQL3.lpi build fails on GNU/Linux x64

How do you install it using fpcupdeluxe?

Offline

#18 2020-06-25 08:24:03

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: TestSQL3.lpi build fails on GNU/Linux x64

Fpcupdeluxe is not needed for the standalone tools. Just download and unpack somewhere. And adjust the sqlite3 build-script to point towards the right locations.

Offline

#19 2020-06-25 10:54:48

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: TestSQL3.lpi build fails on GNU/Linux x64

And Linux i386 utilities for Linux x64 added. Perhaps this works also.
https://github.com/LongDirtyAnimAlf/fpc … uxi386.zip

Offline

#20 2020-06-25 13:08:34

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: TestSQL3.lpi build fails on GNU/Linux x64

Do you think this gcc 9.3 would be really faster than gcc 6.3 as used in Windows cross-compiling?
For the SQlite3 code base, which doesn't require any complex code auto-vectorization, I didn't see any noticeable performance difference.

Offline

#21 2020-06-25 15:16:41

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: TestSQL3.lpi build fails on GNU/Linux x64

I do not expect much speed improvements at -O2.
I only expect improved hardware and os compatibility.

Offline

#22 2020-06-25 18:20:09

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: TestSQL3.lpi build fails on GNU/Linux x64

Some (better) improvements might be expected from the advices that are shown here:
https://www.sqlite.org/compile.html

Offline

#23 2020-06-25 19:03:41

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: TestSQL3.lpi build fails on GNU/Linux x64

Those conditionals were already checked and included in our sqlite3mc.c wrapper.
Check https://github.com/synopse/mORMot/blob/ … qlite3mc.c

Offline

#24 2020-06-25 19:42:11

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: TestSQL3.lpi build fails on GNU/Linux x64

Happy coding and speeding ... :-) ... thanks !

Offline

Board footer

Powered by FluxBB