Cross-compilers _without_ copying all of include & lib
Paul Smith
pausmith@nortelnetworks.com
Fri Nov 14 13:36:00 GMT 2003
%% "Kai Ruottu" <karuottu@mbnet.fi> writes:
kr> Ok, you maybe didn't mean just the symlinking but what on earth is
kr> so hard in it?
It requires a significant amount of trial and error to figure out what
parts you need to link. I ended up rebuilding the cross-compiler about
9 times and finally came up with this makefile rule that populates a
"fake" sys-include and lib, then removes the extra stuff at the end. It
turns out that the gcc build _DOES_ install some compiler-specific
things, like linker scripts, into the lib directory:
$(extract_image):
mkdir -p $(TARGINC) $(TARGLIB)
ln -f -s $(IMAGEHDR)/* $(TARGINC)
echo $(IMAGEHDR) > $(TARGINC)/COPIED
ln -f -s $(IMAGELIB)/* $(TARGLIB)
ln -f -s $(IMAGEUSRLIB)/*.o $(IMAGEUSRLIB)/*.so $(IMAGEUSRLIB)/lib*nonshared* $(TARGLIB)
echo $(IMAGELIB) > $(TARGLIB)/COPIED
echo $(IMAGEHDR)/* | sed 's:$(IMAGEHDR):$(TARGINC):g' > $@
echo $(IMAGELIB)/* | sed 's:$(IMAGELIB):$(TARGLIB):g' >> $@
echo $(IMAGEUSRLIB)/*.o $(IMAGEUSRLIB)/*.so $(IMAGEUSRLIB)/lib*nonshared* | sed 's:$(IMAGEUSRLIB):$(TARGLIB):g' >> $@
# Clean up the crap we had to install
$(postinst_image):
rm -f `cat $(extract_image)`
Where TARGINC is the target sys-include, TARGLIB is the target lib,
and IMAGEHDR, IMAGELIB, and IMAGEUSRLIB are the include, lib, and
usr/lib directories in the root fs image, respectively.
kr> Just never use the '--with-headers=' and '--with-libs' again!
So, how does one tell the cross-compiler build where to find the target
headers and libraries, without using those flags?
kr> The '$prefix/$target/include' is AFAIK the de-facto standard place
kr> for the target headers.
I don't want that either. I don't want any part of the target system
_AT ALL_ installed into $prefix: not the target headers and not the
target libraries.
I will have a _SEPARATE_ directory structure that contains, as I said, a
complete filesystem image of the entire target system. This will be
available to me both when I build the cross-compiler _AND_ when I'm
compiling my code using that cross-compiler. Why should I have all that
content copied into two places? That's just a huge headache in a
maintenance sense, not to mention a waste of resources.
kr> By opinion is that the extra libraries, libiberty, libstdc++,
kr> libffi,... whatever there are, belong to the specific
kr> target/GCC-version, not only to the specific target!
So, use the --enable-version-specific-runtime-libs flag when you
configure GCC. Where's the problem with that?
kr> So putting them into the '$prefix/$target/lib' and maybe
kr> overwriting the previous GCC install stuff there, is seriously
kr> wrong.
That's not where they get put anyway: they go under $prefix/lib
somewhere not $prefix/$target/lib.
--
-------------------------------------------------------------------------------
Paul D. Smith <psmith@nortelnetworks.com> HASMAT--HA Software Mthds & Tools
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
These are my opinions---Nortel Networks takes no responsibility for them.
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list