Archived

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

Ice-3.0.1 with a non standard install of DB

Here's the context diffs to get ICE to link with a non stanard location for the database.

==== //depot/src/Tools/Distributed/Ice/Ice-3.0.1/demo/Freeze/backup/Makefile#1 - /home/jody/src/Tools/Distributed/Ice/Ice-3.0.1/demo/Freeze/backup/Makefile ====
***************
*** 25,31 ****

$(CLIENT): $(OBJS) $(COBJS)

! $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) -lFreeze $(LIBS)

IntLongMap.h IntLongMap.cpp: $(SLICE2FREEZE)
rm -f IntLongMap.h IntLongMap.cpp
--- 25,31 ----

$(CLIENT): $(OBJS) $(COBJS)

! $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) -lFreeze $(DB_LIBS) $(LIBS)

IntLongMap.h IntLongMap.cpp: $(SLICE2FREEZE)
rm -f IntLongMap.h IntLongMap.cpp
==== //depot/src/Tools/Distributed/Ice/Ice-3.0.1/demo/Freeze/bench/Makefile#1 - /home/jody/src/Tools/Distributed/Ice/Ice-3.0.1/demo/Freeze/bench/Makefile ====
***************
*** 25,31 ****

$(CLIENT): $(OBJS) $(COBJS)

! $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) -lFreeze $(LIBS)

BenchTypes.h BenchTypes.cpp: Test.ice $(SLICE2FREEZE)
rm -f BenchTypes.h BenchTypes.cpp
--- 25,31 ----

$(CLIENT): $(OBJS) $(COBJS)

! $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) -lFreeze $(DB_LIBS) $(LIBS)

BenchTypes.h BenchTypes.cpp: Test.ice $(SLICE2FREEZE)
rm -f BenchTypes.h BenchTypes.cpp
==== //depot/src/Tools/Distributed/Ice/Ice-3.0.1/demo/Freeze/library/Makefile#1 - /home/jody/src/Tools/Distributed/Ice/Ice-3.0.1/demo/Freeze/library/Makefile ====
***************
*** 55,65 ****

$(SERVER): $(OBJS) $(SOBJS)

! $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) -lFreeze $(LIBS)

$(COLLOCATED): $(OBJS) $(COLOBJS)

! $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COLOBJS) -lFreeze $(LIBS) $(READLINE_LIBS)

LibraryTypes.h LibraryTypes.cpp: Library.ice $(SLICE2FREEZE)
rm -f LibraryTypes.h LibraryTypes.cpp
--- 55,65 ----

$(SERVER): $(OBJS) $(SOBJS)

! $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) -lFreeze $(DB_LIBS) $(LIBS)

$(COLLOCATED): $(OBJS) $(COLOBJS)

! $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COLOBJS) -lFreeze $(DB_LIBS) $(LIBS) $(READLINE_LIBS)

LibraryTypes.h LibraryTypes.cpp: Library.ice $(SLICE2FREEZE)
rm -f LibraryTypes.h LibraryTypes.cpp
==== //depot/src/Tools/Distributed/Ice/Ice-3.0.1/demo/Freeze/phonebook/Makefile#1 - /home/jody/src/Tools/Distributed/Ice/Ice-3.0.1/demo/Freeze/phonebook/Makefile ====
***************
*** 55,65 ****

$(SERVER): $(OBJS) $(SOBJS)

! $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) -lFreeze $(LIBS)

$(COLLOCATED): $(OBJS) $(COLOBJS)

! $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COLOBJS) -lFreeze $(LIBS) $(READLINE_LIBS)

NameIndex.h NameIndex.cpp: PhoneBook.ice $(SLICE2FREEZE)
rm -f NameIndex.h NameIndex.cpp
--- 55,65 ----

$(SERVER): $(OBJS) $(SOBJS)

! $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) -lFreeze $(DB_LIBS) $(LIBS)

$(COLLOCATED): $(OBJS) $(COLOBJS)

! $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COLOBJS) -lFreeze $(DB_LIBS) $(LIBS) $(READLINE_LIBS)

NameIndex.h NameIndex.cpp: PhoneBook.ice $(SLICE2FREEZE)
rm -f NameIndex.h NameIndex.cpp

Comments

  • bernard
    bernard Jupiter, FL
    Hi Joseph,

    Let me explain the issue for other forum readers:
    in C++, Freeze uses Berkeley DB internally. The Freeze API does not expose any DB API in its headers, and the Freeze library is linked with the C++ DB library.
    On a number of platforms, when creating an executable, the linker insists to see all shared libraries dependencies, even indirect dependencies. So when you link with "libFreeze", the linker wants to find "libdb_cxx".

    As of Ice 3.0.1, the recommended way to make the linker happy when Berkeley DB is not installed in /usr/lib is to put the Berkeley DB lib directory in LD_LIBRARY_PATH (or another variable depending on your platform/linker). For example:
    export LD_LIBRARY_PATH=/opt/db/lib:$LD_LIBRARY_PATH

    Adding DB_LIBS in the various Makefiles (this patch) is another solution, but it's more complicated.

    Ice 3.1 will provide a nicer solution. All Makefiles have been updated to provide third-party directories using -rpath-link (Linux) or -L (Solaris, HP-UX).

    Also Joseph, please update your signature as desbribed here.

    Best regards,
    Bernard