Hi,
there's quite a few failures in the mass build with ld errors, looking something like this:

/usr/bin/ld: error: ctl.o:1:3: invalid character
/usr/bin/ld: error: ctl.o:1:3: syntax error, unexpected $end
/usr/bin/ld: error: ctl.o: not an object or archive

The problem here is that the *.o files are LTO files rather than normal object code, but the linker is invoked without LTO support.

This is usually caused by one of three things:

1) Broken Makefile
Typically a developer thinking that it's not necessary to pass optimization flags while linking, hardcoding something like

xyz: $(OBJECTS)
    $(CC) -o xyz $(OBJECTS)

The fix for this is to make sure compiler flags get passed even while linking, e.g.

xyz: $(OBJECTS)
    $(CC) $(CFLAGS) -o xyz $(OBJECTS)

2) Use of ./configure instead of %configure etc.
The %configure macro takes care of passing LDFLAGS and friends correctly -- they aren't set if ./configure is used manually or the likes.

3) Libtool breakage
Libtool is essentially a set of convoluted wrappers around compilers that tends to strip compiler flags off when linking even if they're passed correctly. This is fixed in the current version of libtool, but some stuff bundles old versions of libtool and forces their use.

Usually the best fix is to make sure the current (system) version of libtool is used, usually by calling libtoolize --force and regenerating autoconf scripts. Typically

libtoolize --force
automake -a
autoconf

fixes this (We already do this in the %configure macro, but only if we can detect libtool usage, which requires following standards in naming files and using LT_INIT etc.)

If something hardcodes behavior of ancient libtool etc. and can't be updated to use current libtool with reasonable effort, the bundled libtool must be fixed to pass relevant compiler flags to the linker instead of dropping them during linkage.

Even old versions of libtool typically know a set of flags that need to be passed to the linker unmodified (but the relevant ones aren't passed). Flags that were passed to the linker from the start unmodified include -64, -mips[0-9], -xarch=* -- so look for the case statement that catches them (usually
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*
9
and add the relevant flags there, e.g.
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-f*|-O*

This should fix pretty much all the linker related errors.

ttyl
bero
_______________________________________________
OM-Cooker mailing list
[email protected]
http://ml.openmandriva.org/listinfo.cgi/om-cooker-openmandriva.org

Reply via email to