I'm trying to compile gdbserver for the purpose of remote debugging on an embedded MIPs platform. I have a cross compiler GCC, binutils, and gdb compiled for the platform.
My configure command is as so
../gdb-7.6/gdb/gdbserver/configure --target=$TARGET --prefix=$PREFIX --target=$TARGET --build=x86_64-unknown-linux-gnu
However, it keeps building with my system compiler rather than the cross-compiler, so I get errors. How can I configure this to build with the cross compiler so that I can run gdbserver on the embedded platform and then debug it from my PC?
You want --host, not --target.
Related
I am developing an application for enocean. I am able to compile it for my Host system. I want to cross compile it for beaglebone black running openwrt. I have cross compiler and all other libraries. I am not sure how to change the existing configure, Makefiles to cross-compile it.
Please help!
you don't have to change anything. autotools comes with full cross-compilation support.
Just pass the proper --host= flag for your target architecture, e.g.:
./configure --host arm-linux-gnueabihf
This will look for toolchain programs with the given prefix (in the above case, it would look e.g. for a compiler arm-linux-gnueabihf-gcc) in your current $PATH. Most cross-compiling toolchains should automatically adhere to this convention.
See also the official documentation
Has anybody successful cross compiled the Xalan C++ library for armv7/armv7s arch to be used on iOS device (not simulator)?
I was able to cross compile the xerces library by setting the iOS g++/gcc compilers for armv7 but using the same procedure for Xalan gives me below error while running the make file:
iComp:c iComp$ make
Linux, Solaris, AIX, Compaq Tru64, OS/390, MacOSX, HP-UX, NETBSD, FREEBSD, CYGWIN, and MINGW are the only platforms supported.
Above error clearly states that I cannot target the iOS platform.
So was there some problem in configuring the makefiles?
UPDATE
The above issue was occurring because of incorrect usage of Xalan's runConfigure file.
The correct usage to pass additional options to Configure file via runConfigure is to use '-C' option with "--host=arm-apple-darwin --disable-shared"
This has helped to resolve the above platform detection issue and generated the cross-compile make files.
PROBLEM
But now the issue is while running the make, default MsgLoader (inmeme)executable is generated (target: armv7) and after that the make file tries to run the armv7 executable on Mac OSX obviously giving the error 'Bad CpuType in executable'
How can I either avoid the building of Xalan by creating a armv7 exe of MsgLoader or run this armv7 exe in terminal (doesn't seems possible!) so that it proceeds with the build.
Thanks in advance for any help!!!
Can I debug a program running on a remote target to which I have ssh access, using local source files?
Say I've got a program called hello.c, in directory /home/jla/hello on my home machine.
And on the remote machine I put this same file in a directory /hello, and compile it with
$ gcc -g -o hello hello.c, and then delete the remote hello.c, but leave the executable.
Can I then run gdb locally, get it to ssh in to the remote machine to run the executable, but use the local sources as reference?
Notes:
Annoyingly, the remote machine is very stripped down and can't be altered. It has gdb, but it doesn't have gdbserver
Note that the local and the remote machine have different architectures. In this particular case 64bit and 32bit intel
What I really want to do is run it under emacs/gud. But this would be a great start.
The architectures of remote and local machines matter very little. What matters is how hello, gdb and gdbserver are built.
It sounds from your description that hello is built (on remote machine) for x86_64-linux-gnu
That means you need x86_64-linux-gnu gdbserver, and also a 32-bit GDB that is capable of debugging x86_64 binaries. You should be able to build both, copy gdbserver to the remote machine, and debug "normally".
I am attempting to setup a small build cluster at home using distcc. There are two x64 systems and 1 i686 systems. All systems are running Ubuntu 10.10 and are up to date. The system that is initiating the build is x64. Distcc works fine between the two x64 systems but all build tasks sent to the i686 system fail.
So far:
I have installed the multilib package for g++ on that system. I am able to cross-compile to x64 locally using g++ -m64
Changed the link in /usr/lib/distcc/g++ to point to a script that explicity sets the -m64 parameter.
Any suggestions?
Attempting this one again after more research:
GCC has a page describing the i386 and x86-64 options. The -m64 flag says to generate 64-bit code, but you'll also want to specify the type of CPU with -march=i686 or -march=k8 or similar, to use the correct instruction set.
Since distcc sends the GCC command line flags out, you should try adding these to the distcc command running locally and skip the remote script for setting flags.
If you test the architecture flags on your local x64 machine without distcc, just g++, then it should give you the right binaries when using distcc.
I am a java developer. I have some C++ code to make some system realted calls. This code is compiled on Intel 32-bit platform using GCC (I have make files) and it works fine on regular Intel based 32-bit linux machine. Now I need to run this on a linux OS running on Marvell ARM processor. When I load the shared objects in java I get the following error.
cannot open shared object file: No such file or directory (Possible cause: can't load IA 32-bit .so on a ARM-bit platform)
Please tell me how to resolve this issue. I looked at the GCC options and I found one option to specify the architecture (-march=armv5) and I can't compile with that option.
Thanks in advance.
You need more than just a switch, you need a cross-compiler. You can make your own, but probably the easiest way is :
Find the development tools for your board. It probably comes with a development kit that includes a cross-compilation toolchain
If you don't have these, you can try to install a precompiled cross-compilation like the ones provided freely by CodeSourcery
Then you have to make the location of your toolchain (look for something like arm-none-linux-gnueabi-gcc) available in your path.
Cross compiling simple project is then easy, just override the CC variable in your Makefile :
CROSS = arm-none-linux-gnueabi-
CC = $(CROSS)gcc
LD = $(CROSS)ld
Try using the -mcpu=armv5 switch for gcc.
Here is what's written on http://elinux.org/RPi_Software#ARM:
-Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s