Archived

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

Cross compile Ice-E to ARM architecture

Clement
edited November 2016 in Help Center

Hi,

I am currently trying to cross compile Ice-E for an ARM architecture, but I think I am doing this in a bad way.
I downloaded Ice-E by doing : git clone -b 3.6 https://github.com/zeroc-ice/icee.git --recursive

So, firstly I tried to compile Ice-E on my Ubuntu 14.04. For that, I compiled Ice in the "ice" directory by doing a simple make. It worked.
Then, I returned in the Ice-E root directory, and I edited the Makefile like that :
- prefix = /my/directory/.......
- OPTIMIZE = yes
- ICEE_TARGET_OS = debian
- HOST = x86_64-linux-gnu

Finally, I did make CC=gcc CXX=g++ AR=ar STRIP=strip. (If I don't add CC=.. CXX=.., I get an error like "x86_64-linux-gnu-g++ does not exist, and I think I understand why").
It worked. Then make install, and I obtained in my install directory the bin, include, lib, python, share and slice directories. Ok, everything seemed fine (except that for example, in the lib directory, I don't have any lib like "libIceE.so", but only libs like "libIce.so", is it normal ?).

Now, I would like to cross compile Ice-E using arm-linux-gnueabi. So, for that, in the Makefile :

  • HOST = arm-linux-gnueabihf

I use :
make CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-g++ AR=arm-linux-gnueabi-ar STRIP=arm-linux-gnueabi-strip CPPFLAGS+=-I/home/***/arm_third_parties/bzip2-1.0.6_arm/install/include LDFLAGS+="-L/home/***/arm_third_parties/bzip2-1.0.6_arm/install/lib -L/home/***/arm_third_parties/openssl-arm/install/lib"

These paths leads to cross-compiled third parties (bzip2 and openssl).

During compilation, at the step "Creating library: libIceUtil.so.3.6.3", I get this error :
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: failed to merge target specific data of file cpp/src/IceUtil/arm-linux-gnueabihf/pic/Timer.o /usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: error: cpp/src/IceUtil/arm-linux-gnueabihf/pic/Unicode.o uses VFP register arguments, cpp/lib/arm-linux-gnueabihf/libIceUtil.so.3.6.3 does not

It is only an example, there are a lot of similar errors.

What can I do ?
Note that when I use arm-linux-gnueabihf instead of arm-linux-gnueabi I get the same error.

Thank you, and sorry for my bad english.

Comments

  • xdm
    xdm La Coruña, Spain

    "libIceE.so", but only libs like "libIce.so", is it normal

    Yes that is expected

    make CC=gcc CXX=g++ AR=ar STRIP=strip

    That shouldn't be required, what is the output of

    dpkg-architecture -qDEB_BUILD_GNU_TYPE
    

    As for your link error seems you are mixing hard and soft float ABIs, you should use arm-linux-gnueabihf (that is the default for debian builds) you don't need to set CC, CXX, AR , STRIP

    Note that Ubuntu 14.04 is not a supported build configuration, we build and test Debian 8 Jessie

  • Clement
    edited November 2016

    dpkg-architecture -qDEB_BUILD_GNU_TYPE

    i686-linux-gnu
    I tried to compile all the third parties with arm-linux-gnueabihf and retried to compile ice-e with arm-linux-gnueabihf with this command :
    make CPPFLAGS+="-I/home/<my_name>/arm_third_parties/bzip2-1.0.6_arm/install/include -I/home/<my_name>/arm_third_parties/openssl_armhf/install/include -I/home/<my_name>/arm_third_parties/db-5.3.28/install/include -I /home/<my_name>/arm_third_parties/expat_armhf/expat/install/include" LDFLAGS+="-L/home/<my_name>/arm_third_parties/bzip2-1.0.6_arm/install/lib -L/home/<my_name>/arm_third_parties/openssl_armhf/install/lib -L/home/<my_name>/arm_third_parties/db-5.3.28/install/lib -L/home/<my_name>/arm_third_parties/expat_armhf/expat/install/lib -Wl,-rpath-link,/home/<my_name>/arm_third_parties/expat_armhf/expat/install/lib"

    More readable :
    make CPPFLAGS+=" -I/home/<my_name>/arm_third_parties/bzip2-1.0.6_arm/install/include -I/home/<my_name>/arm_third_parties/openssl_armhf/install/include -I/home/<my_name>/arm_third_parties/db-5.3.28/install/include -I/home/<my_name>/arm_third_parties/expat_armhf/expat/install/include" LDFLAGS+=" -L/home/<my_name>/arm_third_parties/bzip2-1.0.6_arm/install/lib -L/home/<my_name>/arm_third_parties/openssl_armhf/install/lib -L/home/<my_name>/arm_third_parties/db-5.3.28/install/lib -L/home/<my_name>/arm_third_parties/expat_armhf/expat/install/lib -Wl,-rpath-link,/home/<my_name>/arm_third_parties/expat_armhf/expat/install/lib"

    But I get this error :
    Creating library: libIceSSL.so.3.6.3 Linking glacier2router cpp/lib/arm-linux-gnueabihf/libIceSSL.so: undefined reference to "CRYPTO_set_locking_callback" cpp/lib/arm-linux-gnueabihf/libIceSSL.so: undefined reference to "ERR_free_strings" ........................ collect2: error: ld returned 1 exit status make: *** [cpp/bin/glacier2router] Error 1

    I don't understand why. These references are from libcrypto and libssl don't they ? I have linked them with the line "-L/home/my_name/arm_third_parties/openssl_armhf/install/lib" in my make command.

    Any suggestion ?
    Thank you.

  • xdm
    xdm La Coruña, Spain

    Hi,

    i686-linux-gnu

    I see we don't really support this configuration, just native builds for x86_64-linux-gnu and armhf-linux-gnu and cross compiling armhf-linux-gnu with x86_64-linux-gnu

    CRYPTO_set_locking_callback was removed in 1.1.0 seems to me that in your build you are mixing two different OpenSSL versions.

    Systems headers from an earlier version, and you armhf builds is using 1.1.0? If that is the case try to remove the openssl-dev from system, or use the same version for your armhf builds.

    By the way you can see the full build log by passing V=1 in make command line.

  • Thank you for your answer.
    I don't know how, but I succeeded (before your answer). After a make clean (and some other errors), it finally worked. And I succeeded to compile a small program with these libraries, and obtained an ARM executable, so it seems to work fine.

    Just a question : what is the real difference between Ice and Ice-e ? I don't understand well. Is Ice-e just a version of Ice which can be cross-compiled (with static libraries) ? Or is it another thing ?
    Does this page (https://doc.zeroc.com/display/Ice36/Ice-E+Feature+Set) show all the features differences ?
    Thank you.

  • xdm
    xdm La Coruña, Spain

    as 3.6 Ice and IceE are different builds of Ice, IceE allows for cross-compiling and static library builds, for 3.7 we are totally merging the two products as Ice.

  • Ok, thank you very much.

  • Hi,

    Hope somebody will see this post (else I will reopen an other).
    I did not notice, but with Ice-e libIceUtil is only a shared library. I don't have libIceUtil.a.
    Is it normal ?
    Thank you.

  • xdm
    xdm La Coruña, Spain

    Yes, as pointed in release notes The static Ice library includes the symbols for Ice, IceUtil, IceSSL, IceDiscovery and IceLocatorDiscovery.

  • Clement
    edited November 2016

    Ok.
    But when I only link libIce.a I get undefined references :
    /home/<my_name>/icee_arm/install/lib/arm-linux-gnueabihf/libIce.a(ConnectionI.o): In function "Ice::ConnectionI::doUncompress(IceInternal::BasicStream&, IceInternal::BasicStream&)": ConnectionI.cpp:(.text._ZN3Ice11ConnectionI12doUncompressERN11IceInternal11BasicStreamES3_+0x70): undefined reference to "BZ2_bzBuffToBuffDecompress" /home/<my_name>/icee_arm/install/lib/arm-linux-gnueabihf/libIce.a(ConnectionI.o): In function "Ice::ConnectionI::doCompress(IceInternal::BasicStream&, IceInternal::BasicStream&)": ConnectionI.cpp:(.text._ZN3Ice11ConnectionI10doCompressERN11IceInternal11BasicStreamES3_+0x56): undefined reference to "BZ2_bzBuffToBuffCompress"

    And grep -r BZ2_bzBuffToBuffCompress (for example) in the Ice-e lib directory gives the following result :
    Binary file libIce.a matches Binary file libIce.so.3.6.3 matches

    How to fix this issue ?

    Thank you.

    EDIT : Sorry for that. I only have to link bzip2 library. It works fine now. Thank you.

  • xdm
    xdm La Coruña, Spain
    edited November 2016

    those symbols come from system libraries bzip2 and dl respectively see the sample link command in release notes:

    arm-linux-gnueabihf-g++-4.9 -o client Hello.o Client.o -Wl,-Bstatic -lIce -Wl,-Bdynamic -lcrypto -lssl -pthread -lbz2 -ldl -lrt