SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
By trip_out
#14437
Hi there,

I'd like to build this on OSX however run into this when I make...

gcc -g -O2 -o openocd openocd.o ../src/xsvf/libxsvf.a ../src/target/libtarget.a ../src/jtag/libjtag.a ../src/helper/libhelper.a ../src/server/libserver.a ../src/helper/libhelper.a ../src/flash/libflash.a ../src/target/libtarget.a
ld: Undefined symbols:
_strndup
make[3]: *** [openocd] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Any ideas? This is with either GCC 4 or 3.3.

Thanks, Andy.
By Dominic
#14440
Hey,

looks like OSX lacks the strndup() function. FreeBSD has the same problem, and there's already a fix in gdb_server.c:34. If you know what preprocessor symbol may be used to identify an OSX build (like __FreeBSD__), just add it to the #ifdef statement, and send me a patch after you've built the OpenOCD on OSX.

You'll also have to check what possibilites exist to access the parallel port hardware on OSX. On FreeBSD, the outb macro had its parameters switched, and the ioperm() function is called i386_set_ioperm().
As far as I know, there is no FTDI driver available on OSX, so you wont be able to use a USB device, although it might be possible to port the libftdi to use it on OSX (which is still slower than the ftd2xx driver).

Regards,

Dominic
By trip_out
#14469
Thanks for getting back to me on this. I think I'll give it a miss for now as I have a pc I can use too (I just use this machine more often). I may revisit it however so it is good to know what direction I should look at.

Oh, and thanks for OpenOCD!
By wiml
#14501
Dominic wrote:looks like OSX lacks the strndup() function. FreeBSD has the same problem, and there's already a fix in gdb_server.c:34. If you know what preprocessor symbol may be used to identify an OSX build (like __FreeBSD__), just add it to the #ifdef statement, and send me a patch after you've built the OpenOCD on OSX.
Since you're using gnu configure, it should be easy to test for the existence of strndup() at configure time and define a macro or include a replacement implementation --- this is the kind of thing that autoconf is really good at. I could code up the changes to autoconf, and send you a patch, if you want.

If you don't want to, you can probably use the __APPLE__ symbol which is #defined on OSX.