tech-pkg archive

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

Re: Cross-compilation problems



Hello,

And thank you for the work.

I will only reply to some chunks:

On Tue, Jul 09, 2019 at 03:57:04PM +0000, Taylor R Campbell wrote:
> > Date: Mon, 8 Jul 2019 09:11:23 +0200
> > From: tlaronde%polynum.com@localhost
> >[...] 
> > USE_CROSS_COMPILE?= no
> 
> That probably won't work.  The comment I left says:
> 
>    # XXX This currently can't be set to `yes' on the command line,
>    # which is a bug.
>    USE_CROSS_COMPILE?=  yes
> 
> I don't remember exactly why passing USE_CROSS_COMPILE=yes on the
> command line doesn't work.  But if I wrote that comment, there was
> probably a reason that needs to be diagnosed.  If you change this
> without fixing the underlying bug, you'll probably get inscrutable
> errors later on.

It does work. At least for me. FWIW, if this has some effect, I put
the definition of USE_CROSS_COMPILE first in mk.conf, and then the
conditional chunk last, overriding my default settings for
cross-compilation.

> 
> > #========== XCOMPBEGIN
> > # (From Taylor R. Campbell Cross-compilation in pkgsrc (user's guide).)
> > 
> > .if ${USE_CROSS_COMPILE:M[yY][eE][sS]}
> 
> This is still wrong.  You need copy & paste _exactly_ what the
> documentation said:
> 
>    .if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
> 
> Otherwise you will get inscrutable errors later on.

This form of conditional was given by Roland Illig (since BSD make
doesn't intercept my blunder).

You can test it with a simple Makefile:

$ cat <<"EOT" >/tmp/make.test
.if ${USE_CROSS_COMPILE:M[yY][eE][sS]}
all:  
    @echo cross-compiling
.else 
all:  
	@echo not cross-compiling
.endif
EOT

$ make -f /tmp/make.test
make: "/tmp/Makefile" line 1: Malformed conditional
(${USE_CROSS_COMPILE:M[yY][eE][sS]})
make: Fatal errors encountered -- cannot continue
make: stopped in /tmp

$ make -f /tmp/make.test USE_CROSS_COMPILE=
not cross-compiling

$ make -f /tmp/make.text USE_CROSS_COMPILE=yEs
cross-compiling

and I think that the error you were having is that it is an error if
the variable is not set. Hence one has to set it---with something; since
it tests ignoring case for yes, the clearer not yes is "no" ;-)

Best,
-- 
        Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
                     http://www.kergis.com/
                       http://www.sbfa.fr/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


Home | Main Index | Thread Index | Old Index