[ros-users] Cross-compilation and library locations

Daniel Maier maierd at informatik.uni-freiburg.de
Tue Apr 13 13:54:09 UTC 2010


Ben,

thanks for the link to your tutorial! 
I tried following it with some adjustments for the Nao architecture and ran into some difficulties. Maybe you can give me a hint?

When I try to configure apr with  CC and CXX pointing to my
cross-compilation tools the configure scripts fails to build the sample
program.
This is what I call:
./configure --prefix=$ROS_ROOT/../ros-deps --disable-shared --enable-static ac_cv_file__dev_zero=yes ac_cv_func_setpgrp_void=yes apr_cv_tcp_nodelay_with_cork=no apr_cv_process_shared_works=no apr_cv_mutex_robust_shared=no ac_cv_sizeof_struct_iovec=8 apr_cv_mutex_recurive=yes CC=PATH_TO_GEODE_CC CXX=$PATH_TO_GEODE_CXX CFLAGS=-march=geode CXXFLAGS=-march=geode 

config.log contains the verbose output of the compiler which is:
Configured with: /home/opennao/opennao-1-4-x/build/tmp/work/geode-linux/gcc-cross-4.3.3-r4.1/gcc-4.3.3/configure --build=i686-linux --host=i686-linux --target=i586-linux --prefix=/home/opennao/opennao-1-4-x/build/tmp/cross/geode --exec_prefix=/home/opennao/opennao-1-4-x/build/tmp/cross/geode --bindir=/home/opennao/opennao-1-4-x/build/tmp/cross/geode/bin --sbindir=/home/opennao/opennao-1-4-x/build/tmp/cross/geode/bin --libexecdir=/home/opennao/opennao-1-4-x/build/tmp/cross/geode/libexec --datadir=/home/opennao/opennao-1-4-x/build/tmp/cross/geode/share --sysconfdir=/home/opennao/opennao-1-4-x/build/tmp/cross/geode/etc --sharedstatedir=/home/opennao/opennao-1-4-x/build/tmp/cross/geode/com --localstatedir=/home/opennao/opennao-1-4-x/build/tmp/cross/geode/var --libdir=/home/opennao/opennao-1-4-x/build/tmp/cross/geode/lib --includedir=/home/opennao/opennao-1-4-x/build/tmp/cross/geode/include --oldincludedir=/home/opennao/opennao-1-4-x/build/tmp/cross/geode/include --infodir=/home/opennao/opennao-1-4-x/build/tmp/cross/geode/share/info --mandir=/home/opennao/opennao-1-4-x/build/tmp/cross/geode/share/man --with-gnu-ld --enable-shared --enable-target-optspace --enable-languages=c,c++,objc --enable-threads=posix --enable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=i586-linux- --enable-cheaders=c_std --enable-libssp --disable-bootstrap --disable-libgomp --disable-libmudflap --with-local-prefix=/home/opennao/opennao-1-4-x/build/tmp/staging/geode-linux/usr --with-gxx-include-dir=/home/opennao/opennao-1-4-x/build/tmp/staging/geode-linux//usr/include/c++ --with-sysroot=/home/opennao/opennao-1-4-x/build/tmp/staging/geode-linux --with-build-sysroot=/home/opennao/opennao-1-4-x/build/tmp/staging/geode-linux --enable-cheaders=c_std --disable-libunwind-exceptions --with-mpfr=/home/opennao/opennao-1-4-x/build/tmp/staging/i686-linux/usr --enable-__cxa_atexit
Thread model: posix
gcc version 4.3.3 (GCC)

The error message in config.log is:
configure:4568: $? = 0
configure:4557: /home/aishome/maierd/nao/ctc-academics-1.6.0/cross/geode/bin/i586-linux-gcc -V >&5
i586-linux-gcc: '-V' option must have argument
configure:4568: $? = 1
configure:4557: /home/aishome/maierd/nao/ctc-academics-1.6.0/cross/geode/bin/i586-linux-gcc -qversion >&5
i586-linux-gcc: unrecognized option '-qversion'
i586-linux-gcc: no input files
configure:4568: $? = 1
configure:4590: checking for C compiler default output file name
configure:4612: /home/aishome/maierd/nao/ctc-academics-1.6.0/cross/geode/bin/i586-linux-gcc -march=geode   conftest.c  >&5
conftest.c:9:19: error: stdio.h: No such file or directory
conftest.c: In function 'main':
conftest.c:13: error: 'FILE' undeclared (first use in this function)
conftest.c:13: error: (Each undeclared identifier is reported only once
conftest.c:13: error: for each function it appears in.)
conftest.c:13: error: 'f' undeclared (first use in this function)
configure:4616: $? = 1
configure:4653: result:
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
| #include <stdio.h>
| int
| main ()
| {
| FILE *f = fopen ("conftest.out", "w");
|  return ferror (f) || fclose (f) != 0;
|
|   ;
|   return 0;
| }
configure:4659: error: in `/home/aishome/maierd/nao/ros_nao_build/ros-deps/apr-1.3.9':
configure:4663: error: C compiler cannot create executables
See `config.log' for more details.

I think the problem is that gcc/g++ only checks for headers and libs in those /home/opennao/opennao-1-4-x/build/tmp/cross/geode/* dirs which of course do not exist on my machine. Instead I have the headers and libs in subfolders of /home/aishome/maierd/nao/ctc-academics-1.6.0/staging/geode-linux/usr/ (part of the cross-compilation tools). 
So I passed CPPFLAGS=-I$path_to_cross_tools/include LIBS="-L$path_to_cross_tools/lib" to configure. 
In this case configure fails with the following error in config.log:
configure:4590: checking for C compiler default output file name
configure:4612: /home/aishome/maierd/nao/ctc-academics-1.6.0/cross/geode/bin/i586-linux-gcc -march=geode -I/home/aishome/maierd/nao/ctc-academics-1.6.0/staging/geode-linux/usr//include -L/home/aishome/maierd/nao/ctc-academics-1.6.0/staging/geode-linux/usr//lib conftest.c  >&5
/home/aishome/maierd/nao/ctc-academics-1.6.0/cross/geode/bin/../lib/gcc/i586-linux/4.3.3/../../../../i586-linux/bin/ld: crt1.o: No such file: No such file or directory

So I think ld lacks the path to the necessary libaries and I need to
pass those as arguments too.

But is this really how it is supposed to work?
I tried compiling with --prefix set to the $path_to_cross_tools in which
case it should automatically find the libs in $prefix/libs and the
headers in $prefix/include. However that doesn't seem to be the case as
the outputs in config.log remain the same.

Any suggestions?

Thanks,
Dan

P.S. and good luck with the exams :)


On Mon, Apr 12, 2010 at 11:56:52PM -0400, Benjamin Vanheuverzwijn wrote:
> On Mon, Apr 12, 2010 at 11:49 PM, Osiloke Emoekpere
> <osiloke_e at skuuled.com>wrote:
> 
> > That is a much cleaner way of cross compiling ROS, thanks (even though i
> > did not start this thread).
> > For my compile i ended up using bitbake to build the dependencies (apr,
> > log4cxx, boost) and then did the
> > gumros way but i'll be using your technique from now on.
> >
> 
> Thanks, although it is still a work in progress. I think some steps are
> missing, but still it is a good start.
> 
> I will complete the how-to when my exams are done so probably next week!
> Anyway, i'll send an email to the ros-users ML when everything will be set
> up and working (also i will edit the current ROS cross-compilation wiki
> article).
> 
> </thread-hijack>
> 
> -- 
> Benjamin Vanheuverzwijn
> 
> Google Talk/Jabber - bvanheu at gmail.com
> http://vanheu.ca

> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users




More information about the ros-users mailing list