RosX1
Posts: 17
Joined: Wed Apr 20, 2016 7:14 am

Building Firebird 1.5 from source

Mon Jun 12, 2017 12:24 pm

Hi,
I have Raspberry PI 3 with Raspbian. I need to install Firebird 1.5 database server.
Because in packages there is no Firebird 1.5 ( I need exactly this version ) i need to build Firebird from source.

I follow this link https://www.firebirdsql.org/en/building-the-code/
I get the source code from here - https://github.com/FirebirdSQL/firebird ... tag/R1_5_6

But I have problems on "make" command. There are some errors.
Does anybody build Firebird 1.5 from source for Raspberry PI 3?

Thanks!

DirkS
Posts: 8876
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Building Firebird 1.5 from source

Mon Jun 12, 2017 12:25 pm

What errors? Post full error messages...

RosX1
Posts: 17
Joined: Wed Apr 20, 2016 7:14 am

Re: Building Firebird 1.5 from source

Mon Jun 12, 2017 12:40 pm

Code: Select all


$ make
make -C src firebird
make[1]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
make boot_phase1_build
make[2]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
make -f ../gen/Makefile.libfbcommon libfbcommon
make[3]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
g++   -I../src/include/gen -I../src/include -ggdb -O3 -march=i586 -mcpu=i686 -fno-omit-frame-pointer -fno-builtin -DNDEBUG -DLINUX -pipe -MMD -fPIC  -DPROD_BUILD -c ../src/common/classes/alloc.cpp -o ../temp/libfbcommon/common/classes/alloc.o
g++: error: unrecognized argument in option ‘-march=i586’
g++: note: valid arguments to ‘-march=’ are: armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6 armv6-m armv6j armv6k armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m armv7-r armv7e-m armv7ve armv8-a armv8-a+crc iwmmxt iwmmxt2 native
g++: error: unrecognized argument in option ‘-mcpu=i686’
g++: note: valid arguments to ‘-mcpu=’ are: arm1020e arm1020t arm1022e arm1026ej-s arm10e arm10tdmi arm1136j-s arm1136jf-s arm1156t2-s arm1156t2f-s arm1176jz-s arm1176jzf-s arm2 arm250 arm3 arm6 arm60 arm600 arm610 arm620 arm7 arm70 arm700 arm700i arm710 arm7100 arm710c arm710t arm720 arm720t arm740t arm7500 arm7500fe arm7d arm7di arm7dm arm7dmi arm7m arm7tdmi arm7tdmi-s arm8 arm810 arm9 arm920 arm920t arm922t arm926ej-s arm940t arm946e-s arm966e-s arm968e-s arm9e arm9tdmi cortex-a12 cortex-a15 cortex-a15.cortex-a7 cortex-a5 cortex-a53 cortex-a57 cortex-a57.cortex-a53 cortex-a7 cortex-a8 cortex-a9 cortex-m0 cortex-m0plus cortex-m1 cortex-m3 cortex-m4 cortex-r4 cortex-r4f cortex-r5 cortex-r7 ep9312 fa526 fa606te fa626 fa626te fa726te fmp626 generic-armv7-a iwmmxt iwmmxt2 marvell-pj4 mpcore mpcorenovfp native strongarm strongarm110 strongarm1100 strongarm1110 xscale
../gen/make.rules:215: recipe for target '../temp/libfbcommon/common/classes/alloc.o' failed
make[3]: *** [../temp/libfbcommon/common/classes/alloc.o] Error 1
make[3]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
Makefile:225: recipe for target 'libfbcommon' failed
make[2]: *** [libfbcommon] Error 2
make[2]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
Makefile:219: recipe for target '../gen/firebird/bin/gpre_static' failed
make[1]: *** [../gen/firebird/bin/gpre_static] Error 2
make[1]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
Makefile:6: recipe for target 'firebird' failed
make: *** [firebird] Error 2

I found this line in /build/posix/prefix.linux :

Code: Select all

PROD_FLAGS=-ggdb -O3 -march=i586 -mcpu=i686 -fno-omit-frame-pointer -fno-builtin -DNDEBUG -DLINUX -pipe -MMD -fPIC
Of course the cpu is not i686 and I do not know with what values to change "-march=i586 -mcpu=i686".

User avatar
RaTTuS
Posts: 10061
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Building Firebird 1.5 from source

Mon Jun 12, 2017 12:59 pm

did you
./autogen.sh
followed by
./configure
first ?
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

RosX1
Posts: 17
Joined: Wed Apr 20, 2016 7:14 am

Re: Building Firebird 1.5 from source

Mon Jun 12, 2017 1:08 pm

RaTTuS wrote:did you
./autogen.sh
followed by
./configure
first ?
Yes.

User avatar
topguy
Posts: 4768
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Building Firebird 1.5 from source

Mon Jun 12, 2017 2:05 pm

Of course the cpu is not i686 and I do not know with what values to change "-march=i586 -mcpu=i686".
My first instinct would be to remove them and try again. Of course there might be speed/optimisation benefits to compile for an exact CPU model but you can worry about that later.

RosX1
Posts: 17
Joined: Wed Apr 20, 2016 7:14 am

Re: Building Firebird 1.5 from source

Mon Jun 12, 2017 2:12 pm

topguy wrote:
Of course the cpu is not i686 and I do not know with what values to change "-march=i586 -mcpu=i686".
My first instinct would be to remove them and try again. Of course there might be speed/optimisation benefits to compile for an exact CPU model but you can worry about that later.
I remove the "-march=i586 -mcpu=i686" and there are another errors:

Code: Select all

$ make
make -C src firebird
make[1]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
make boot_phase1_build
make[2]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
make -f ../gen/Makefile.libfbcommon libfbcommon
make[3]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
g++   -I../src/include/gen -I../src/include -ggdb -O3  -fno-omit-frame-pointer -fno-builtin -DNDEBUG -DLINUX -pipe -MMD -fPIC  -DPROD_BUILD -c ../src/common/classes/alloc.cpp -o ../temp/libfbcommon/common/classes/alloc.o
In file included from ../src/common/classes/../../include/firebird.h:75:0,
                 from ../src/common/classes/alloc.cpp:26:
../src/common/classes/../../include/../common/classes/alloc.h:262:77: error: ‘void* operator new(size_t, Firebird::MemoryPool&)’ may not be declared as static
 FB_STATIC_INLINE_NEW void* operator new(size_t s, Firebird::MemoryPool& pool) {
                                                                             ^
../src/common/classes/../../include/../common/classes/alloc.h:266:79: error: ‘void* operator new [](size_t, Firebird::MemoryPool&)’ may not be declared as static
 FB_STATIC_INLINE_NEW void* operator new[](size_t s, Firebird::MemoryPool& pool) {
                                                                               ^
In file included from ../src/common/classes/../../include/../common/classes/tree.h:35:0,
                 from ../src/common/classes/../../include/../common/classes/alloc.h:36,
                 from ../src/common/classes/../../include/firebird.h:75,
                 from ../src/common/classes/alloc.cpp:26:
../src/common/classes/../../include/../common/classes/vector.h: In instantiation of ‘int Firebird::SortedVector<Value, Capacity, Key, KeyOfValue, Cmp>::add(const Value&) [with Value = void*; int Capacity = 100; Key = Firebird::BlockInfo; KeyOfValue = Firebird::BePlusTree<Firebird::BlockInfo, Firebird::BlockInfo, Firebird::MemoryPool::InternalAllocator, Firebird::DefaultKeyValue<Firebird::BlockInfo>, Firebird::BlockInfo>::NodeList; Cmp = Firebird::BlockInfo]’:
../src/common/classes/../../include/../common/classes/tree.h:535:5:   required from ‘bool Firebird::BePlusTree<Value, Key, Allocator, KeyOfValue, Cmp, LeafCount, NodeCount>::add(const Value&) [with Value = Firebird::BlockInfo; Key = Firebird::BlockInfo; Allocator = Firebird::MemoryPool::InternalAllocator; KeyOfValue = Firebird::DefaultKeyValue<Firebird::BlockInfo>; Cmp = Firebird::BlockInfo; int LeafCount = 100; int NodeCount = 100]’
../src/common/classes/alloc.cpp:107:23:   required from here
../src/common/classes/../../include/../common/classes/vector.h:131:19: error: ‘insert’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
   insert(pos, item);
                   ^
../src/common/classes/../../include/../common/classes/vector.h:131:19: note: declarations in dependent base ‘Firebird::Vector<void*, 100>’ are not found by unqualified lookup
../src/common/classes/../../include/../common/classes/vector.h:131:19: note: use ‘this->insert’ instead
../gen/make.rules:215: recipe for target '../temp/libfbcommon/common/classes/alloc.o' failed
make[3]: *** [../temp/libfbcommon/common/classes/alloc.o] Error 1
make[3]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
Makefile:225: recipe for target 'libfbcommon' failed
make[2]: *** [libfbcommon] Error 2
make[2]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
Makefile:219: recipe for target '../gen/firebird/bin/gpre_static' failed
make[1]: *** [../gen/firebird/bin/gpre_static] Error 2
make[1]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
Makefile:6: recipe for target 'firebird' failed
make: *** [firebird] Error 2

LdB
Posts: 827
Joined: Wed Dec 07, 2016 2:29 pm

Re: Building Firebird 1.5 from source

Tue Jun 13, 2017 3:34 am

The usual compilation values for a pi3 with GCC are
-mfpu=neon-vfpv4 -mfloat-abi=hard -march=armv8-a -mtune=cortex-a53

Your errors however have nothing to do with that you have an illegal use of keyword static in alloc.h it looks like FB_STATIC_INLINE_NEW is some define that includes the word static.

You might want to look at FB_STATIC_INLINE_NEW which sounds like a macro to try and force inline code and try just removing the static keyword out of it which is wrong and/or deprecated.

UPDATE:
I had a quick look at the code I think you are using, and they have other version right there under a conditional switch of AIX and DARWIN. That means nothing to me but you want the top version not the bottom

Code: Select all

#if (defined AIX || defined DARWIN)
 #define FB_STATIC_INLINE_NEW inline
 #else
 #define FB_STATIC_INLINE_NEW static inline
The use in historic context ... AKA bad use of macros .. is detailed in http://www.greenend.org.uk/rjk/tech/inline.html

So try the other version if the change causes problems you can haxx it by restoring the static and pragma out the warning so it goes thru ... or chase and fix each occurance of the macro :-)

RosX1
Posts: 17
Joined: Wed Apr 20, 2016 7:14 am

Re: Building Firebird 1.5 from source

Tue Jun 13, 2017 7:51 am

Thanks LdB!
I swap them and this error disappeared.
But other errors stays:

Code: Select all

$ make
make -C src firebird
make[1]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
make boot_phase1_build
make[2]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
make -f ../gen/Makefile.libfbcommon libfbcommon
make[3]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
g++   -I../src/include/gen -I../src/include -ggdb -O3  -fno-omit-frame-pointer -fno-builtin -DNDEBUG -DLINUX -pipe -MMD -fPIC  -DPROD_BUILD -c ../src/common/classes/alloc.cpp -o ../temp/libfbcommon/common/classes/alloc.o
In file included from ../src/common/classes/../../include/../common/classes/tree.h:35:0,
                 from ../src/common/classes/../../include/../common/classes/alloc.h:36,
                 from ../src/common/classes/../../include/firebird.h:75,
                 from ../src/common/classes/alloc.cpp:26:
../src/common/classes/../../include/../common/classes/vector.h: In instantiation of ‘int Firebird::SortedVector<Value, Capacity, Key, KeyOfValue, Cmp>::add(const Value&) [with Value = void*; int Capacity = 100; Key = Firebird::BlockInfo; KeyOfValue = Firebird::BePlusTree<Firebird::BlockInfo, Firebird::BlockInfo, Firebird::MemoryPool::InternalAllocator, Firebird::DefaultKeyValue<Firebird::BlockInfo>, Firebird::BlockInfo>::NodeList; Cmp = Firebird::BlockInfo]’:
../src/common/classes/../../include/../common/classes/tree.h:535:5:   required from ‘bool Firebird::BePlusTree<Value, Key, Allocator, KeyOfValue, Cmp, LeafCount, NodeCount>::add(const Value&) [with Value = Firebird::BlockInfo; Key = Firebird::BlockInfo; Allocator = Firebird::MemoryPool::InternalAllocator; KeyOfValue = Firebird::DefaultKeyValue<Firebird::BlockInfo>; Cmp = Firebird::BlockInfo; int LeafCount = 100; int NodeCount = 100]’
../src/common/classes/alloc.cpp:107:23:   required from here
../src/common/classes/../../include/../common/classes/vector.h:131:19: error: ‘insert’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
   insert(pos, item);
                   ^
../src/common/classes/../../include/../common/classes/vector.h:131:19: note: declarations in dependent base ‘Firebird::Vector<void*, 100>’ are not found by unqualified lookup
../src/common/classes/../../include/../common/classes/vector.h:131:19: note: use ‘this->insert’ instead
../gen/make.rules:215: recipe for target '../temp/libfbcommon/common/classes/alloc.o' failed
make[3]: *** [../temp/libfbcommon/common/classes/alloc.o] Error 1
make[3]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
Makefile:225: recipe for target 'libfbcommon' failed
make[2]: *** [libfbcommon] Error 2
make[2]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
Makefile:219: recipe for target '../gen/firebird/bin/gpre_static' failed
make[1]: *** [../gen/firebird/bin/gpre_static] Error 2
make[1]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
Makefile:6: recipe for target 'firebird' failed
make: *** [firebird] Error 2
Can you help me with this?

RosX1
Posts: 17
Joined: Wed Apr 20, 2016 7:14 am

Re: Building Firebird 1.5 from source

Wed Jun 14, 2017 8:32 am

I managed with this problems, but now there is another problem:

Code: Select all

$ make
make -C src firebird
make[1]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
make boot_phase1_build
make[2]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
make -f ../gen/Makefile.libfbcommon libfbcommon
make[3]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
make[3]: Nothing to be done for 'libfbcommon'.
make[3]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
make -f ../gen/Makefile.boot.gpre gpre_boot
make[3]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
make[3]: Nothing to be done for 'gpre_boot'.
make[3]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
make -f ../gen/Makefile.libfbstatic libfbstatic
make[3]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
g++  -DBOOT_BUILD -I../src/include/gen -I../src/include -ggdb -O3 -mfpu=neon-vfpv4 -mfloat-abi=hard -march=armv8-a -mtune=cortex-a53 -fpermissive -Wno-write-strings -fno-omit-frame-pointer -fno-builtin -DNDEBUG -DLINUX -pipe -MMD -fPIC  -DPROD_BUILD -c ../src/jrd/inf.cpp -o ../temp/libfbstatic/jrd/inf.o
../src/jrd/inf.cpp: In function ‘int INF_database_info(SCHAR*, SSHORT, SCHAR*, SSHORT)’:
../src/jrd/inf.cpp:498:13: error: ‘IMPLEMENTATION’ was not declared in this scope
    STUFF(p, IMPLEMENTATION);
             ^
../src/jrd/inf.cpp:82:33: note: in definition of macro ‘STUFF’
 #define STUFF(p, value)  *p++ = value
                                 ^
../gen/make.rules:215: recipe for target '../temp/libfbstatic/jrd/inf.o' failed
make[3]: *** [../temp/libfbstatic/jrd/inf.o] Error 1
make[3]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
Makefile:231: recipe for target 'libfbstatic' failed
make[2]: *** [libfbstatic] Error 2
make[2]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
Makefile:219: recipe for target '../gen/firebird/bin/gpre_static' failed
make[1]: *** [../gen/firebird/bin/gpre_static] Error 2
make[1]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
Makefile:6: recipe for target 'firebird' failed
make: *** [firebird] Error 2

LdB
Posts: 827
Joined: Wed Dec 07, 2016 2:29 pm

Re: Building Firebird 1.5 from source

Wed Jun 14, 2017 8:42 am

So it's telling you the word IMPLEMENTATION has no macro definition

You are looking for something like
#define IMPLEMENTATION ????????

The ???????? will be the value that the function STUFF wants

I suspect it's in a #ifdef that isn't being called again .

Do a search for "#define IMPLEMENTATION" and bring it out of it's hiding place :-)

RosX1
Posts: 17
Joined: Wed Apr 20, 2016 7:14 am

Re: Building Firebird 1.5 from source

Wed Jun 14, 2017 9:18 am

LdB wrote:So it's telling you the word IMPLEMENTATION has no macro definition

You are looking for something like
#define IMPLEMENTATION ????????

The ???????? will be the value that the function STUFF wants

I suspect it's in a #ifdef that isn't being called again .

Do a search for "#define IMPLEMENTATION" and bring it out of it's hiding place :-)
In /src/jrd/common.h ( only there ) :

Code: Select all

#ifdef AMD64
#define IMPLEMENTATION  isc_info_db_impl_linux_amd64 /* 66  next higher unique number, See you later  */
#endif

#ifdef i386
#define I386    1
#define IMPLEMENTATION  isc_info_db_impl_i386 /* 60  next higher unique number, See you later  */
#endif /* i386 */

#ifdef sparc
#define IMPLEMENTATION  isc_info_db_impl_linux_sparc /* 65  */
#endif /* sparc */

#ifdef i386
#define I386    1
/* Change version string into SINIXZ */
#define IMPLEMENTATION  isc_info_db_impl_sinixz  /* 64 */
#endif /* i386 */

#ifdef i386
#define I386 
#define IMPLEMENTATION isc_info_db_impl_darwin_x86 /* 67 */
#endif
#ifdef __ppc__
#define IMPLEMENTATION isc_info_db_impl_darwin_ppc /* 63 */
#endif


#ifdef FREEBSD
#define IMPLEMENTATION    isc_info_db_impl_freebsd   /* 61 */
#endif

#ifdef NETBSD
#define IMPLEMENTATION        isc_info_db_impl_netbsd /* 62 */
#endif

#ifdef sparc
/*#define FB_ALIGNMENT       4*/
/*#define DOUBLE_ALIGN    8*/
#define IMPLEMENTATION  isc_info_db_impl_isc_sun4 /* 30 */
#else /* sparc */

#ifdef i386
#define I386            1
#define IMPLEMENTATION  isc_info_db_impl_isc_sun_386i  /* 32 */
#else /* i386 */
#define IMPLEMENTATION  isc_info_db_impl_isc_sun_68k /* 28 */
#endif /* i386 */

#endif /* sparc */

#if (defined(hpux) || defined(HPUX))
#define IMPLEMENTATION  isc_info_db_impl_isc_hp_ux /* 31 */
#endif /* hpux */

#if __ALPHA
#define IMPLEMENTATION  isc_info_db_impl_alpha_vms /* 53 */
#include <ints.h>
#define ATOM_DEFINED
typedef int64 SATOM;			/* 64 bit */
typedef unsigned int64 UATOM;
#else
#define IMPLEMENTATION  isc_info_db_impl_isc_vms /* 27 */
#endif /* __ALPHA */


#ifdef AIX_PPC
#ifndef _AIX
#define _AIX
#endif
#endif

#ifdef _AIX						/* IBM AIX */
#define AIX
#ifndef _POWER					/* IBM RS/6000 */
#define AIX_RS6000
#define KILLER_SIGNALS
#define UNIX            1
#define CURSES_KEYPAD   1
/*#define FB_ALIGNMENT       4*/
#define IMPLEMENTATION  isc_info_db_impl_isc_rt_aix /* 35 */
#define                 IEEE
#define MEMMOVE(from,to,length)       memmove ((void *)to, (void *)from, (size_t) length)
#define MOVE_FAST(from,to,length)       memcpy (to, from, (int) (length))
#define MOVE_FASTER(from,to,length)     memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length)           memset (to, 0, (int) (length))
#define SYSCALL_INTERRUPTED(err)        (((err) == EINTR) || ((err) == ERESTART))	/* pjpg 20001102 */
#else /* AIX PowerPC */
#undef AIX_PPC
#define AIX_PPC
#define KILLER_SIGNALS
#define UNIX            1
#define CURSES_KEYPAD   1
/*#define FB_ALIGNMENT       4*/
#define IMPLEMENTATION  isc_info_db_impl_isc_rt_aix /* 35 */
#define                 IEEE
#define MEMMOVE(from,to,length)       memmove ((void *)to, (void *)from, (size_t) length)
#define MOVE_FAST(from,to,length)       memcpy (to, from, (int) (length))
#define MOVE_FASTER(from,to,length)     memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length)           memset (to, 0, (int) (length))
#define SYSCALL_INTERRUPTED(err)        (((err) == EINTR) || ((err) == ERESTART))	/* pjpg 20001102 */

#define VA_START(list,parmN)    va_start (list, parmN)	/* TMC 081700 */
#define QUADFORMAT "ll"			/* TMC 081700 */
#define QUADCONST(n) (n##LL)	/* TMC 081700 */

#endif /* IBM PowerPC */



#ifndef I386
#define I386
#endif
#define IMPLEMENTATION  isc_info_db_impl_isc_winnt_x86 /* 50 */
#endif


#ifdef SCO_EV
#define IMPLEMENTATION  isc_info_db_impl_sco_ev /* 59 */
#endif /* SCO_EV */

There is nothing for ARM.

LdB
Posts: 827
Joined: Wed Dec 07, 2016 2:29 pm

Re: Building Firebird 1.5 from source

Wed Jun 14, 2017 1:34 pm

Looks like 1.5 doesn't support Arm which is going to make it fun.
On firebird 2

Code: Select all

#ifdef ARM
#define IMPLEMENTATION  isc_info_db_impl_linux_arm	// 75
#endif /* ARM */ 
You would need to port all the implementation :-(

Can't use 2.0?
You now go out of my league you need to talk to a firebird expert on the firebird forums, it's not a C++ thing anymore.

RosX1
Posts: 17
Joined: Wed Apr 20, 2016 7:14 am

Re: Building Firebird 1.5 from source

Fri Jun 16, 2017 8:06 am

Unfortunately I can't use Firebird 2. The software requires only version 1.5

I think I managed to correct ARM defines, but now another errors show:

Code: Select all

$ make
make -C src firebird
make[1]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
make boot_phase1_build
make[2]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
make -f ../gen/Makefile.libfbcommon libfbcommon
make[3]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
make[3]: Nothing to be done for 'libfbcommon'.
make[3]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
make -f ../gen/Makefile.boot.gpre gpre_boot
make[3]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
make[3]: Nothing to be done for 'gpre_boot'.
make[3]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
make -f ../gen/Makefile.libfbstatic libfbstatic
make[3]: Entering directory '/home/pi/Downloads/firebird-R1_5_6/src'
g++  -DBOOT_BUILD -I../src/include/gen -I../src/include -ggdb -O3 -mfpu=neon-vfpv4 -mfloat-abi=hard -march=armv8-a -mtune=cortex-a53 -fpermissive -Wno-write-strings -fno-omit-frame-pointer -fno-builtin -DNDEBUG -DLINUX -DARM -pipe -MMD -fPIC  -DPROD_BUILD -c ../src/jrd/jrd.cpp -o ../temp/libfbstatic/jrd/jrd.o
../src/jrd/jrd.cpp:429:6: error: conflicting declaration of ‘int debug’ with ‘C’ linkage
 int  debug;
      ^
In file included from ../src/jrd/jrd.cpp:56:0:
../src/jrd/../jrd/jrd.h:1055:12: note: previous declaration with ‘C++’ linkage
 extern int debug;
            ^
../src/jrd/jrd.cpp:430:7: error: conflicting declaration of ‘ihndl* internal_db_handles’ with ‘C’ linkage
 IHNDL internal_db_handles = 0;
       ^
In file included from ../src/jrd/jrd.cpp:56:0:
../src/jrd/../jrd/jrd.h:1056:14: note: previous declaration with ‘C++’ linkage
 extern IHNDL internal_db_handles;
              ^
../gen/make.rules:215: recipe for target '../temp/libfbstatic/jrd/jrd.o' failed
make[3]: *** [../temp/libfbstatic/jrd/jrd.o] Error 1
make[3]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
Makefile:231: recipe for target 'libfbstatic' failed
make[2]: *** [libfbstatic] Error 2
make[2]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
Makefile:219: recipe for target '../gen/firebird/bin/gpre_static' failed
make[1]: *** [../gen/firebird/bin/gpre_static] Error 2
make[1]: Leaving directory '/home/pi/Downloads/firebird-R1_5_6/src'
Makefile:6: recipe for target 'firebird' failed
make: *** [firebird] Error 2
Will be possile this to avoid with some compiler switch?

LdB
Posts: 827
Joined: Wed Dec 07, 2016 2:29 pm

Re: Building Firebird 1.5 from source

Fri Jun 16, 2017 3:16 pm

Okay that is a weird one to come up, so let me explain the error.

It usually occurs when you mix C++ with C and you define the same variable name in C and C++.

What it is saying is you have the equivalent of this

Code: Select all

int debug;
extern "C" { int debug };
The reason why they can't be like that is C maintains names "as is" in the linker C++ does not
https://en.wikipedia.org/wiki/Name_mangling specifically the section Handling of C symbols when linking from C++

I am not sure what is going here, whether they were supposed to be the same thing or someone dorked it and duplicated a name.
If they are supposed to be same thing remove the C++ one, if they are different rename the C++ one and then chase it thru (so something like (int cplus_debug)).

"IHNDL internal_db_handles" has exactly the same problem. Looking at this one it does look like they are supposed to be the same thing so some noob wrongly declared a C++ one rather than using the C one. I am guessing they weren't smart enough to work out how to get access to the C variable

Code: Select all

extern "C" { #include "abc.c"}; // abc.c is the c file that contains the variable
On an old C++ compiler without name mangling they were relying on the linker to bring the C++ and C code variable to mean the same thing.

The C include above works as it does for any C++ file it's just the compiler knows it's a C file and creates a symbolic link to variables.

This is getting extremely ugly :-)

RosX1
Posts: 17
Joined: Wed Apr 20, 2016 7:14 am

Re: Building Firebird 1.5 from source

Fri Jun 23, 2017 12:00 pm

Hi,
Thanks for your reply. The both variables must be same ( they are not variable name duplicate ).

In /src/jrd/jrd.cpp there is:

Code: Select all

int		debug;
IHNDL	internal_db_handles = 0;
In /src/jrd/jrd.h there is:

Code: Select all

extern int debug;
extern IHNDL internal_db_handles;
I am little confused. How should look these lines to avoid error?

Thanks in advance!

LdB
Posts: 827
Joined: Wed Dec 07, 2016 2:29 pm

Re: Building Firebird 1.5 from source

Sun Jun 25, 2017 4:44 am

One must also be in a C file one must be in a C++ or it wouldn't be a problem they would be seen as same thing.

The one in the C++ file just need to be placed extern "c" { } It stops the c++ name mangling.
http://www.tldp.org/HOWTO/C++-dlopen/thesolution.html

So look at the file extension will be c, one will be cpp. The one in the cpp file is the one that needs the change.
extern "c" { int debug;}
or
extern "c" {extern int debug;}

It just stops the c++ name mangling so the linker gets they are the same thing.

RosX1
Posts: 17
Joined: Wed Apr 20, 2016 7:14 am

Re: Building Firebird 1.5 from source

Tue Jun 27, 2017 8:22 am

So I swap declarations:

In /src/jrd/jrd.cpp now is:

Code: Select all

extern "C" { int debug;}
extern "C" { IHNDL internal_db_handles; }
In /src/jrd/jrd.h there now is:

Code: Select all

int		debug;
IHNDL	internal_db_handles = 0;
And again error:

Code: Select all

../src/jrd/jrd.cpp:430:18: error: redefinition of ‘int debug’
 extern "C" { int debug;}
                  ^
In file included from ../src/jrd/jrd.cpp:56:0:
../src/jrd/../jrd/jrd.h:1057:7: note: ‘int debug’ previously declared here
  int  debug;
       ^
../src/jrd/jrd.cpp:433:20: error: redefinition of ‘ihndl* internal_db_handles’
 extern "C" { IHNDL internal_db_handles; }
                    ^
In file included from ../src/jrd/jrd.cpp:56:0:
../src/jrd/../jrd/jrd.h:1061:8: note: ‘ihndl* internal_db_handles’ previously defined here
  IHNDL internal_db_handles = 0;
        ^

LdB
Posts: 827
Joined: Wed Dec 07, 2016 2:29 pm

Re: Building Firebird 1.5 from source

Tue Jun 27, 2017 2:42 pm

That is a CPP file not a C file it was correct

jrd.cpp has a variable int debug which is correct
jrd.h is declaring that extern to make it globally accessible which is correct

So please remove the extern "C" it's not a C file issue .. so I am scratching my head

Oh wait there seems to be 2 funny paths to the jrd.cpp file

../src/jrd/jrd.cpp:429:6: error: conflicting declaration of ‘int debug’ with ‘C’ linkage
int debug;
^
In file included from ../src/jrd/jrd.cpp:56:0:
../src/jrd/../jrd/jrd.h:1055:12: note: previous declaration with ‘C++’ linkage

Whats on Line 429 of ../src/jrd/jrd.cpp
Line 56 of ../src/jrd/jrd.cpp should be an include can I see it.
Whats on Line 1055 of ../src/jrd/../jrd/jrd.h

Can you check there are include guards on jrd.h and there is only 1 jrd.cpp file in the repo. The only other way I think is with a namespace error in C++.

It might be quicker for me to look at the file are there any links to a repo of the files.


LdB
Posts: 827
Joined: Wed Dec 07, 2016 2:29 pm

Re: Building Firebird 1.5 from source

Tue Jun 27, 2017 4:31 pm

OMG the state of that code

Ok so in jrd.cpp line 296 starts a C block with
extern "C" {
It's not marked, it's not commented, its not indented basically it's not anything it's just there :-)

Now the end of it is horrible it can either terminate at line 600 inside another ifdef or somewhere way down if not there and I gave up chasing it.

Anyhow long and short Line 429 is within that block which is your
int debug;

So when you compile jrd.cpp "int debug" will be linked as C name mangling convention

So now just change jrd.h to match at line 1055
extern "C" int debug;

You might as well do the same to line 1056

Compiler and linker should be happy the .cpp file and the .h file are both saying to link them as a C name mangle.

That should be correct for every C++ compiler it has me lost how they had it compiling like that.

RosX1
Posts: 17
Joined: Wed Apr 20, 2016 7:14 am

Re: Building Firebird 1.5 from source

Wed Jun 28, 2017 8:50 am

Hi,
I terminate the "extern "C" {" at line 600, but now there is another error:

Code: Select all

../src/jrd/jrd.cpp:6725:1: error: expected declaration before ‘}’ token
 } // extern "C"
I think this is because "extern "C" {" at line 429 terminates at end of file : "} // extern "C" at line 6725.

LdB
Posts: 827
Joined: Wed Dec 07, 2016 2:29 pm

Re: Building Firebird 1.5 from source

Wed Jun 28, 2017 1:05 pm

There shouldn't be an extern "C" on line 429 I said to remove it as it's already inside an extern "C" something we couldn't know before.

So Line 429 just needs to be as it was int debug; it is extern "C" already.

The extern "C" don't stack it's an absolute statement you can't C name mangle a C name mangle. It's important you understand what these changes are about and are doing.

So line 429 is within the existing extern "C" block so please do not have another. What is required is the header to reflect the change.

RosX1
Posts: 17
Joined: Wed Apr 20, 2016 7:14 am

Re: Building Firebird 1.5 from source

Wed Jun 28, 2017 1:17 pm

In the code on my raspberry, in jrd.cpp at line 429 I already make changes as you told me: "int debug;"
The problem is that at line 600 I put "}" - as you told me to terminate "extern "C" {" from line 296.

Because at the end of file there is } // extern "C"
I got an error:

Code: Select all

../src/jrd/jrd.cpp:6725:1: error: expected declaration before ‘}’ token
 } // extern "C"

LdB
Posts: 827
Joined: Wed Dec 07, 2016 2:29 pm

Re: Building Firebird 1.5 from source

Wed Jun 28, 2017 1:51 pm

No I didn't tell you to put one there there was already one there .. here look this is what it looks look

Code: Select all

#ifdef SHLIB_DEFS
} // extern "C"
/**  Use shdef.h which has all shared lib defs **/
#include "shdef.h"
extern "C" {
#endif
What they are doing is terminating the extern C if SHLIB_DEFS is defined so they can #include "shdef.h" without the extern "C" and then restart the extern "C". I am commenting on the junk code nothing more.

It's totally ridiculous you could just take the #include "shdef.h" up above the original extern "C" block rather than that junk or probably as the last include right at the very top of the file. Just because you can do #include directives anywhere does not mean it is a good idea to do it and most of us frown upon it because it shows total lack of control. There is probably a 1 in a million code that it's the best and only way to do it but that code isn't one of those cases.

So lets be clear jrd.cpp requires no changes it needs to look exactly as it does on the repo as bad as that code may be it was always correct. The only change needs to be to jrd.h lines 1055 and 1056.

Return to “C/C++”

Who is online

Users browsing this forum: No registered users and 3 guests