make clean && make -r -j 2 && make install && make clean || { exit 1; }
Maybe an update with a check using uname = Darwin?
The toolchain doesn't build on OSX for me with those changes. I still get .dSYM stuff when compiling binutils, but -r takes care of the .m files. Setting CFLAGS in the binutils script fixes it.
make -C pspsh all
g++ -Wall -g -D_PCTERM -I../psplink -c -o pspsh.o pspsh.C
pspsh.C: In function 'int strlen_cmd(int, char**)':
pspsh.C:439: warning: format '%d' expects type 'int', but argument 4 has type 'size_t'
g++ -Wall -g -D_PCTERM -I../psplink -c -o parse_args.o parse_args.C
g++ -Wall -g -D_PCTERM -I../psplink -c -o pspkerror.o pspkerror.C
g++ -Wall -g -D_PCTERM -I../psplink -c -o asm.o asm.C
g++ -Wall -g -D_PCTERM -I../psplink -c -o disasm.o disasm.C
g++ -o pspsh pspsh.o parse_args.o pspkerror.o asm.o disasm.o -lreadline -lcurses
Undefined symbols:
"_rl_filename_completion_function", referenced from:
_rl_filename_completion_function$non_lazy_ptr in pspsh.o
"_emacs_standard_keymap", referenced from:
_emacs_standard_keymap$non_lazy_ptr in pspsh.o
"_rl_completion_matches", referenced from:
shell_completion(char const*, int, int)in pspsh.o
shell_completion(char const*, int, int)in pspsh.o
shell_completion(char const*, int, int)in pspsh.o
shell_completion(char const*, int, int)in pspsh.o
shell_completion(char const*, int, int)in pspsh.o
"_rl_forced_update_display", referenced from:
completion_display(char**, int, int)in pspsh.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[1]: *** [pspsh] Error 1
make: *** [all] Error 2
../scripts/009-psplinkusb.sh: Failed.
The warning on line 439 can be fixed by printing %ld and casting to long.
readline fails as gcc finds /usr/lib/libreadline.dylib before /usr/local/lib where GNU readline is installed. What's the best way to make that happen? Right now I'm setting CFLAGS and LDFLAGS and rebuilding manually.
Right, I have readline installed from source in /usr/local, but a plain toolchain.sh build still finds Apple's version in /usr/lib first. I know how to work around it manually of course, but the idea here is for toolchain.sh to build automagically :)
You can only blame apple for this, quite why the GNU include gets picked up (and this doesn't fail at compile time) and then it uses the BSD library first is just dumb.
OSX ships with libedit, which is a BSD licensed clone of readline. libedit used to come with a readline compatible API, but it appears to be incomplete. To make psplink build cleanly on OSX out of the box, you have to either
make readline optional via autoconf,
port the code to support libedit with a few #defines,
require GNU readline in /usr/local and adjust the Makefile accordingly,
build against psptoolchain/build/gdb-6.4/readline and adjust the Makefile accordingly
Most of what psplink needs is available in libedit, but notably the filename completion isn't. The four symbols that don't resolve are:
Tbh I am not even sure usbhostfs_pc works on OSX without getting a "fixed" libusb anyway, so it probably isn't even worth building on OSX as part of the toolchain. Solve all the problems ;)
Ah, that's true. An uname check for Darwin and a message telling the user to install manually seems like a reasonable compromise until the libedit and libusb problems are sorted.