FirebirdSQL / firebird

Firebird server, client and tools
https://www.firebirdsql.org/
1.2k stars 208 forks source link

compilation failed at gds with tarball >= 4.0.1 #8166

Open azhu26 opened 1 week ago

azhu26 commented 1 week ago

This is for firebird tarball on arch linux with gcc/g++ 14.1.1. The error mainly complains on using auto as template parameter. it seems that c++ dialect was set to c++11 (not sure if this is related). and this error on my compliation related to 4.0.1, 4.0.3, 4.0.4 and 5.0.1. the tarball works with 3.0.11 in the same system and gcc/g++ environment. below is session related to the error from compiling 4.0.4 firebird. Any idea/help that I can borrow to move on?

g++ -I/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/src/include/gen -I/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/src/include -I/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/extern/re2 -ggdb -DFB_SEND_FLAGS=MSG_NOSIGNAL -DLINUX -DAMD64 -pipe -MMD -fPIC -fmessage-length=0 -O3 -fno-omit-frame-pointer -fno-rtti -std=c++11 -Wno-invalid-offsetof -Wno-class-memaccess -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/home/jzhu/aur/firebird/src=/usr/src/debug/firebird -flto=auto -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/home/jzhu/aur/firebird/src=/usr/src/debug/firebird -flto=auto -c /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/src/yvalve/gds.cpp -o /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/temp/Release/yvalve/gds.o In file included from /usr/include/unicode/uenum.h:25, from /usr/include/unicode/ucnv.h:52, from /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/src/yvalve/../common/../common/unicode_util.h:37, from /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/src/yvalve/../common/TimeZoneUtil.h:34, from /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/src/yvalve/gds.cpp:50: /usr/include/unicode/localpointer.h:561:26: error: parameter declared ‘auto’ 561 | template <typename Type, auto closeFunction> | ^~~~ /usr/include/unicode/localpointer.h:573:76: error: template argument 2 is invalid 573 | explicit LocalOpenPointer(std::unique_ptr<Type, decltype(closeFunction)> &&p) | ^ /usr/include/unicode/localpointer.h:583:78: error: template argument 2 is invalid 583 | LocalOpenPointer &operator=(std::unique_ptr<Type, decltype(closeFunction)> &&p) { | ^ /usr/include/unicode/localpointer.h:599:59: error: template argument 2 is invalid 599 | operator std::unique_ptr<Type, decltype(closeFunction)> () && { | ^ /usr/include/unicode/uenum.h:69:1: note: invalid template non-type parameter 69 | U_DEFINE_LOCAL_OPEN_POINTER(LocalUEnumerationPointer, UEnumeration, uenum_close); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/unicode/ucnv.h:597:1: note: invalid template non-type parameter 597 | U_DEFINE_LOCAL_OPEN_POINTER(LocalUConverterPointer, UConverter, ucnv_close); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/unicode/ucal.h:803:1: note: invalid template non-type parameter 803 | U_DEFINE_LOCAL_OPEN_POINTER(LocalUCalendarPointer, UCalendar, ucal_close); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ make[3]: *** [make.rules:128: /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/temp/Release/yvalve/gds.o] Error 1 make[3]: Leaving directory '/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen' make[2]: *** [Makefile:291: master_process] Error 2 make[2]: Leaving directory '/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen' make[1]: *** [Makefile:91: firebird] Error 2 make[1]: Leaving directory '/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen' make: *** [Makefile:6: firebird] Error 2 ==> ERROR: A failure occurred in build(). Aborting...

hvlad commented 1 week ago

ICU 75 requires C++17 now, see https://icu.unicode.org/download/

azhu26 commented 1 week ago

Hi, hvlad:

Thank you for confirming the c++ dialect issue in configure.ac. With firebird 4.0.4 as an example, I patched my local tarball with the following from diff utility updating with c++20 dialect then rerun autogen/make:

--- firebird/src/Firebird-4.0.4.3010-0/configure.ac 2023-11-08 07:07:47.000000000 -0500
+++ ./configure.ac  2024-06-19 20:18:07.084693477 -0400
@@ -661,8 +661,8 @@
       AC_CHECK_LIB(readline, readline, [READLINE=readline EDITLINE_FLG=Y],
         [STD_EDITLINE=false
          if test "$EDITLINE_FLG" = "Y"; then
-           AC_MSG_WARN([[[--with-system-editline specified, not found. Using bundled editline]]])])))
-        fi
+           AC_MSG_WARN([[[--with-system-editline specified, not found. Using bundled editline]]])
+        fi])))
 fi
 XE_RESTORE_ENV()

@@ -939,7 +939,7 @@
 fi

 XE_SAVE_ENV()
-CXXFLAGS="$CXXFLAGS -std=c++11"
+CXXFLAGS="$CXXFLAGS -std=c++20"
 AC_CACHE_CHECK([whether the C++ compiler understands noexcept], [ac_cv_cxx_noexcept], [
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int f(int x) noexcept { return x + 1; }]], [[]])],
    [ac_cv_cxx_noexcept=yes], [ac_cv_cxx_noexcept=no])])

however, I still get -std=c++11 option passed to gcc in Makefile.

Instead of autogen.sh, if I run with autoconf and automake, the automake failed since no Makefile.am is presented. This may mean that configure just check the system but something like c++ dialect change is not passed into Makefile. I would assume lacking a Makefile.am implies that Makefile are pretty much predefined in the tarball, irregard of what configure.ac changes.

so anyway to make patch the Makefile or where I should look into? or my guess is not on the way?

note the 4.0.4 tarball is from github master.

hvlad commented 6 days ago

While I'm mostly work with Windows build, I would recommend to try this patch:

diff --git a/builds/posix/make.defaults b/builds/posix/make.defaults
index 1ba08db5a6..525dd67895 100755
--- a/builds/posix/make.defaults
+++ b/builds/posix/make.defaults
@@ -104,7 +104,7 @@ GLOB_OPTIONS:=
 #____________________________________________________________________________

 # Global c++ flags: firebird needs no RTTI, choose build standard
-PLUSPLUS_FLAGS:= -fno-rtti -std=c++11
+PLUSPLUS_FLAGS:= -fno-rtti -std=c++17

 # If this is defined then we use special rules useful for developers only
 IsDeveloper = @DEVEL_FLG@
azhu26 commented 6 days ago

changing in make.defaults works partially. I can see some object files are generated with c++20 while others still with c++11. the previous gds works now. but it seems that it run to the isql -q -i metadata.sql.

azhu26 commented 6 days ago

here is the end session from make that shows the above mentioned error:

g++  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/home/jzhu/aur/firebird/src=/usr/src/debug/firebird -flto=auto -static-libstdc++ -Wl,--version-script,ib_util.vers -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now          -Wl,-z,pack-relative-relocs -flto=auto  -shared  -Wl,-soname,libib_util.so -Wl,-rpath,/usr/lib  -o /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/lib/libib_util.so /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/temp/Release/extlib/ib_util.o  
make[4]: Leaving directory '/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen'
make[3]: Leaving directory '/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen'
make gpre
make[3]: Entering directory '/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen'
rm -f metadata.fdb
/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql -q -i /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/src/dbs/metadata.sql
make[3]: *** [Makefile:445: metadata.fdb] Segmentation fault (core dumped)
make[3]: *** Deleting file 'metadata.fdb'
make[3]: Leaving directory '/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen'
make[2]: *** [Makefile:296: master_process] Error 2
make[2]: Leaving directory '/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen'
make[1]: *** [Makefile:91: firebird] Error 2
make[1]: Leaving directory '/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen'
make: *** [Makefile:6: firebird] Error 2
==> ERROR: A failure occurred in build().
    Aborting...
azhu26 commented 6 days ago

it seems that isql commend requires to link libfdbclient.so; this shared library, by arch's PKGBUILD, is not available yet at this stage to the system. anyway to disable this test?

AlexPeshkoff commented 5 days ago

On 6/23/24 01:04, azhu26 wrote:

changing in make.defaults works partially. I can see some object files are generated with c++20 while others still with c++11.

What particular?

AlexPeshkoff commented 5 days ago

On 6/23/24 02:27, azhu26 wrote:

it seems that isql commend requires to link libfdbclient.so; this shared library, by arch's PKGBUILD, is not available yet at this stage to the system. anyway to disable this test?

libfDbclient? may be libfbclient?

What about segfault in prev. email - stop guessing, use core dump and debugger to get stack trace.

azhu26 commented 5 days ago

the segmentation fault is from isql running against metadata.sql. However, this is still in make stage the required libfbclient for isql still resides in build tree and can not be seen in system. there is no other error from compiler before this point. if needed, I will update log this evening.

the other c++11 dialects are from build/extern. I manually updated all those.

aafemt commented 5 days ago

Perhaps you should read this: https://wiki.archlinux.org/title/Core_dump

azhu26 commented 4 days ago

a bit detail on the failure to run isql in make:

  1. In make, the step to run isql is done to run against metadata.sql. at this stage most of, if not all, c++, is done with compiling/building.
  2. In make, isql run against metadata.sql fails and says sigfault.
  3. directly run in cmd with this isql against metadata.sql (same command) with the following error:
    $ /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql -q -i /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/src/dbs/metadata.sql
    /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql: error while loading shared libraries: libfbclient.so.2: cannot open shared object file: No such file or directory
  4. at this step of make, the libfbclient.so.2 is still under gen/ and is not known in /usr/lib which I presumably think this is what isql think the location of shared lib
  5. so I manually created a link in /usr/lib and rerun step 3, I get the following:
    
    $  /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql -q -i /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/src/dbs/metadata.sql
    can't format message 17:0 -- message file /usr/lib/firebird/msg/firebird.msg not found
    Unable to complete network request to host "localhost".
    -Failed to establish a connection.
    can't format message 17:120 -- message file /usr/lib/firebird/msg/firebird.msg not found

so I think the error in make is how to inform isql the correct location of the shared library under gen/. any cmd option to supply the shared lib?

Honestly, I haven't been using core dump for long. I will take a look at it when i get hand on it.
AlexPeshkoff commented 4 days ago

On 6/24/24 15:03, azhu26 wrote:

the other c++11 dialects are from build/extern. I manually updated all those.

Not good idea. If some extern was designed to use some particular c++ dialect better keep it as is.

In make, isql run against metadata.sql fails and says sigfault.

This error can be fixed in a way explicitly suggested by DS. BTW, did it happen before your changes in extern?

azhu26 commented 4 days ago

Hi, AlexPeshkoff:

Thanks. The error occurs regardless of c++11 dialect change in extern.

where can I find the suggestion 'by DS'?

AlexPeshkoff commented 4 days ago

On 6/25/24 16:35, azhu26 wrote:

Hi, AlexPeshkoff:

Thanks. The error occurs regardless of c++11 dialect change in extern.

where can I find the suggestion 'by DS'?

Was in this issue:

Perhaps you should read this: https://wiki.archlinux.org/title/Core_dump

I.e. you should get core dump of failed isql, get stacktrace of all threads using gdb and send that stacktrace here.

azhu26 commented 3 days ago

here are two gdb sessions: one without LD_LIBRARY_PATH and the other with LD_LIBRARY_PATH to the gen/Release/firebird/lib which contains libfbclient.so.2

case 1:

GNU gdb (GDB) 14.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql...
Starting program: /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql -q -i /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/src/dbs/metadata.sql
/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql: error while loading shared libraries: libfbclient.so.2: cannot open shared object file: No such file or directory
[Inferior 1 (process 13752) exited with code 0177]
[?2004h(gdb) quit
[?2004l

case 2:

GNU gdb (GDB) 14.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql...
Starting program: /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql -q -i /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/src/dbs/metadata.sql
Downloading separate debug info for system-supplied DSO at 0x7ffff7fc7000...
Downloading separate debug info for /usr/lib/libedit.so.0...
Downloading separate debug info for /usr/lib/libm.so.6...
Downloading separate debug info for /usr/lib/libc.so.6...
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Downloading separate debug info for /usr/lib/libtommath.so.1...
Downloading separate debug info for /usr/lib/libncursesw.so.6...
[New Thread 0x7ffff73ff6c0 (LWP 15897)]
[New Thread 0x7ffff6bfe6c0 (LWP 15898)]
Downloading separate debug info for /usr/lib/libnss_mymachines.so.2...
Downloading separate debug info for /usr/lib/libcap.so.2...
Downloading separate debug info for /usr/lib/libnss_resolve.so.2...
can't format message 17:0 -- message file /usr/lib/firebird/msg/firebird.msg not found
Unable to complete network request to host "localhost".
-Failed to establish a connection.
can't format message 17:120 -- message file /usr/lib/firebird/msg/firebird.msg not found
[Thread 0x7ffff6bfe6c0 (LWP 15898) exited]
[Thread 0x7ffff73ff6c0 (LWP 15897) exited]
[Inferior 1 (process 15893) exited with code 01]
[?2004h(gdb) quit
[?2004l

Any idea?

azhu26 commented 3 days ago

I think this looks like that 'make' ran the isql program as if the build process had run 'make install' ...

AlexPeshkoff commented 3 days ago

On 6/25/24 23:05, azhu26 wrote:

here are two gdb sessions: one without LD_LIBRARY_PATH and the other with LD_LIBRARY_PATH to the gen/Release/firebird/lib which contains libfbclient.so.2

case 1:

|GNU gdb (GDB) 14.2 Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: https://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql... Starting program: /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql -q -i /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/src/dbs/metadata.sql /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql: error while loading shared libraries: libfbclient.so.2: cannot open shared object file: No such file or directory [Inferior 1 (process 13752) exited with code 0177] �[?2004h(gdb) quit �[?2004l |

case 2:

|GNU gdb (GDB) 14.2 Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: https://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql... Starting program: /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql -q -i /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/src/dbs/metadata.sql Downloading separate debug info for system-supplied DSO at 0x7ffff7fc7000... Downloading separate debug info for /usr/lib/libedit.so.0... Downloading separate debug info for /usr/lib/libm.so.6... Downloading separate debug info for /usr/lib/libc.so.6... [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". Downloading separate debug info for /usr/lib/libtommath.so.1... Downloading separate debug info for /usr/lib/libncursesw.so.6... [New Thread 0x7ffff73ff6c0 (LWP 15897)] [New Thread 0x7ffff6bfe6c0 (LWP 15898)] Downloading separate debug info for /usr/lib/libnss_mymachines.so.2... Downloading separate debug info for /usr/lib/libcap.so.2... Downloading separate debug info for /usr/lib/libnss_resolve.so.2... can't format message 17:0 -- message file /usr/lib/firebird/msg/firebird.msg not found Unable to complete network request to host "localhost". -Failed to establish a connection. can't format message 17:120 -- message file /usr/lib/firebird/msg/firebird.msg not found [Thread 0x7ffff6bfe6c0 (LWP 15898) exited] [Thread 0x7ffff73ff6c0 (LWP 15897) exited] [Inferior 1 (process 15893) exited with code 01] �[?2004h(gdb) quit �[?2004l |

Any idea?

That's not what I asked for...

asfernandes commented 3 days ago

@azhu26 you are full of wrong assumptions about how Firebird builds and run. Maybe you should first try to build it in another environment or with another version of ICU.

azhu26 commented 3 days ago

I would like you to be aware of this fact: I don't have problem to build and run firebird 3.0.11 in the same environment that I try to get 4.0.4 or higher done (except the same configure.ac problem mentioned in my another report). I even tried the 5.0 and other 4.0's, same problem. I would think this is something changed from 3.0 to 4.0.

AlexPeshkoff commented 3 days ago

On 6/26/24 15:58, azhu26 wrote:

I would like you to be aware of this fact: I don't have problem to build and run firebird 3.0.11 in the same environment that I try to get 4.0.4 or higher done (except the same configure.ac problem mentioned in my another report). I even tried the 5.0 and other 4.0's, same problem. I would think this is something changed from 3.0 to 4.0.

We really use different environment to build different FB versions, nobody guarantees that old host will build new code correctly. Nothing strange with it.

azhu26 commented 3 days ago

Hi, Alex: just in case, Arch is a versionless distribution, unlike most of other distros. it is so simple and seamless to upgrade entire system/packages in a simple command. In general, Arch is one that is less likely to be "old host" comparing to other distros. Any way, my lts kernel is 6.6.35, gcc 14.1.1, and autoconf 2.72, automake 1.16, autogen 5.18, libtool 2.5. not sure if these should be considered too old; note these are the latest stable version from Arch repo.

on the other hand, if you can recommand some other environment or even cross-platform such as mingw that firebird tarball has been built successfully, I may be able to borrow some ideas from there. from my log output, I guess the problem dosn't sound in c++ code but most likely in the makefile system in the tarball.

AlexPeshkoff commented 2 days ago

On 6/26/24 18:45, azhu26 wrote:

Hi, Alex: just in case, Arch is a versionless distribution, unlike most of other distros. it is so simple and seamless to upgrade entire system/packages in a simple command. In general, Arch is one that is less likely to be "old host" comparing to other distros. Any way, my lts kernel is 6.6.35, gcc 14.1.1, and autoconf 2.72, automake 1.16, autogen 5.18. not sure if these should be considered too old; note these are the latest stable version from Arch repo.

That should be OK. What I have not triedfrom this  is gcc14 - but suppose it should work.

on the other hand, if you can recommand some other environment or even cross-platform such as mingw that firebird tarball has been built successfully, I may be able to borrow some ideas from there. from my log output, I guess the problem dosn't sound in c++ code but most likely in the makefile system in the tarball.

I recommend to get core dump and send stack trace to me, that's' third time BTW. When you start isql not from make environment obviously differs (looks like even with LD_LIBRARY_PATH set not all .so files are visible to isql process). Why do you waste time?

azhu26 commented 2 days ago

running the command: coredumpctl dump 13470 --output firebird-coredump

generating the following from screen output:

           PID: 13470 (isql)
           UID: 1000 (jzhu)
           GID: 1000 (jzhu)
        Signal: 11 (SEGV)
     Timestamp: Wed 2024-06-26 18:08:01 EDT (10min ago)
  Command Line: /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql -q -i /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/src/dbs/metadata.sql
    Executable: /home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql
 Control Group: /user.slice/user-1000.slice/session-2.scope
          Unit: session-2.scope
         Slice: user-1000.slice
       Session: 2
     Owner UID: 1000 (jzhu)
       Boot ID: ae978179130642ed8716e2725f53c2e5
    Machine ID: 77cc30a5ba4b4841895f9261b7b0850e
      Hostname: d20-x8664
       Storage: /var/lib/systemd/coredump/core.isql.1000.ae978179130642ed8716e2725f53c2e5.13470.1719439681000000.zst (present)
  Size on Disk: 339.1K
       Message: Process 13470 (isql) of user 1000 dumped core.

                Stack trace of thread 13470:
                #0  0x0000000000000000 n/a (n/a + 0x0)
                #1  0x00007ffff5d92ba2 n/a (/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/plugins/libEngine13.so + 0x392ba2)
                #2  0x00007ffff5d8aa5f n/a (/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/plugins/libEngine13.so + 0x38aa5f)
                #3  0x00007ffff5d64fb4 n/a (/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/plugins/libEngine13.so + 0x364fb4)
                #4  0x00007ffff5b29797 n/a (/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/plugins/libEngine13.so + 0x129797)
                #5  0x00007ffff5bb4435 n/a (/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/plugins/libEngine13.so + 0x1b4435)
                #6  0x00007ffff5b1d696 n/a (/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/plugins/libEngine13.so + 0x11d696)
                #7  0x00007ffff5bd67b3 n/a (/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/plugins/libEngine13.so + 0x1d67b3)
                #8  0x00007ffff5bca969 n/a (/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/plugins/libEngine13.so + 0x1ca969)
                #9  0x00007ffff5bec175 n/a (/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/plugins/libEngine13.so + 0x1ec175)
                #10 0x00007ffff5c10d5a n/a (/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/plugins/libEngine13.so + 0x210d5a)
                #11 0x00007ffff5af5698 n/a (/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/plugins/libEngine13.so + 0xf5698)
                #12 0x00007ffff7cb6153 n/a (/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/lib/libfbclient.so.4.0.4 + 0xb6153)
                #13 0x00007ffff7c8ca60 n/a (/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/lib/libfbclient.so.4.0.4 + 0x8ca60)
                #14 0x00007ffff7c8da8a n/a (/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/lib/libfbclient.so.4.0.4 + 0x8da8a)
                #15 0x000055555558fe36 n/a (/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql + 0x3be36)
                #16 0x000055555559119b n/a (/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql + 0x3d19b)
                #17 0x000055555558513a n/a (/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql + 0x3113a)
                #18 0x00007ffff7854c88 n/a (libc.so.6 + 0x25c88)
                #19 0x00007ffff7854d4c __libc_start_main (libc.so.6 + 0x25d4c)
                #20 0x00005555555730d5 n/a (/home/jzhu/aur/firebird/src/Firebird-4.0.4.3010-0/gen/Release/firebird/bin/isql + 0x1f0d5)
                ELF object binary architecture: AMD x86-64

unfortunately, the firebird-coredump can't uploaded; anyway the output file is mostly unreadable..

asfernandes commented 2 days ago

I tried this inside an archlinux docker container and it worked:

docker run -it --rm archlinux bash

pacman -Syu
pacman -S base-devel git unzip nano
git clone https://github.com/FirebirdSQL/firebird.git
cd firebird
git checkout v4.0-release

# patched builds/posix/make.defaults
#-PLUSPLUS_FLAGS:= -fno-rtti -std=c++11
#+PLUSPLUS_FLAGS:= -fno-rtti -std=c++17

./autogen.sh --enable-developer --enable-binreloc --with-builtin-tommath --with-builtin-tomcrypt
make -j22
azhu26 commented 2 days ago

follow asfernandes step from git clone upto ./autogen.sh -- so our configure.ac should be the same. however, autogen failed as below:

./autogen.sh --enable-developer --enable-binreloc --with-builtin-tommath --with-builtin-tomcrypt
AUTORECONF=autoreconf
Running autoreconf ...
autoreconf: export WARNINGS=
autoreconf: Entering directory '.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal -I . --force 
configure.ac:521: warning: macro 'AM_BINRELOC' not found in library
configure.ac:660: error: m4_require: circular dependency of AC_LANG_COMPILER(C)
./lib/autoconf/lang.m4:335: AC_LANG_COMPILER_REQUIRE is expanded from...
./lib/autoconf/general.m4:2909: AC_LINK_IFELSE is expanded from...
lib/m4sugar/m4sh.m4:690: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:697: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
./lib/autoconf/libs.m4:100: AC_CHECK_LIB is expanded from...
./lib/autoconf/programs.m4:189: _AC_TOOL_WARN is expanded from...
./lib/autoconf/programs.m4:221: AC_CHECK_TOOL is expanded from...
./lib/autoconf/c.m4:460: AC_PROG_CC is expanded from...
./lib/autoconf/c.m4:441: AC_LANG_COMPILER(C) is expanded from...
./lib/autoconf/lang.m4:335: AC_LANG_COMPILER_REQUIRE is expanded from...
./lib/autoconf/general.m4:2909: AC_LINK_IFELSE is expanded from...
lib/m4sugar/m4sh.m4:690: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:697: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
./lib/autoconf/libs.m4:100: AC_CHECK_LIB is expanded from...
configure.ac:660: the top level
autom4te: error: /usr/bin/m4 failed with exit status: 1
aclocal: error: /usr/bin/autom4te failed with exit status: 1
autoreconf: error: aclocal failed with exit status: 1
azhu26 commented 20 hours ago

changed to v5.0-release, autogen.sh and make works. (it also requires cmake but it is easy to install; nice to have autoconf to check though). hesitate to make install as it will break arch pacman. will try to see if it can make into some arch AUR first.

v5.0-release points to v5.0.0-187-g54c00d050d

one question: is there anyway to use fb-isql vs isql in Makefile? the reason is that unixodbc has isql already. this is to avoid name colision.