[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: RFH for cross-building saclib



On 2022-07-06 15:53 +0530, Nilesh Patra wrote:
> On 7/6/22 3:24 PM, IOhannes m zmölnig (Debian GNU|Linux) wrote:
> > 
> > On 7/6/22 11:36, Nilesh Patra wrote:
> > > 
> > > I took a look again after sometime, it seems to happen because libtool tries to compile
> > > with 'gcc' and not the host compiler during link time.
> > > 
> > > | libtool: link: gcc -shared  -fPIC -DPIC  .libs/AADV.o .libs/ABS.o .libs/ACLOCK.o
> > > | .libs/ADDTO.o .libs/ADV.o .libs/ADV2.o .libs/ADV3.o .......
> > > 
> > > Is there a way to change this to the host compiler instead?

Yes, but finding it may take some time :-)

> It compiles with host complier, but during mode=link it uses gcc (as in from build target) instead.
> More precisely, it uses the right compiler while linking the static lib; but it changes to gcc while doing a shared linking.
> 
> From the logs:
> | libtool --mode=link --tag=CC aarch64-linux-gnu-gcc -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-z,relro -Wl,-z,now -o libsaclib.la AADV.lo ABS.lo ACLOCK.lo [.. huge list ..]
> | libtool: link: gcc -shared  -fPIC -DPIC  .libs/AADV.o .libs/ABS.o[.. huge list ..]
>                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Is there a way to change that?

Hmm. This is quite odd. Not sure why libtool would think that the dynamic link should be done natively, but then libtool is a law unto itself.
On modern linux is much easier to just define a working link line than it is to persuade libtool to DTRT in it's very complicated way :-)

that --tag=CC is telling libtool to use the C variables (like $CC $LD etc.)

If your CC isn't set to aarch64-linux-gnu-gcc then it'll do the wrong
thing. But it's working for the rest of the script, so I'm not sure if
this is what's actually going wrong.

I note that /usr/share/dpkg/buildtools.mk says 
# The variables are not exported by default. This can be changed by
# defining DPKG_EXPORT_BUILDTOOLS.

So you might find that defining that before loading /usr/share/dpkg/buildtools.mk will help.

Just an idea.


Wookey
-- 
Principal hats:  Debian, Wookware, ARM
http://wookware.org/

Attachment: signature.asc
Description: PGP signature


Reply to: