tech-pkg archive

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

Re: cross/cross-libtool-base dependency fails when cross-compiling



> On Sep 21, 2023, at 10:48 AM, Taylor R Campbell <campbell+netbsd-tech-pkg%mumble.net@localhost> wrote:
> 
> (Apologies for delay, have been busy at EuroBSDcon!)

No worries.  Thanks for getting back to this (and for your help at EuroBSDcon).

>> Date: Thu, 14 Sep 2023 13:30:13 -0600
>> From: Brook Milligan <brook%nmsu.edu@localhost>
>> 
>> I am trying to cross-compile the databases/sqlite3 package, which depends on cross/cross-libtool-base.  Trying to build the cross-libtool-base dependency fails with the following:
>> 
>> checking for armv7--netbsdelf-eabihf-gcc... armv7--netbsdelf-eabihf-gcc
>> checking whether the C compiler works... no
>> configure: error: in `/pkgsrc/pkgsrc-2023Q2/cross/cross-libtool-base/work/libtool-2.4.7':
>> configure: error: C compiler cannot create executables
>> See `config.log' for more details
>> 
>> The cross-libtool-base config.log file (attached) indicates that the compiler in use (armv7--netbsdelf-eabihf-gcc) does not recognized the -m64 option, so the test fails.
>> 
>> The -m64 option originates in mk/compiler/gcc.mk.  The patch below removes it from the command line and cross-libtool-base builds fine (as does sqlite3).
> 
> Can you share your mk.conf?

See attached.  I have tried a variety of versions, but this is the most stripped down one.  The cross stuff is mostly verbatim from your document, the first stanza is from the bootstrap, and the last just points to locally shared directories.  This should not be unusual.

> I suspect the issue is that you're setting ABI=64 unconditionally in
> your mk.conf, and that is bleeding into the cross-build settings.

No, ABI is fine; see the file.

> With the patches I'm sitting on (to be committed soon after 2023Q3 is
> branched, or at least posted here for preliminary review if they're
> not quite ready yet), it'll be easier to separate parameters like that
> in native/cross packages.  But for now, if you have any ABI setting in
> mk.conf, you'll need to make it conditional on ${USE_CROSS_COMPILE:tl}
> == "yes"/"no".

See above.  I think that is fine.

For me, it is pretty clear that the issue is with the definition of _COMPILER_ABI_FLAG.${ABI}.  Configuring cross-libtool-base for earmv7hf leads to compiler failures because the compiler does not accept -m64, which is the default value of _COMPILER_ABI_FLAG.64.  I’m guessing that most earm* builds do not set ABI explicitly, in which case I think _COMPILER_ABI_FLAG.${ABI} goes unused and the values do not matter.  This is a case, however, where it does get set and fails.

In any case, the following patch fixes the issue.

cvs diff: Diffing .
Index: gcc.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/compiler/gcc.mk,v
retrieving revision 1.262
diff -u -r1.262 gcc.mk
--- gcc.mk      26 Aug 2023 09:49:55 -0000      1.262
+++ gcc.mk      21 Sep 2023 18:10:43 -0000
@@ -950,7 +950,7 @@
 _COMPILER_ABI_FLAG.n32=        -mabi=n32
 _COMPILER_ABI_FLAG.o32=        -mabi=32
 _COMPILER_ABI_FLAG.64= -mabi=64
-.elif !empty(MACHINE_ARCH:Maarch64*)
+.elif !empty(MACHINE_ARCH:Maarch64*) || !empty(MACHINE_ARCH:Mearm*)
 _COMPILER_ABI_FLAG.32= -m32
 _COMPILER_ABI_FLAG.64= # empty
 .else

Cheers,
Brook

Attachment: mk.conf
Description: Binary data






Home | Main Index | Thread Index | Old Index