Error: Inconsistency detected by ld.so

Running a new BeagleBone with supplied OS. Tried using the C compiler
to build a classic hello world. Fails on execution with ...

Inconsistency detected by ld.so: dl-lookup.c: 874: _dl_setup_hash:
Assertion `(bitmask_nwords & (bitmask_nwords - 1)) == 0' failed!

root@beaglebone:~/test# uname -a
Linux beaglebone 3.2.5+ #1 Mon Feb 13 19:22:44 CET 2012 armv7l GNU/
Linux

root@beaglebone:~/test# cat test.c
#include <stdio.h>

void main(char *argv[]) {
        printf("hello world\n");
}
root@beaglebone:~/test# cc -o test.o test.c
root@beaglebone:~/test# ld -o test test.o
root@beaglebone:~/test# ./test
Inconsistency detected by ld.so: dl-lookup.c: 874: _dl_setup_hash:
Assertion `(bitmask_nwords & (bitmask_nwords - 1)) == 0' failed!

root@beaglebone:~/test# ls -l `which cc` `which ld`
lrwxrwxrwx 1 root root 3 Feb 14 14:20 /usr/bin/cc -> gcc
lrwxrwxrwx 1 root root 29 Feb 14 14:20 /usr/bin/ld -> arm-angstrom-
linux-gnueabi-ld

What exactly are you trying to achieve? When called as in your
example, cc produces a working executable. You can run it with
./test.o.
If your program has more modules, you need to call cc with -c option,
to tell it to not to call the linker and link the objects all together
at the end:

cc -c module1.c
cc -c module2.c
...

cc -o output.file module1.o module2.o ...

j.

Call me embarrassed. It's been so long since I did anything simple in
C that I over thought it. I forgot that cc would also do the linking.
Thanks.

No need to feel embarrassed. Probably there are many more people who
don't know how to compile a C program using command line tools, but
they are too afraid to ask the question. Let's hope that it will help
them start with coding.

j.