Subject: [alpine-devel] How to cross build APK?

From: Magicloud Magiclouds <[email-masked]>
Date: Wed, 20 Feb 2019 23:33:55 +0800

Hi,

I am trying to make an APK to address a requirement on RPI3. But my
working machine is X86_64. `abuild -r` only generates x86_64 package
and APKINDEX.

I tried to set `CTARGET` and `CHOST` to aarch64, then ran `abuild -r`. I got:

```
>>> my_apk: Analyzing dependencies...
ERROR: unsatisfiable constraints:
  build-base-aarch64 (missing):
    required by: .makedepends-my_apk-0[build-base-aarch64]
>>> ERROR: headless: builddeps failed
```

On pkgs.alpinelinux.org, I see only build-base package for each arch.
No such exact name.

What should I do? Since the content of the package is just shell
script, I do not even need gcc or so.

Thanks.
--
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Drew DeVault <[email-masked]>
Date: Wed, 20 Feb 2019 10:36:21 -0500

Have a read through scripts/bootstrap.sh, which can set up a
cross-compiler and sysroot for another arch to build APKs with.

---

---

From: Magicloud Magiclouds <[email-masked]>
Date: Thu, 21 Feb 2019 17:14:31 +0800

Hi,

So I got bootstrap.sh worked, it built some tools like
`build-base-aarch64-0.5-r1.apk`. And continued building some other
tools.

Then I modified the script, replaced the last part of building a bunch
of packages, with `CHOST=$TARGET_ARCH BOOTSTRAP=bootimage
APKBUILD="$(apkbuildname "${2}")" abuild -vr`. And found that it
cannot build non-main repos.

```
abuild-apk add --quiet --simulate --wait 30 --repository
/home/me/packages//community --virtual .makedepends-my_pkg
build-base-aarch64
ERROR: unsatisfiable constraints:
  build-base-aarch64 (missing):
    required by: .makedepends-my_pkg-0[build-base-aarch64]
```

If I put my_pkg in community repos in aports, I got above error. I
think the failure is because of build-base-aarch64 is in main, but
abuild-apk did not use it.

-- 
竹密岂妨流水过
山高哪阻野云飞

---

---

From: Tuan Hoang <[email-masked]>
Date: Mon, 25 Feb 2019 15:56:31 +0100

It's been a while since I used bootstrap.sh so I might be wrong.

> cannot build non-main repos.

It could. See 'for PKG' loop at line 98.

> abuild-apk did not use it.

You are installing a package from main (build-base) while specifying the community repo with --repository flag.

Cheers,

---

---

From: Magicloud Magiclouds <[email-masked]>
Date: Tue, 26 Feb 2019 13:38:40 +0800

Hi,

I see. Forgot the "community/PKGNAME" usage. Thanks.

-- 
竹密岂妨流水过
山高哪阻野云飞

---