www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - bdb2d and openSUSE

reply unDEFER <undefer gmail.com> writes:
Hello! Trying to build my project for Open SuSE and my project 
bdb2d unexpectedly brings error:

Linking...
../../.dub/packages/bdb2d-5.3.28/bdb2d/.dub/build/library-debug-linux.posix-x86_64-dmd_2071-9E956773380BE684D56F8F1619A72458/li
db.a(db_126_1b8.o): In function
`_D10berkeleydb2db2Db6__ctorMFC10berkeleydb5dbenv5DbEnvkZC10berkeleydb2db2Db':
/home/undefer/unDE/unde-code/../../.dub/packages/bdb2d-5.3.28/bdb2d/source
berkeleydb/db.d:68: undefined reference to `db_create'
../../.dub/packages/bdb2d-5.3.28/bdb2d/.dub/build/library-debug-linux.posix-x86_64-dmd_2071-9E956773380BE684D56F8F1619A72458/libdb
a(dbenv_1a4_1b8.o): In function
`_D10berkeleydb5dbenv5DbEnv6__ctorMFkZC10berkeleydb5dbenv5DbEnv':
/home/undefer/unDE/unde-code/../../.dub/packages/bdb2d-5.3.28/bdb2d/source/be
keleydb/dbenv.d:89: undefined reference to `db_env_create'
../../.dub/packages/bdb2d-5.3.28/bdb2d/.dub/build/library-debug-linux.posix-x86_64-dmd_2071-9E956773380BE684D56F8F1619A72458/libdb.a(dbe
ception_284_455.o): In function
`_D10berkeleydb11dbexception11DbException6__ctorMFAyaiC10berkeleydb5dbenv5DbEnvAyamZC10berkeleydb11dbexception11DbException':
/home/undefer/unDE/unde-code/../../.dub/packages/bdb2d-5.3.28/bdb2d/source/berkeleyd
/dbexception.d:161: undefined reference to `db_strerror'
../../.dub/packages/bdb2d-5.3.28/bdb2d/.dub/build/library-debug-linux.posix-x86_64-dmd_2071-9E956773380BE684D56F8F1619A72458/libdb.a(db
equence_2a6_3df.o): In function
`_D10berkeleydb10dbsequence10DbSequence6__ctorMFC10berkeleydb2db2DbkZC10berkeleydb10dbsequence10DbSequence':
/home/undefer/unDE/unde-code/../../.dub/packages/bdb2d-5.3.28/bdb2d/source/berkele
db/dbsequence.d:51: undefined reference to `db_sequence_create'
collect2: error: ld returned 1 exit status
--- errorlevel 1
dmd failed with exit code 1.


db_create, db_env_create, db_strerror, db_sequence_create all 
defined in the project as extern(C) functions; and all it defined 
as C-functions in external libdb.a library.

The code works under Ubuntu, Linux Mint, Debian, Fedora, but not 
OpenSuse.

What particulars of building under OpenSuSE?
Jan 24 2017
parent reply Jonathan M Davis via Digitalmars-d <digitalmars-d puremagic.com> writes:
On Wednesday, January 25, 2017 00:39:40 unDEFER via Digitalmars-d wrote:
 Hello! Trying to build my project for Open SuSE and my project
 bdb2d unexpectedly brings error:

 Linking...
 ../../.dub/packages/bdb2d-5.3.28/bdb2d/.dub/build/library-debug-linux.posi
 x-x86_64-dmd_2071-9E956773380BE684D56F8F1619A72458/libdb.a(db_126_1b8.o):
 In function
 `_D10berkeleydb2db2Db6__ctorMFC10berkeleydb5dbenv5DbEnvkZC10berkeleydb2db
 2Db':
 /home/undefer/unDE/unde-code/../../.dub/packages/bdb2d-5.3.28/bdb2d/sourc
 e/berkeleydb/db.d:68: undefined reference to `db_create'
 ../../.dub/packages/bdb2d-5.3.28/bdb2d/.dub/build/library-debug-linux.pos
 ix-x86_64-dmd_2071-9E956773380BE684D56F8F1619A72458/libdb.a(dbenv_1a4_1b8.
 o): In function
 `_D10berkeleydb5dbenv5DbEnv6__ctorMFkZC10berkeleydb5dbenv5DbEnv':
 /home/undefer/unDE/unde-code/../../.dub/packages/bdb2d-5.3.28/bdb2d/sourc
 e/berkeleydb/dbenv.d:89: undefined reference to `db_env_create'
 ../../.dub/packages/bdb2d-5.3.28/bdb2d/.dub/build/library-debug-linux.pos
 ix-x86_64-dmd_2071-9E956773380BE684D56F8F1619A72458/libdb.a(dbexception_28
 4_455.o): In function
 `_D10berkeleydb11dbexception11DbException6__ctorMFAyaiC10berkeleydb5dbenv
 5DbEnvAyamZC10berkeleydb11dbexception11DbException':
 /home/undefer/unDE/unde-code/../../.dub/packages/bdb2d-5.3.28/bdb2d/sourc
 e/berkeleydb/dbexception.d:161: undefined reference to `db_strerror'
 ../../.dub/packages/bdb2d-5.3.28/bdb2d/.dub/build/library-debug-linux.pos
 ix-x86_64-dmd_2071-9E956773380BE684D56F8F1619A72458/libdb.a(dbsequence_2a6
 _3df.o): In function
 `_D10berkeleydb10dbsequence10DbSequence6__ctorMFC10berkeleydb2db2DbkZC10b
 erkeleydb10dbsequence10DbSequence':
 /home/undefer/unDE/unde-code/../../.dub/packages/bdb2d-5.3.28/bdb2d/sourc
 e/berkeleydb/dbsequence.d:51: undefined reference to `db_sequence_create'
 collect2: error: ld returned 1 exit status
 --- errorlevel 1
 dmd failed with exit code 1.


 db_create, db_env_create, db_strerror, db_sequence_create all
 defined in the project as extern(C) functions; and all it defined
 as C-functions in external libdb.a library.

 The code works under Ubuntu, Linux Mint, Debian, Fedora, but not
 OpenSuse.

 What particulars of building under OpenSuSE?
My first thought would be that maybe the C library in question isn't actually installed or that you need the dev version of the package installed, and it isn't. If it can't find the symbols, maybe they just aren't currently there. Alternatively, maybe it's not on your library load path - though I would have expected something like that to be installed in /usr/lib, which would definitely be in your library load path. BTW, questions like this are better suited to the D.Learn newsgroup/forum. - Jonathan M Davis
Jan 24 2017
parent unDEFER <undefer gmail.com> writes:
So, the problem:
$ cc --version
cc (SUSE Linux) 4.8.3 20140627 [gcc-4_8-branch revision 212064]
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  
There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A 
PARTICULAR PURPOSE.

$ cc 
.dub/build/OpenSUSE-debug-linux.posix-x86_64-dmd_2071-186D122990333E297AD
D4BDA72364C7/unde.o -o
.dub/build/OpenSUSE-debug-linux.posix-x86_64-dmd_2071-186D122990333E297
D7D4BDA72364C7/unde -g -m64 -Xlinker --no-as-needed
-L/usr/local/BerkeleyDB.5.3/lib64/ -lutil -ldb -ldl -L/usr/lib64 -Xlinker
--export-dynamic ../../.dub/packages/bdb2d-5.3.28/bdb2d/.dub/build/library-debug-linux.posix-x86_64-dmd_2071-9E956773380BE684D56F
F1619A72458/libdb.a ../../.dub/packages/derelict-ft-1.1.3/derelict-ft/.dub/build/library-debug-linux.posix-x86_64-dmd_2071-C5461FBF3AF191B3583F38864166
679/libDerelictFT.a ../../.dub/packages/derelict-sdl2-2.0.2/derelict-sdl2/.dub/build/library-debug-linux.posix-x86_64-dmd_2071-211F2539A3F0A6356A2312EFBC7AF0
2/libDerelictSDL2.a ../../.dub/packages/derelict-util-2.0.6/derelict-util/.dub/build/library-debug-linux.posix-x86_64-dmd_2071-DAD1CE5EB4AA073E02604396A45B67
E/libDerelictUtil.a -Xlinker -Bstatic -lphobos2 -Xlinker -Bdynamic -lpthread
-lm -lrt -ldl
(with -ldb in the middle) doesn't work

$ cc 
.dub/build/OpenSUSE-debug-linux.posix-x86_64-dmd_2071-186D122990333E297AD
D4BDA72364C7/unde.o -o
.dub/build/OpenSUSE-debug-linux.posix-x86_64-dmd_2071-186D122990333E297
D7D4BDA72364C7/unde -g -m64 -Xlinker --no-as-needed
-L/usr/local/BerkeleyDB.5.3/lib64/ -lutil -ldb -ldl -L/usr/lib64 -Xlinker
--export-dynamic ../../.dub/packages/bdb2d-5.3.28/bdb2d/.dub/build/library-debug-linux.posix-x86_64-dmd_2071-9E956773380BE684D56F
F1619A72458/libdb.a ../../.dub/packages/derelict-ft-1.1.3/derelict-ft/.dub/build/library-debug-linux.posix-x86_64-dmd_2071-C5461FBF3AF191B3583F38864166
679/libDerelictFT.a ../../.dub/packages/derelict-sdl2-2.0.2/derelict-sdl2/.dub/build/library-debug-linux.posix-x86_64-dmd_2071-211F2539A3F0A6356A2312EFBC7AF0
2/libDerelictSDL2.a ../../.dub/packages/derelict-util-2.0.6/derelict-util/.dub/build/library-debug-linux.posix-x86_64-dmd_2071-DAD1CE5EB4AA073E02604396A45B67
E/libDerelictUtil.a -Xlinker -Bstatic -lphobos2 -Xlinker -Bdynamic -lpthread
-lm -lrt -ldl -ldb
(with -ldb at the end) works
Jan 25 2017