Segmentation fault

Anthony Foiani anthony.foiani@gmail.com
Wed Mar 6 04:52:00 GMT 2013


Michael --

On Tue, Mar 5, 2013 at 2:05 PM, Michael Powell <mwpowellhtx@gmail.com> wrote:
> Hello,
>
> Targeting Linux ARM (ArchLinux kernel 3.7.1).
>
> I have a simple Hello World type app, that's all it does, cout <<
> "Hello, World!" << endl and that's it. That one works when I cross
> compile and run it on the target.
>
> Then I work int some more elaborate functionality involving I2C
> features, and I get segmentation fault.

The best option here is if you can get a backtrace with the debugger.

If you managed to build a native gdb, try running the offending
program under gdb on the device.

If you didn't get a native gdb, you can use a cross gdb, but it takes
a bit more work.  (And it's related to the shenanigans we need to do
for cross-ldd -- the location of the dynamic libraries is relative to
root at runtime; for your device binaries, that's the root filesystem
image that it is booted with, not the root filesystem on your
development host!)

Again, using my setup, I can get a stack / backtrace by using the
cross-gdb on my devel host by doing something like this:

$ cd /opt/cross/PLATFORM/live
$ ../xtools/bin/TARGET_gdb bin/my-main-app core
(gdb) set sysroot .
(gdb) bt

> Not familiar with this phenomena, per se. I have verified, and our
> target's kernel version is 3.7.1, while the cross compiler was built
> for 3.7.3.
>
> It's possible I need to have built the cross compiler to target kernel
> 3.7.1 to agree with the target?

It's more likely that you're using the host copies of i2c-dev.h, and
there's something in there (endian tests?  who knows!) that is not the
same on ARM.

You really do need to configure/install the i2c-tools correctly for
the target, instead of trying to use the host-native bits.

Good luck,
Tony

--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list