Build ICE 3.7 cpp from source on Linux errors

Michael4525Michael4525 Michael KasseckerOrganization: personalProject: Grid ComputingMember

Hi,

I am trying to build Ice from source on a Suse OSL 42.3. I changed into the config directory, set the path for the mcpp library. I compiled a static mcpp library myself. I uncommented "#MCPP_HOME ?= /opt/mcpp" and filled in the path. I ran "make" it starts to compile but unfortunately got this error message:

../config/Make.rules:173: *** Recursive variable 'mcpp_installdir' references itself (eventually). Stop.

The lines in queston of Make.rules are:

163 #
164 # Support for 3rd party libraries
165 #
166 thirdparties := mcpp iconv expat bz2 lmdb
167 mcpp_home := $(MCPP_HOME)
168 iconv_home := $(ICONV_HOME)
169 expat_home := $(EXPAT_HOME)
170 bz2_home := $(BZ2_HOME)
171 lmdb_home := $(LMDB_HOME)
172
173 $(foreach l,$(thirdparties),$(eval $(call make-lib,$l)))

What am I doing wrong? Can you help me?

Thanks in advance!

Answers

  • benoitbenoit Rennes, FranceBenoit FoucherOrganization: ZeroC, Inc.Project: IceAdministrators, ZeroC Staff ZeroC Staff

    Hi,

    Which gmake version do you have installed on this platform? We don't get this problem with SLES12. As a workaround, instead of setting MCPP_HOME, you could try calling make as follow:

    make CPPFLAGS=-I/opt/mcpp/include LDFLAGS=-L/opt/mcpp/lib 
    

    Cheers,
    Benoit.

  • Michael4525Michael4525 Michael KasseckerOrganization: personalProject: Grid ComputingMember

    Hey Benoit,

    thanks for your reply! The current version is:

    GNU Make 4.0 Built for x86_64-unknown-linux-gnu

  • Michael4525Michael4525 Michael KasseckerOrganization: personalProject: Grid ComputingMember
    edited March 5

    This time I try to compile ice on Ubuntu 16.04 LTS for comparison in order to find my misunderstanding. Again I cloned the ice and the mcpp zeroc fork. I compiled mcpp and installed it with 'make install'.

    I updated the config/Make.rules as follows:

    #
    # Third-party libraries (Ice for C++)
    #
    # If a third-party library is not installed in a standard location
    # where the compiler can find it, set the corresponding variable
    # below to the installation directory of the library.
    #
    MCPP_HOME               ?= /opt/mcpp-2.7.2/lib/x86_64-linux-gnu
    #ICONV_HOME             ?= /opt/iconv
    #EXPAT_HOME             ?= /opt/expat
    #BZ2_HOME               ?= /opt/bz2
    #LMDB_HOME              ?= /opt/lmdb
    

    In /opt/mcpp-2.7.2/lib/x86_64-linux-gnu there's definitely a libmcpp.a present.

    When I change in the ice/cpp subfolder and run make the script complains like that:

    Linking [amd64-static] bin/slice2js
    /usr/bin/ld: cannot find -lmcpp
    collect2: error: ld returned 1 exit status
    Makefile:30: recipe for target 'bin/slice2js' failed
    make: *** [bin/slice2js] Error 1
    

    Second issue: if I run make clean, the script confirms that it performed a clean on the subfolders. But there are still object files present in the src/source tree.

    I clearly misunderstood something here - probably something basic...

  • Michael4525Michael4525 Michael KasseckerOrganization: personalProject: Grid ComputingMember
    edited March 5

    Maybe I didn't say it too directly. Obviously the script does not accept an archive. Is this intended to do so? I am a little bit puzzled because the mcpp zeroc fork outputs a static library by default and the install script copies this archive without headers to /opt/mcpp-2.7.2/lib/x86_64-linux-gnu.

    If you compile the mcpp library as shared object and point the script to a folder containing the shared object the script runs with Ubuntu. Fortunately it's very easy to compile the mcpp as shared object. I wrote a CMakeList.txt that compiles both static and shared:

    cmake_minimum_required(VERSION 3.3)
    
    SET (SOURCES directive.c  eval.c  expand.c  main.c mbchar.c  support.c  system.c)
    
    INCLUDE_DIRECTORIES(    ${PROJECT_SOURCE_PATH})
    
    ADD_LIBRARY(mcpp SHARED ${SOURCES})
    ADD_LIBRARY(mcpp_static STATIC ${SOURCES})
    
    SET_TARGET_PROPERTIES(mcpp PROPERTIES LINKER_LANGUAGE C)
    SET_TARGET_PROPERTIES(mcpp_static PROPERTIES LINKER_LANGUAGE C)
    

    To use that install cmake, copy that script into the sources of mcpp. Then

    1. Create an output folder PATH_TO_OUTPUT_FOLDER
    2. change into that folder
    3. run cmake PATH_TO_OUTPUT_FOLDER
    4. run 'make'

    The result is a shared and a static library

  • Michael4525Michael4525 Michael KasseckerOrganization: personalProject: Grid ComputingMember

    For some reason the accepted answer has disappeared...

  • benoitbenoit Rennes, FranceBenoit FoucherOrganization: ZeroC, Inc.Project: IceAdministrators, ZeroC Staff ZeroC Staff

    Hi Michael,

    You should set MCPP_HOME to the path of the mcpp installation directory, not the path of the lib sub-directory. So if you installed mcpp in /opt/mcpp-2.7.2, you should set MCPP_HOME to /opt/mcpp-2.7.2.

    If it still doesn't work with this change, please run make V=1, this will print the detail of the build commands.

    You can use make distclean to fully clean the build tree. make clean cleans the build tree for the default platform/configuration (amd64/shared on Ubuntu), Slice translators are built with the static configuration so they aren't cleaned unless you run make CONFIGS=static clean.

    Cheers,
    Benoit.

Sign In or Register to comment.