Archived

This forum has been archived. Please start a new discussion on GitHub.

Problem compiling Ice 3.3.1 in Ubuntu 12.04

Hi.

I need to compile Ice 3.3.1 in Ubuntu 12.04 and am running into linker problems with libdb_cxx.so.

I had to compile the db-4.6.21.NC you provide because ubuntu doesn't package libdb4.x++. I modified Make.rules so that DB_HOME points to where the library was installed, but I'm running into the following linker error:
making all in FreezeScript
make[3]: se ingresa al directorio «/home/gancha/Documentos/Soft/Ice-3.3.1/cpp/src/FreezeScript»
rm -f ../../bin/transformdb
c++ -Wl,--enable-new-dtags -Wl,-rpath,/opt/Ice-3.3/lib -m64 -ftemplate-depth-128 -Wall -D_REENTRANT -I/usr/include/nptl -fPIC -g  -L../../lib  -o ../../bin/transformdb TransformAnalyzer.o TransformVisitor.o Transformer.o transformdb.o ../FreezeScript/Grammar.o Scanner.o AssignVisitor.o Data.o Error.o Functions.o Exception.o Parser.o Print.o Util.o -lSlice  -lIceXML -Wl,-rpath-link,/usr/local/BerkeleyDB.4.6//lib  -lFreeze  -lIce -lIceUtil -L/usr/lib/nptl -lpthread -lrt -L/usr/local/BerkeleyDB.4.6/lib -ldb_cxx
../../lib/libFreeze.so: undefined reference to `Db::set_partition_dirs(char const**)'
../../lib/libFreeze.so: undefined reference to `Db::get_append_recno(int (**)(Db*, Dbt*, unsigned int))'
../../lib/libFreeze.so: undefined reference to `Db::get_partition_callback(unsigned int*, unsigned int (**)(Db*, Dbt*))'
../../lib/libFreeze.so: undefined reference to `Db::set_partition(unsigned int, Dbt*, unsigned int (*)(Db*, Dbt*))'
../../lib/libFreeze.so: undefined reference to `Db::associate_foreign(Db*, int (*)(Db*, Dbt const*, Dbt*, Dbt const*, int*), unsigned int)'
../../lib/libFreeze.so: undefined reference to `Db::get_create_dir(char const**)'
../../lib/libFreeze.so: undefined reference to `Db::get_h_compare(int (**)(Db*, Dbt const*, Dbt const*))'
../../lib/libFreeze.so: undefined reference to `Db::get_h_hash(unsigned int (**)(Db*, void const*, unsigned int))'
../../lib/libFreeze.so: undefined reference to `Db::get_errcall(void (**)(DbEnv const*, char const*, char const*))'
../../lib/libFreeze.so: undefined reference to `Db::get_bt_compress(int (**)(Db*, Dbt const*, Dbt const*, Dbt const*, Dbt const*, Dbt*), int (**)(Db*, Dbt const*, Dbt const*, Dbt*, Dbt*, Dbt*))'
../../lib/libFreeze.so: undefined reference to `Db::get_bt_compare(int (**)(Db*, Dbt const*, Dbt const*))'
../../lib/libFreeze.so: undefined reference to `Db::get_alloc(void* (**)(unsigned long), void* (**)(void*, unsigned long), void (**)(void*))'
../../lib/libFreeze.so: undefined reference to `Db::sort_multiple(Dbt*, Dbt*, unsigned int)'
../../lib/libFreeze.so: undefined reference to `Db::set_bt_compress(int (*)(Db*, Dbt const*, Dbt const*, Dbt const*, Dbt const*, Dbt*), int (*)(Db*, Dbt const*, Dbt const*, Dbt*, Dbt*, Dbt*))'
../../lib/libFreeze.so: undefined reference to `Db::set_create_dir(char const*)'
../../lib/libFreeze.so: undefined reference to `Db::get_bt_prefix(unsigned long (**)(Db*, Dbt const*, Dbt const*))'
../../lib/libFreeze.so: undefined reference to `Db::get_partition_keys(unsigned int*, Dbt**)'
../../lib/libFreeze.so: undefined reference to `Db::get_partition_dirs(char const***)'
../../lib/libFreeze.so: undefined reference to `Db::get_feedback(void (**)(Db*, int, int))'
../../lib/libFreeze.so: undefined reference to `Db::get_msgcall(void (**)(DbEnv const*, char const*))'
../../lib/libFreeze.so: undefined reference to `Db::get_dup_compare(int (**)(Db*, Dbt const*, Dbt const*))'
collect2: ld devolvió el estado de salida 1
make[3]: *** [../../bin/transformdb] Error 1
make[3]: se sale del directorio «/home/gancha/Documentos/Soft/Ice-3.3.1/cpp/src/FreezeScript»

The path in the -L option does contain the libdb_cxx.so file:
ls /usr/local/BerkeleyDB.4.6/lib/
libdb-4.6.a   libdb-4.so       libdb_cxx-4.6.la  libdb_cxx.a
libdb-4.6.la  libdb.a          libdb_cxx-4.6.so  libdb_cxx.so
libdb-4.6.so  libdb_cxx-4.6.a  libdb_cxx-4.so    libdb.so

Does anyone know what can be going on?

Thanks in advance,
Gonzalo

Comments

  • xdm
    xdm La Coruña, Spain
    Hi Gonzalo,

    I have give a try to Ice-3.3.1 on Ubuntu 12.04 and not found any problems with berkeley DB and Freeze.

    Looking for the missing undefined symbols they doesn't appear to be part of db-4.6
    $ grep get_dup_compare /usr/lib/i386-linux-gnu/libdb*
    Binary file /usr/lib/i386-linux-gnu/libdb-5.1.a matches
    Binary file /usr/lib/i386-linux-gnu/libdb.a matches
    Binary file /usr/lib/i386-linux-gnu/libdb_cxx-5.1.a matches
    Binary file /usr/lib/i386-linux-gnu/libdb_cxx-5.1.so matches
    Binary file /usr/lib/i386-linux-gnu/libdb_cxx.a matches
    Binary file /usr/lib/i386-linux-gnu/libdb_cxx.so matches
    Binary file /usr/lib/i386-linux-gnu/libdb_java-5.1.a matches
    jose@sirius:~/zeroc/Ice-3.3.1/cpp/src/FreezeScript$ 
    jose@sirius:~/zeroc/Ice-3.3.1/cpp/src/FreezeScript$ grep get_dup_compare /opt/db-4.6.21/* -R
    

    As you can see from above command there isn't any matches in db-4.6.21, seems to me that there are several version of DB causing some conflict.

    You can check the DB version linked with Freeze with ldd command
    Ice-3.3.1/cpp/src/Freeze$ ldd ../../lib/libFreeze.so
    	libIce.so.33 => not found
    	libIceUtil.so.33 => not found
    	libdb_cxx-4.6.so => not found
    	libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb75b7000)
    	libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb74d2000)
    	libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb74b4000)
    	libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb730b000)
    	/lib/ld-linux.so.2 (0xb7705000)
    	libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb72de000)
    

    I wondering why in your link command the Makefile try to link with libraries in "lib" sub directory, when for 64 bits builds should be picking libraries for lib64 instead.

    If you have made changes to the Makefiles i suggest you to start with a new vanilla distribution, here is how i have build it.
    tar zxvf Ice-3.3.1.tar.gz 
    tar zxvf ThirdParty-Sources-3.3.1.tar.gz 
    tar zxvf db-4.6.21.NC.tar.gz 
    cd db-4.6.21.NC/
    patch -p0 ../db/patch.4.6.21.1
    patch -p0 < ../db/patch.4.6.21.1
    patch -p0 < ../db/patch.4.6.21.2
    patch -p0 < ../db/patch.4.6.21.3
    patch -p0 < ../db/patch.4.6.21.15663 
    cd build_unix/
    ../dist/configure --prefix=/opt/db-4.6.21 --enable-cxx
    make -j4
    sudo make install
    cd /opt/db-4.6.21/
    sudo ln -s lib lib64
    export DB_HOME=/opt/db-4.6.21
    cd Ice-3.3.1/
    cd cpp/src/
    make -j4
    


    Cheers,
    Jose
  • Hi Jose

    Thans for your quick response. As you said, the conflict was with some files from libdb5.1 which I had not removed correctly. Now everything's working just fine.

    Thanks for your help.

    Best,
    Gonzalo