chGoodchild / TollGateNostrToolKit

0 stars 0 forks source link

Problem with libtool and gltollgate download #8

Closed chGoodchild closed 3 months ago

chGoodchild commented 3 months ago

These commands run fine: https://github.com/chGoodchild/TollGateNostrToolKit/blob/9b2501ad240afa50a7731751fa0c2df26c018822/build_custom_dependencies.sh#L33-L47

However, make -j$(nproc) V=s fails with the following output. Even after running make clean and make dirclean...

username@ubuntu-32gb-nbg1-1:~/TollGateNostrToolKit$ cat make_logs.md | tail
install -d -m0755 /home/username/openwrt/bin/packages/mips_24kc/custom
/home/username/openwrt/staging_dir/host/bin/fakeroot /home/username/openwrt/staging_dir/host/bin/bash /home/username/openwrt/scripts/ipkg-build -m "" /home/username/openwrt/build_dir/target-mips_24kc_musl/libwally-0.8.1/ipkg-mips_24kc/libwally /home/username/openwrt/bin/packages/mips_24kc/custom
Packaged contents of /home/username/openwrt/build_dir/target-mips_24kc_musl/libwally-0.8.1/ipkg-mips_24kc/libwally into /home/username/openwrt/bin/packages/mips_24kc/custom/libwally_0.8.1-1_mips_24kc.ipk
echo "libwally" >> /home/username/openwrt/staging_dir/target-mips_24kc_musl/pkginfo/libwally.default.install
make[3]: Leaving directory '/home/username/openwrt/feeds/custom/custom/libwally'
time: package/feeds/custom/libwally/compile#54.13#13.80#67.91
make[2]: Leaving directory '/home/username/openwrt'
make[1]: *** [package/Makefile:123: /home/username/openwrt/staging_dir/target-mips_24kc_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/username/openwrt'
make: *** [/home/username/openwrt/include/toplevel.mk:232: world] Error 2

grep -i -B 20 -A 5 "Error 2" make_logs.md indicates that there is a problem with libtool:

make[4]: Entering directory '/home/username/openwrt/build_dir/host/libtool-2.4.7'
There seems to be no Makefile in this directory.
You must run ./configure before running 'make'.
make[4]: *** [GNUmakefile:108: abort-due-to-no-makefile] Error 1
make[4]: Leaving directory '/home/username/openwrt/build_dir/host/libtool-2.4.7'
make[3]: [Makefile:67: /home/username/openwrt/build_dir/host/libtool-2.4.7/.prepared3adf67eacc21262a41dba1c60cd25d77_6664517399ebbbc92a37c5bb081b5c53] Error 2 (ignored)

However, libtool is present in the filesystem:

username@ubuntu-32gb-nbg1-1:~/TollGateNostrToolKit$ ls /home/username/openwrt/build_dir/host/libtool-2.4.7/
aclocal.m4      bootstrap.conf  ChangeLog~    config-h.in~   configure     doc           INSTALL   libtoolize     maint.mk~    NEWS            tests
AUTHORS         build-aux       config.guess  config.log     configure~    gnulib-tests  INSTALL~  libtoolize.in  Makefile     README          THANKS
autom4te.cache  cfg.mk          config.h      config.status  configure.ac  GNUmakefile   libltdl   m4             Makefile.am  README-release  TODO
bootstrap       ChangeLog       config-h.in   config.sub     COPYING       GNUmakefile~  libtool   maint.mk       Makefile.in  stamp-h1
username@ubuntu-32gb-nbg1-1:~/TollGateNostrToolKit$ ls /home/username/openwrt/build_dir/host/libtool-2.4.7/Makefile
/home/username/openwrt/build_dir/host/libtool-2.4.7/Makefile

Ran

cd /home/username/openwrt/build_dir/host/libtool-2.4.7/
./configure
make
chGoodchild commented 3 months ago

Uploaded logs here: https://github.com/chGoodchild/TollGateNostrToolKit/blob/nostr_client_relay/make_logs.md

chGoodchild commented 3 months ago

Now getting an error related to generate_npub's make file:

username@ubuntu-32gb-nbg1-1:~/openwrt$ grep -i "error" make_logs.md | grep -v -- "-Werror"
Applying ./patches/0002-PATCH-Fix-error-introduced-in-51471cafa5a4fa44d6fe49.patch using plaintext: 
make[3]: *** [Makefile:48: /home/username/openwrt/build_dir/target-mips_24kc_musl/gltollgate-1.0/.prepared_9db8e811c66177e0fdef7d90ddd53251_6664517399ebbbc92a37c5bb081b5c53] Error 1
    ERROR: package/feeds/custom/gltollgate failed to build.
make[2]: *** [package/Makefile:129: package/feeds/custom/gltollgate/compile] Error 1
   ERROR!
make[1]: *** [package/Makefile:123: /home/username/openwrt/staging_dir/target-mips_24kc_musl/stamp/.package_compile] Error 2
make: *** [/home/username/openwrt/include/toplevel.mk:232: world] Error 2
chGoodchild commented 3 months ago

It seems like gltollgate has download issues:

username@ubuntu-32gb-nbg1-1:~/openwrt$ make package/feeds/custom/gltollgate/clean
WARNING: Makefile 'package/feeds/custom/gltollgate/Makefile' has a dependency on 'libsecp256k1', which does not exist
WARNING: Makefile 'package/feeds/custom/gltollgate/Makefile' has a dependency on 'libwallycore', which does not exist
make[2]: Entering directory '/home/username/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/home/username/openwrt/scripts/config'
 make[1] package/feeds/custom/gltollgate/clean
 make[2] -C feeds/custom/custom/gltollgate clean
username@ubuntu-32gb-nbg1-1:~/openwrt$ make package/feeds/custom/gltollgate/compile V=sc
WARNING: Makefile 'package/feeds/custom/gltollgate/Makefile' has a dependency on 'libsecp256k1', which does not exist
WARNING: Makefile 'package/feeds/custom/gltollgate/Makefile' has a dependency on 'libwallycore', which does not exist
make[2]: Entering directory '/home/username/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/home/username/openwrt/scripts/config'
make[1]: Entering directory '/home/username/openwrt'
+ mkdir -p /home/username/openwrt/staging_dir/target-mips_24kc_musl
+ cd /home/username/openwrt/staging_dir/target-mips_24kc_musl
+ mkdir -p bin lib stamp usr/include usr/lib
mkdir -p /home/username/openwrt/build_dir/target-mips_24kc_musl/stamp
touch /home/username/openwrt/staging_dir/target-mips_24kc_musl/.prepared
make[2]: Entering directory '/home/username/openwrt/package/libs/toolchain'
echo "libc" >> /home/username/openwrt/staging_dir/target-mips_24kc_musl/pkginfo/toolchain.default.install
echo "libgcc" >> /home/username/openwrt/staging_dir/target-mips_24kc_musl/pkginfo/toolchain.default.install
echo "libatomic" >> /home/username/openwrt/staging_dir/target-mips_24kc_musl/pkginfo/toolchain.default.install
echo "libpthread" >> /home/username/openwrt/staging_dir/target-mips_24kc_musl/pkginfo/toolchain.default.install
make[2]: Leaving directory '/home/username/openwrt/package/libs/toolchain'
time: package/libs/toolchain/compile#0.11#0.21#0.28
make[2]: Entering directory '/home/username/openwrt/package/libs/openssl'
Package/openssl/add-module 1='provider'; 2='legacy'; 3='/usr/lib/ossl-modules' 4=''
MOD_TYPE='provider'; MOD_NAME='legacy'; MOD_DIR='/usr/lib/ossl-modules' OSSL_PKG='libopenssl-legacy'
Package/openssl/add-module 1='engine'; 2='afalg'; 3='/usr/lib/engines-3' 4=''
MOD_TYPE='engine'; MOD_NAME='afalg'; MOD_DIR='/usr/lib/engines-3' OSSL_PKG='libopenssl-afalg'
Package/openssl/add-module 1='engine'; 2='devcrypto'; 3='/usr/lib/engines-3' 4=''
MOD_TYPE='engine'; MOD_NAME='devcrypto'; MOD_DIR='/usr/lib/engines-3' OSSL_PKG='libopenssl-devcrypto'
Package/openssl/add-module 1='engine'; 2='padlock'; 3='/usr/lib/engines-3' 4=''
MOD_TYPE='engine'; MOD_NAME='padlock'; MOD_DIR='/usr/lib/engines-3' OSSL_PKG='libopenssl-padlock'
echo "libopenssl" >> /home/username/openwrt/staging_dir/target-mips_24kc_musl/pkginfo/openssl.default.install
make[2]: Leaving directory '/home/username/openwrt/package/libs/openssl'
time: package/libs/openssl/compile#0.21#0.22#0.36
make[2]: Entering directory '/home/username/openwrt/feeds/custom/custom/gltollgate'
mkdir -p /home/username/openwrt/dl
SHELL= flock /home/username/openwrt/tmp/.gltollgate-1.0.tar.xz.flock -c '    /home/username/openwrt/scripts/dl_github_archive.py --dl-dir="/home/username/openwrt/dl" --url="https://github.com/chGoodchild/GLTollGate.git" --version="42-generate-nsec-on-the-router" --subdir="gltollgate-1.0" --source="gltollgate-1.0.tar.xz" --hash="x" || (   echo "Checking out files from the git repository..."; mkdir -p /home/username/openwrt/tmp/dl && cd /home/username/openwrt/tmp/dl && rm -rf gltollgate-1.0 && [ \! -d gltollgate-1.0 ] && git clone  https://github.com/chGoodchild/GLTollGate.git gltollgate-1.0 && (cd gltollgate-1.0 && git checkout 42-generate-nsec-on-the-router && git submodule update --init --recursive) && echo "Packing checkout..." && export TAR_TIMESTAMP=`cd gltollgate-1.0 && git log -1 --format='\''@%ct'\''` && rm -rf gltollgate-1.0/.git &&    tar --numeric-owner --owner=0 --group=0 --mode=a-s --sort=name ${TAR_TIMESTAMP:+--mtime="$TAR_TIMESTAMP"} -c gltollgate-1.0 |   xz -zc -7e > /home/username/openwrt/tmp/dl/gltollgate-1.0.tar.xz && mv /home/username/openwrt/tmp/dl/gltollgate-1.0.tar.xz /home/username/openwrt/dl/ && rm -rf gltollgate-1.0; );     '
gltollgate-1.0.tar.xz: Download from https://github.com/chGoodchild/GLTollGate.git failed
gltollgate-1.0.tar.xz: Requires sha256sum for verification
Checking out files from the git repository...
Cloning into 'gltollgate-1.0'...
remote: Enumerating objects: 1559, done.
remote: Counting objects: 100% (483/483), done.
remote: Compressing objects: 100% (260/260), done.
remote: Total 1559 (delta 275), reused 363 (delta 222), pack-reused 1076 (from 1)
Receiving objects: 100% (1559/1559), 26.67 MiB | 12.84 MiB/s, done.
Resolving deltas: 100% (832/832), done.
branch '42-generate-nsec-on-the-router' set up to track 'origin/42-generate-nsec-on-the-router'.
Switched to a new branch '42-generate-nsec-on-the-router'
Packing checkout...
touch /home/username/openwrt/build_dir/target-mips_24kc_musl/gltollgate-1.0/.prepared_9db8e811c66177e0fdef7d90ddd53251_6664517399ebbbc92a37c5bb081b5c53_check
mkdir -p /home/username/openwrt/build_dir/target-mips_24kc_musl/gltollgate-1.0
cp -fpR /home/username/openwrt/../GLTollGate/nostr/c/* /home/username/openwrt/build_dir/target-mips_24kc_musl/gltollgate-1.0/
cp: cannot stat '/home/username/openwrt/../GLTollGate/nostr/c/*': No such file or directory
make[2]: *** [Makefile:48: /home/username/openwrt/build_dir/target-mips_24kc_musl/gltollgate-1.0/.prepared_9db8e811c66177e0fdef7d90ddd53251_6664517399ebbbc92a37c5bb081b5c53] Error 1
make[2]: Leaving directory '/home/username/openwrt/feeds/custom/custom/gltollgate'
time: package/feeds/custom/gltollgate/compile#0.81#0.65#3.22
    ERROR: package/feeds/custom/gltollgate failed to build.
make[1]: *** [package/Makefile:129: package/feeds/custom/gltollgate/compile] Error 1
make[1]: Leaving directory '/home/username/openwrt'
make: *** [/home/username/openwrt/include/toplevel.mk:232: package/feeds/custom/gltollgate/compile] Error 2

It seems like the download failed in the make file and $(CP) $(TOPDIR)/../GLTollGate/nostr/c/* $(PKG_BUILD_DIR)/ copies from the home folder as a hacky workaround.

chGoodchild commented 3 months ago

Test with

make package/feeds/custom/gltollgate/clean
make package/feeds/custom/gltollgate/compile V=sc
chGoodchild commented 3 months ago

Successfully updated the makefile using these instructions

Update feeds.conf:

username@ubuntu-32gb-nbg1-1:~/openwrt$ cat feeds.conf
src-git packages https://git.openwrt.org/feed/packages.git^063b2393cbc3e5aab9d2b40b2911cab1c3967c59
src-git luci https://git.openwrt.org/project/luci.git^b07cf9dcfc37e021e5619a41c847e63afbd5d34a
src-git routing https://git.openwrt.org/feed/routing.git^648753932d5a7deff7f2bdb33c000018a709ad84
src-git telephony https://git.openwrt.org/feed/telephony.git^86af194d03592121f5321474ec9918dd109d3057
src-git-full custom https://github.com/chGoodchild/secp256k1_openwrt_feed.git;main
username@ubuntu-32gb-nbg1-1:~/openwrt$ ./scripts/feeds update -a  # Update all feeds

Install feeds.conf:

username@ubuntu-32gb-nbg1-1:~/openwrt$ ./scripts/feeds install -a # Install all packages from all feeds
WARNING: Makefile 'package/feeds/custom/gltollgate/Makefile' has a dependency on 'libsecp256k1', which does not exist
WARNING: Makefile 'package/feeds/custom/gltollgate/Makefile' has a dependency on 'libwallycore', which does not exist
Installing all packages from feed packages.
Installing all packages from feed luci.
Installing all packages from feed routing.
Installing all packages from feed telephony.
Installing all packages from feed custom.
WARNING: Not overriding core package 'openssl'; use -f to force

Clean and compile:

username@ubuntu-32gb-nbg1-1:~/openwrt$ make package/feeds/custom/gltollgate/clean
WARNING: Makefile 'package/feeds/custom/gltollgate/Makefile' has a dependency on 'libsecp256k1', which does not exist
WARNING: Makefile 'package/feeds/custom/gltollgate/Makefile' has a dependency on 'libwallycore', which does not exist
make[2]: Entering directory '/home/username/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/home/username/openwrt/scripts/config'
time: target/linux/prereq#1.20#0.19#1.37
 make[1] package/feeds/custom/gltollgate/clean
 make[2] -C feeds/custom/custom/gltollgate clean
username@ubuntu-32gb-nbg1-1:~/openwrt$ make package/feeds/custom/gltollgate/compile V=s
WARNING: Makefile 'package/feeds/custom/gltollgate/Makefile' has a dependency on 'libsecp256k1', which does not exist
WARNING: Makefile 'package/feeds/custom/gltollgate/Makefile' has a dependency on 'libwallycore', which does not exist
make[2]: Entering directory '/home/username/openwrt/scripts/config'
make[2]: 'conf' is up to date.
chGoodchild commented 3 months ago

The nostri code is found now:

CFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -msoft-float -fmacro-prefix-map=/home/username/openwrt/build_dir/target-mips_24kc_musl/gltollgate-1.0=gltollgate-1.0 -mips16 -minterlink-mips16 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -I/home/username/openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/usr/include -I/home/username/openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/include/fortify -I/home/username/openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/include " CXXFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -msoft-float -fmacro-prefix-map=/home/username/openwrt/build_dir/target-mips_24kc_musl/gltollgate-1.0=gltollgate-1.0 -mips16 -minterlink-mips16 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -mips16 -minterlink-mips16  -I/home/username/openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/usr/include -I/home/username/openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/include/fortify -I/home/username/openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/include " LDFLAGS="-L/home/username/openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/usr/lib -L/home/username/openwrt/staging_dir/toolchain-mips_24kc_gcc-12.3.0_musl/lib -znow -zrelro " make -j1 -C /home/username/openwrt/build_dir/target-mips_24kc_musl/gltollgate-1.0/. AR="mips-openwrt-linux-musl-gcc-ar" AS="mips-openwrt-linux-musl-gcc -c -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -msoft-float -fmacro-prefix-map=/home/username/openwrt/build_dir/target-mips_24kc_musl/gltollgate-1.0=gltollgate-1.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" LD=mips-openwrt-linux-musl-ld NM="mips-openwrt-linux-musl-gcc-nm" CC="mips-openwrt-linux-musl-gcc" GCC="mips-openwrt-linux-musl-gcc" CXX="mips-openwrt-linux-musl-g++" RANLIB="mips-openwrt-linux-musl-gcc-ranlib" STRIP=mips-openwrt-linux-musl-strip OBJCOPY=mips-openwrt-linux-musl-objcopy OBJDUMP=mips-openwrt-linux-musl-objdump SIZE=mips-openwrt-linux-musl-size CROSS="mips-openwrt-linux-musl-" ARCH="mips" ;
make[3]: Entering directory '/home/username/openwrt/build_dir/target-mips_24kc_musl/gltollgate-1.0'
mips-openwrt-linux-musl-gcc -I/usr/local/ssl/include -I../../../nostr_client_relay/src/nostril -g -Wall -c -o generate_npub.o generate_npub.c  # Ensure this line begins with a tab
cc1: note: someone does not honour COPTS correctly, passed 0 times
In file included from generate_npub.c:7:
nostri.h:42:3: error: unknown type name 'uint64_t'
   42 |   uint64_t created_at;
      |   ^~~~~~~~
nostri.h:65:3: error: unknown type name 'uint64_t'
   65 |   uint64_t created_at;
      |   ^~~~~~~~
nostri.h:79:34: error: unknown type name 'uint64_t'
   79 |   int parse_num(const char* arg, uint64_t* t);
      |                                  ^~~~~~~~
nostri.h:7:1: note: 'uint64_t' is defined in header '<stdint.h>'; did you forget to '#include <stdint.h>'?
    6 | #include "secp256k1_schnorrsig.h"
  +++ |+#include <stdint.h>
    7 | 
make[3]: *** [Makefile:21: generate_npub.o] Error 1
make[3]: Leaving directory '/home/username/openwrt/build_dir/target-mips_24kc_musl/gltollgate-1.0'
make[2]: *** [Makefile:48: /home/username/openwrt/build_dir/target-mips_24kc_musl/gltollgate-1.0/.built] Error 2
make[2]: Leaving directory '/home/username/openwrt/feeds/custom/custom/gltollgate'
time: package/feeds/custom/gltollgate/compile#1.15#1.29#3.82
    ERROR: package/feeds/custom/gltollgate failed to build.
make[1]: *** [package/Makefile:129: package/feeds/custom/gltollgate/compile] Error 1
make[1]: Leaving directory '/home/username/openwrt'
make: *** [/home/username/openwrt/include/toplevel.mk:232: package/feeds/custom/gltollgate/compile] Error 2
username@ubuntu-32gb-nbg1-1:~/openwrt$ make package/feeds/custom/gltollgate/compile V=sc

Makefile version:

username@ubuntu-32gb-nbg1-1:~/openwrt$ cat package/feeds/custom/gltollgate/Makefile 
include $(TOPDIR)/rules.mk

PKG_NAME:=gltollgate
PKG_VERSION:=1.0
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/chGoodchild/GLTollGate.git
PKG_SOURCE_VERSION:=42-generate-nsec-on-the-router
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

include $(INCLUDE_DIR)/package.mk

define Package/gltollgate
    SECTION:=utils
    CATEGORY:=Utilities
    TITLE:=GLTollGate Utilities
    DEPENDS:=+libopenssl +libsecp256k1 +libwallycore
endef

define Package/gltollgate/description
    GLTollGate Utilities including generate_npub tool.
endef

define Build/Prepare
    mkdir -p $(PKG_BUILD_DIR)
    # Clean the build directory to ensure a fresh start
    rm -rf $(PKG_BUILD_DIR)
    mkdir -p $(PKG_BUILD_DIR)
    # Clone the repository
    git clone $(PKG_SOURCE_URL) $(PKG_BUILD_DIR) --branch $(PKG_SOURCE_VERSION) --single-branch
    # Ensuring submodules are updated in case they exist
    (cd $(PKG_BUILD_DIR); git submodule update --init --recursive)
    # Verify the correct subdirectory and copy from it
    [ -d "$(PKG_BUILD_DIR)/nostr/c" ] && $(CP) $(PKG_BUILD_DIR)/nostr/c/* $(PKG_BUILD_DIR)/ || (echo "The expected subdirectory does not exist." && exit 1)
endef

define Package/gltollgate/install
    $(INSTALL_DIR) $(1)/usr/bin
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/generate_npub $(1)/usr/bin/
endef

$(eval $(call BuildPackage,gltollgate))