
On Thu, Apr 03, 2008 at 08:26:23PM +0200, Wolfgang Denk wrote:
In message 47F506DB.6010506@semihalf.com you wrote:
I think this makes sense for code that we for example link from host's standard libraries. But for code compiled from files from the U-Boot tree (like lib_generic/md5.c), we shouldn't include host's header files.
But you, you should. Note that we are talking about host tools here, i. e. stuff that is supposed to run in the host environment. Assume your're building for a big-endian, 32 bit Power system. Assume your host is a little-endian x86_64 system.
Even simple tungs like a printf() require that you include the correct host header files as you will link your host application against the host libraries, too.
That's because printf() is from the host's libraries. lib_generic/md5.c is not a host-provided library, so you don't want to use a host-provided header.
- Use relative file names (as suggested by Kumar) or similar methods to make sure we pick up the md5.h header file from a local directory instead from /usr/include.
- Rename md5.h to make sure we use a pick up our own file instead of some unrelated file which happens to have the same name.
- seems to be more robust, though -- 3) works until someone installs a
2 is not robust. It fails easily as soon as you move or rename files, as son as you miss to create one of trhe needed directories when building out of tree, etc.
It is much more important to be robust against random crap in /usr/include (something u-boot can't control) than changes in the u-boot tree itself.
-Scott