jkool702 / openwrt-custom-builds

Custom firmware images (compiled locally from source) for OpenWrt
MIT License
11 stars 1 forks source link

How to reproduce this build ? #3

Open kajoj2 opened 11 months ago

kajoj2 commented 11 months ago

I'm trying to make my own build.

I fallowed instruction in OpenWrt site. I'm on Ubuntu 22.04.3 Installed build dependency from wiki. Pulled repo and copy files and .config to main OpenWrt directory. I'm using main branch. Run make and I are getting error when build

Do I miss some host OS build dependency ? I installed rust.

error log is here:

In function '_cpuid',
    inlined from '_sodium_runtime_intel_cpu_features' at sodium/runtime.c:122:5,
    inlined from '_sodium_runtime_get_cpu_features' at sodium/runtime.c:239:12,
    inlined from 'sodium_init' at sodium/core.c:39:5:
sodium/runtime.c:104:5: error: impossible constraint in 'asm'
  104 |     __asm__ __volatile__("cpuid"
      |     ^
In function '_cpuid',
    inlined from '_sodium_runtime_intel_cpu_features' at sodium/runtime.c:126:5,
    inlined from '_sodium_runtime_get_cpu_features' at sodium/runtime.c:239:12,
    inlined from 'sodium_init' at sodium/core.c:39:5:
sodium/runtime.c:104:5: error: impossible constraint in 'asm'
  104 |     __asm__ __volatile__("cpuid"
      |     ^
make[8]: *** [/home/karol/Desktop/openwrt/tmp/cc67VZqV.mk:8: /home/karol/Desktop/openwrt/tmp/ccZTEfin.ltrans2.ltrans.o] Error 1
make[8]: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
mold: fatal: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[7]: *** [Makefile:1897: libsodium.la] Error 1
make[7]: Leaving directory '/home/karol/Desktop/openwrt/build_dir/target-aarch64_cortex-a53_musl/libsodium-1.0.18/src/libsodium'
make[6]: *** [Makefile:3113: all-recursive] Error 1
make[6]: Leaving directory '/home/karol/Desktop/openwrt/build_dir/target-aarch64_cortex-a53_musl/libsodium-1.0.18/src/libsodium'
make[5]: *** [Makefile:402: all-recursive] Error 1
make[5]: Leaving directory '/home/karol/Desktop/openwrt/build_dir/target-aarch64_cortex-a53_musl/libsodium-1.0.18/src'
make[4]: *** [Makefile:518: all-recursive] Error 1
make[4]: Leaving directory '/home/karol/Desktop/openwrt/build_dir/target-aarch64_cortex-a53_musl/libsodium-1.0.18'
make[3]: *** [Makefile:77: /home/karol/Desktop/openwrt/build_dir/target-aarch64_cortex-a53_musl/libsodium-1.0.18/.built] Error 2
make[3]: Leaving directory '/home/karol/Desktop/openwrt/feeds/packages/libs/libsodium'
time: package/feeds/packages/libsodium/compile#4.26#0.32#2.11
    ERROR: package/feeds/packages/libsodium failed to build.
make[2]: *** [package/Makefile:128: package/feeds/packages/libsodium/compile] Error 1
make[2]: Leaving directory '/home/karol/Desktop/openwrt'
make[1]: *** [package/Makefile:122: /home/karol/Desktop/openwrt/staging_dir/target-aarch64_cortex-a53_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/karol/Desktop/openwrt'
make: *** [/home/karol/Desktop/openwrt/include/toplevel.mk:232: world] Error 2
kajoj2 commented 11 months ago

I think I found cause https://github.com/openwrt/packages/issues/22171

jkool702 commented 11 months ago

To get libsodium to compile I cloned its github repo and used that. To do this, you need to

  1. select the "enable source package override" option in the developer options part of make menuconfig

  2. clone the libsoidium repo somewhere outsiude of the openwrt build root. e.g.

    cd /tmp git clone https://github.com/jedisct1/libsodium.git cd $OLDPWD

  3. link its git into the package. From the openwrt buildroot, run

    ln -s /tmp/libsodium/.git package/feeds/packages/libsodium/git-src

  4. Clean the old failed build and rebuild it off the cloned github repo

    make -j$(nproc) V=sc package/feeds/packages/libsodium/{clean,compile}

And it should compile (it did for me at least)