Cross Compiling for ARM architecture

1,006 views
Skip to first unread message

Walt Giroir

unread,
Jul 7, 2014, 9:30:54 AM7/7/14
to capn...@googlegroups.com

Cap'n Proto must be cross compiled to run on the arm architecture.  In general, using the './configure --host=x86' does the trick on most build that support autoconf.

In the case of Cap'n Proto, it still attempts to run an ARM version of capnp.  Has anyone attempted to resolve this issue?

Thanks,
--Walt

Kenton Varda

unread,
Jul 7, 2014, 2:58:49 PM7/7/14
to Walt Giroir, capnproto
Hi Walt,

You'll want to use the "--with-external-capnp" flag to configure; try ./configure --help for more info.

-Kenton


--
You received this message because you are subscribed to the Google Groups "Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capnproto+...@googlegroups.com.
Visit this group at http://groups.google.com/group/capnproto.

Walt Giroir

unread,
Jul 10, 2014, 2:40:45 PM7/10/14
to capn...@googlegroups.com, wa...@giroir.com
Hello Kenton,

Thanks for the quick reply.  I should have caught this one. 

A bit of background may help.  

We are cross compiling capnproto-c++-0.4.1 for an OpenEmbedded project using bitbake

I have encountered a couple more issues.

1. The "make -j6 check" is failing as I believe it is attempting to run an arm version on an x86 platform.

     export CAPNP=/usr/local/bin/capnp
     
./configure --with-external-capnp  --build=x86 --host=armv7 --target='arm-*-eabi' --prefix=${WORKDIR}/git/expanded-prereqs
    make
-j6 check
    make install


With these build commands, I get a couple of test failures and I have confirmed that these are ARM executables


FAIL
: capnp-evolution-test
FAIL
: capnp-test


I do not see a way around this except of skipping the bild step

2.  This issue is much more perplexing to me.  I can skip the check and just run make
     
export CAPNP=/usr/local/bin/capnp
./configure --with-external-capnp  --build=x86 --host=armv7 --target='arm-*-eabi' --prefix=${WORKDIR}/git/expanded-
make
make install


 
I do not see any warnings or errors on the builds and I end up with valid static libraries with valid object files.  I have validated them by moving them to an ARM system and inspecting them with 'nm'

The problem occurs when attempting to link using libkj.a and libcapnp.a.

Here is the command attempting to link these libraries to our application.

arm-poky-linux-gnueabi-g++  -march=armv7-a -mthumb-interwork -mfloat-abi=softfp -mfpu=neon --sysroot=/home/walt/workspace/wwrelay-rootfs/yocto/build/tmp/sysroots/wigwagrelay -g3 -O0  -D_USING_GLIBC_  -\
std
=c++11 -DIZ_LINUX -D_TW_DEBUG -DZDB_JSONPARSER_DEBUG -DZDB_DEBUG_JSON -DZDB_DEBUG_DATATREE -I. -Iexpanded-prereqs/include -D__DEBUG -I/usr/lib/glib-2.0/include -I/usr/include/c++/4.7 -Itests -o ./test\
-ddb-rpc ddb-index.o ddb-thread-pool.o ddb-controller.o ddb-byte-buffer.o bucketipc.o dbstore-mdb.o ddb-rpc.o tests/test-ddb-rpc.o -lkj -lkj-async -lcapnp -lcapnp-rpc -luv -llmdb -luuid -lrt -lgtest -lja\
nsson
-licuuc -licudata -licutu -licui18n -lpthread -lTW  -Lexpanded-prereqs/lib



And one of the errors that are generated is..


/home/walt/workspace/wwrelay-rootfs/yocto/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/devicedb-ng/1.0+gitAUTOINC+80ccda0174-r1/git/expanded-prereqs/include/capnp/layout.h:232: undefined reference\
 to
`capnp::_::StructSize_<devicedb::DBData>::value'
| /home/walt/workspace/wwrelay-rootfs/yocto/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/devicedb-ng/1.-prereqs/include/capnp/layout.h:232: undefined reference to `
capnp::_::StructSize_<devicedb::DB\
Leaf>::value'


I have built this for an x86 platform an compared the command line options as well as the contents/symbols of the produced object files and libraries.

And one more error listed here to be complete.

| expanded-prereqs/lib/libcapnp.a(arena.o): In function `~MutexGuarded':
| /home/walt/workspace/wwrelay-rootfs/yocto/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/devicedb-ng/1.0+gitAUTOINC+80ccda0174-r1/git/prereqs/common/capnproto-
| c++-0.4.1/c++/./src/kj/mutex.h:210: undefined reference to `
kj::_::Mutex::~Mutex()'


any help, ideas or pointers would be greatly appreciated.

Thanks,
--Walt

Walt Giroir

unread,
Jul 10, 2014, 3:55:55 PM7/10/14
to capn...@googlegroups.com, wa...@giroir.com

The tuples posted for the configure were incorrect and should be
./configure --with-external-capnp  -build=x86_64-linux --host=arm-poky-linux-gnueabi --target=arm-poky-linux-gnueabi 

This however does not resolve the issue.

--Walt

Kenton Varda

unread,
Jul 10, 2014, 5:34:55 PM7/10/14
to Walt Giroir, capnproto
Hi Walt,

For your first issue, yeah, you won't be able to run the tests using "make check". You can either skip the tests (just use "make"), or build the tests and then manually copy them over to an arm machine and run them.

For your second issue, the "StructSize" problem is probably because you are not compiling the generated .capnp.c++ file into your program. The capnp tool generates two files, a .h and a .c++; you need to build the .c++ and link it in.

For the missing "kj::Mutex::~Mutex()", I think the problem is that you are specifying your -l flags in the wrong order. When the linker links each library, it only looks for symbols in later libraries. Since libcapnp uses libkj, you have to specify -lcapnp before -lkj.

-Kenton

Walt Giroir

unread,
Jul 11, 2014, 9:01:17 AM7/11/14
to capn...@googlegroups.com, wa...@giroir.com

Thanks Kenton.  That did the trick.  We now have multiple binaries run on the ARM using Cap'n Proto

cur...@prenav.com

unread,
Aug 24, 2015, 10:18:03 PM8/24/15
to Cap'n Proto, wa...@giroir.com
Hello All,

I am also attempting to install Cap'nPproto onto an arm platform using bitbake, and am getting stuck with a bitbake quality assurance issue:

ERROR: QA Issue: capnp: Files/directories were installed but not shipped
 
/usr/local
 
/usr/local/lib
 
/usr/local/include
 
/usr/local/bin
 
/usr/local/lib/libcapnpc.a
   
[....]
 
/usr/local/bin/.debug/capnpc-capnp [installed-vs-shipped]
ERROR
: QA Issue: capnp: The install log indicates that host include and/or library paths were used.

Would you have any tips on how to fix this issue?
Reply all
Reply to author
Forward
0 new messages