problems with latest toolchain / psplibraries builds

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

MagerValp
Posts: 10
Joined: Fri Jul 20, 2007 12:12 am
Contact:

Post by MagerValp »

Insert_witty_name wrote:I have no idea what actually broke, but it was broken by the changes introduced in revision 2392.

I didn't fix it as such, but reverted the toolchain.sh and binutils patch back to what they were in revision 2391.

Just for clarification Oopo, all I have to do to get the toolchain to compile on OSX is to change the last line of 001-binutils-2.16.1.sh from:

Code: Select all

 make clean && make -j 2 && make install && make clean || { exit 1; }
to

Code: Select all

 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.

psplink doesn't compile:

Code: Select all

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.
Insert_witty_name
Posts: 376
Joined: Wed May 10, 2006 11:31 pm

Post by Insert_witty_name »

I had to reinstall readline from source when I was setting up this box (Tiger).

I had the same problems you did.
MagerValp
Posts: 10
Joined: Fri Jul 20, 2007 12:12 am
Contact:

Post by MagerValp »

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 :)
Insert_witty_name
Posts: 376
Joined: Wed May 10, 2006 11:31 pm

Post by Insert_witty_name »

If I recall correctly, and it was a long time ago, but when I installed readline I passed a path to configure.

I think it was:

Code: Select all

./configure --prefix=/usr
It's not really a toolchain problem, but the fact that OSX doesn't come with GNU readline.
MagerValp
Posts: 10
Joined: Fri Jul 20, 2007 12:12 am
Contact:

Post by MagerValp »

Insert_witty_name wrote:If I recall correctly, and it was a long time ago, but when I installed readline I passed a path to configure.

I think it was:

Code: Select all

./configure --prefix=/usr
I'm not brave enough to overwrite Apple's readline :)
It's not really a toolchain problem, but the fact that OSX doesn't come with GNU readline.
Agreed, but the end result is the same - toolchain doesn't build out of the box on OSX.

I'll see if I can find some time to port psplink to BSD readline, and submit a patch.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

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.
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

Isn't this the kind of stuff autoconf and automake are supposed to deal with anyway?
MagerValp
Posts: 10
Joined: Fri Jul 20, 2007 12:12 am
Contact:

Post by MagerValp »

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:

rl_filename_completion_function
emacs_standard_keymap
rl_completion_matches
rl_forced_update_display

I don't understand why emacs_standard_keymap is requested, as RL_READLINE_VERSION is set to 0x0402 in the Apple header.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

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 ;)
MagerValp
Posts: 10
Joined: Fri Jul 20, 2007 12:12 am
Contact:

Post by MagerValp »

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.
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

In the meantime, I've committed the 'make -r' and heap size changes.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Cool. I haven't noticed any issues so far, and I have both those changes made.
Post Reply