Building libbdf for multilink

90% of problems people have in trying to build multilink are problems not with multilink, but with the bfd library. Hopefully these notes will get you through that.

Tip #1. Multilink runs on your host machine (your build) machine. If you hack Palm application on Linux, then multilink is a Linux program, if you hack on Solaris, multilink is a Solaris program. Let's call the host OS HOST_OS for ease of discussion. BUT, with multilink you are building PalmOS applications. This means the objects and libraries being manipulated are PalmOS objects and libraries, most likely built with m68k-palmos-gcc (newer 2.X prc-tools) or m68k-palmos-coff-gcc (older 0.5 tools). Put these two facts together, and you find the libbfd.a you need to build multilink is a HOST_OS library (built with the HOST_OS compiler) that is made to manipulate PalmOS objects.

If you built prc-tools yourself, then you probably have the correct libbfd.a & bfd.h files already. They can be found in the binutils tree: binutils/bfd/libbfd.a & binutils/bfd/bfd.h.

If you have installed prc-tools, you may still be in luck. Depending on the install package that you are using, the packager may have included the bfd library for PalmOS. It might be called libm68k-palmos-bfd.a or something like that. It may just be in a Palm-ish sounding directory, like /usr/local/palmdev/lib/libbfd.a or /usr/local/pilot/lib/libbfd.a. The important thing is NOT to use the regular bfd library for your HOST_OS system. /usr/lib/libbfd.a is probably not what you want. If you use that version, you will build multilink just fine, but when you try to use it, multilink will complain all your object files are 'not an object or archive file', then you will write to me and tell me I'm a loser and things will get ugly real quick.

Oh and be careful you have the right bfd.h! The header file and library must match. Linux includes a bfd.h in the standard system header search path, but it's almost certainly the wrong one. Check your -L and -I arguments when building multilink. Make sure you have the correct bfd.h. You may need to change #include <bfd.h> to #include "bfd.h". Isn't this fun?

If all else fails: use the force, build the bfd library yourself. Most of the information you need is covered in the Palm instructions for building the complete prc-tools tool chain, here: To make things a little simpler (and quicker), here's the short set of commands you need to run:

tar xfz binutils-2.9.1.tar.gz
tar xfz prc-tools-2.0.tar.gz
cat prc-tools-2.0/binutils-2.9.1.palmos.diff | patch -p0
cd prc-tools-2.0
ln -s ../binutils-2.9.1 binutils
cd ..
mkdir build
cd build
# abbreviated from Palm notes
../prc-tools-2.0/configure --target=m68k-palmos
cd binutils
gmake all info
cd ../..

Note the specific versions of binutils and prc-tools used above. You can use newer versions, but they must match. The binutils patches in the prc-tools tree must match with the binutils you are using.

Anyway, if you do the above you will end up with the two essential files, libbfd.a and bfd.h. Here:

Use these bfd files in building multilink. If you install the above to files in /usr/local/pilot/lib and /usr/local/pilot/include respectively, you will not need to change the multilink source code at all. If you have the files somewhere else, you will need to hack the multilink Makefile accordingly (check the setting of the LIBS variable around line 47).

To make things real easy, here's a shell script you can run after you have downloaded the binutils.tar.gz and prc-tools.tar.gz files: But that's not all. If that's not enough, here's a version of binutils and prc-tools that match and will allow you to build libbfd.a for PalmOS. All together:

Hey, if you use the mkbfd script, you will end up with a tar file with the bfd library and header files for your system: lib-something.tgz. Send it to me, and I'll post it on this site for the next person.

© 2001-2002 David Williams <>