But still Dont understand the problem, and I have used clean builds ,many times..
also my main Linux system is Arch Linux,
but had the same problem on 2 very different Virtual-box Ubuntu and Debian Systems...
In case the scene is still there, please check if staging_dir/host/bin/opkg is really there. Sometimes the "no such file or directory" error is for program interpreter, not the executable itself.
Try the following command and check the ld-linux-xx.so part
Your full script and also the condition before the script execution may matter here. That said, the opkg host clean & compile command was provided solely for trying to fix the previous issue, for once. No need to run them on every build
Here is my script that I had working 100% till just recently with that opkg error:
I make some mods and changes from time 2 time just to see if I can make it better..
work in progress.. I took the log from the buildbots for this wrt3200ACM Router build.
and kinda just followed it along with my script.. it seemed to have been working for a while now..
also note, when I just build the basic .config from snapshot for this device.. it builds without error:
but when I build my known working .configs, it now gives that opkg error..
gota me something im adding or something that was changed that is causing this now.
Here is my work in progress:
#!/bin/sh
#
# Copyright (C) 2006-2021
#
# Updated: 12/20/2020
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
########################################################################################
# exec 3>&1 1>>${LOG_FILE}
#
# echo -e "${blue} This is stdout"
# echo -e "${blue} This is stderr" 1>&2
# echo -e "${blue} This is the console (fd 3)" 1>&3
# echo -e "${blue} This is both the log and the console":${reset}" | tee /dev/fd/3
#######################################################################################
### ============================================= ###
# Ansi color code variables
red="\e[0;91m"
blue="\e[0;94m"
expand_bg="\e[K"
blue_bg="\e[0;104m${expand_bg}"
red_bg="\e[0;101m${expand_bg}"
green_bg="\e[0;102m${expand_bg}"
green="\e[0;92m"
white="\e[0;97m"
bold="\e[1m"
uline="\e[4m"
reset="\e[0m"
### ============================================= ###
SECONDS=0
CDBU=$(date +"%F_%H%M%S")
#BAK="../abu/$CDBU"
#cp .config "$BAK"
#cd openwrt
### -------------------------------------------------- ###
echo -e "${blue} ${blue} Setting up Logfile:${reset}"
#LOG_FILE=/tmp/openWRT.log
LOG_FILE="../build_$CDBU.log"
#exec > >(tee ${LOG_FILE}) 2>&1
#LOG_FILE="./logfile_$CDBU.log"
#exec 3>&1 1>>${LOG_FILE} 2>&1
### -------------------------------------------------- ###
### -------------------------------------------------------------- ###
export TOOLCHAIN=/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-8.4.0_musl_eabi/bin
export STAGINGDIR=/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/host/bin
export STAGING_DIR=/home/eliminater74/Builds/openwrt/BUILD/openwrt/staging_dir/toolchain-arm_cortex-a9+vfpv3-d16_gcc-8.4.0_musl_eabi
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
######################
#### ADDING PATHS #### Updated: 12/24/2020
######################
# Append "$1" to $PATH when not already in.
# This function API is accessible to scripts in /etc/profile.d
append_path () {
case ":$PATH:" in
*:"$1":*)
;;
*)
PATH="${PATH:+$PATH:}$1"
esac
}
### -------------------------------------------------------------- ###
# Append our default paths
append_path $TOOLCHAIN
append_path $STAGINGDIR
# append_path $
# append_path
# Force PATH to be environment
export PATH
echo -e "${green_bg} ${expand_bg} ${reset}"
echo -e "${green_bg} ${expand_bg} ${reset}"
echo -e "${blue} :${reset}"
echo -e "${green} You are about to build OpenWRT Firmware:${reset}"
echo -e "${blue} :${reset}"
echo -e "${red} :${reset}"
echo -e "${blue} :${reset}"
echo -e "${green} Getting Ready To Build OpenWRT Firmware:${reset}"
echo -e "${blue} :${reset}"
echo -e "${green} Updating Main Source. (git pull) ${reset}"
git pull
[ "$?" -ne 0 ] && echo -e "${red} Updating the main OpenWrt source code failed.${reset}" && exit 1
echo -e "${blue} gitcheckout Ensure that Git HEAD is sane:${reset}"
if [ -d .git ]; then git checkout -f master; git branch --set-upstream-to origin/master; else exit 0; fi
echo -e "${blue} gitfresh update:${reset}"
echo -e "${green} Please Wait, Might take a while:${reset}"
git clean -f -f -d -x
echo -e "${blue} fetchrefs Fetching Git remote refs:${reset}"
git fetch origin +refs/heads/master:refs/remotes/origin/master
echo -e "${blue} gitverify Ensure that Git HEAD is pointing to a branch or tag:${reset}"
git rev-parse --abbrev-ref HEAD | grep -vxqF HEAD || git show-ref --tags --dereference 2>/dev/null | sed -ne "/^$(git rev-parse HEAD) / { s|^.*/||; s|\^.*||; p }" | grep -qE "^v[0-9][0-9]\."
### ---------------[ Create Random Envirement ]--------------------------------------- ###
echo -e "${green} Create New Random Envirement:${reset}"
./scripts/env new linksys"$RANDOM"
### ---------------------------------------------------------------------------------- ###
echo -e "${blue} Clone Luci Theme argon to package:${reset}"
git clone git@github.com:jerrykuku/luci-theme-argon.git package/luci-theme-argon
echo -e "${blue} rmtmp Remove tmp folder:${reset}"
rm -rf tmp/
echo -e "${blue} rmbuild_dir Remove build_dir folder:${reset}"
rm -rf build_dir
echo -e "${blue} rmfeedlinks Remove feed symlinks:${reset}"
rm -rf package/feeds/
### ------------------------------------------------------------------------------------------------------------------------------ ###
echo -e "${blue} dlfeeds Downloading feeds.conf.default:${reset}"
#wget https://downloads.openwrt.org/snapshots/targets/mvebu/cortexa9/feeds.buildinfo -O feeds.conf.default
#wget https://gist.githubusercontent.com/Eliminater74/d7347ba9aad666ffd4c42a1a0ba49007/raw/5221406dbaa5ebd460e01740a1bd632b06016d01/feeds.conf.default -O feeds.conf.default
### ------------------------------------------------------------------------------------------------------------------------------ ###
echo -e "${blue} cpfeeds Copying feeds.conf.default:${reset}"
cp ../feeds.conf.default feeds.conf.default
echo -e "${blue} updatefeeds Updating feeds:${reset}"
./scripts/feeds update -a
[ "$?" -ne 0 ] && echo -e "${red} Updating the feeds failed.${reset}" && exit 1
echo -e "${blue} installfeeds Installing feeds:${reset}"
./scripts/feeds install -a
echo -e "${blue} Creating LOGS Directory:${reset}"
mkdir -p logs
# ======================================================================================================== #
#echo -e "${blue} dlconfigseed downloading Snapshot config.buildinfo to .config:${reset}"
#wget https://downloads.openwrt.org/snapshots/targets/mvebu/cortexa9/config.buildinfo -O .config
#echo -e "${blue} dlconfigseed downloading Stable config.buildinfo to .config:${reset}"
#wget https://downloads.openwrt.org/releases/19.07.4/targets/mvebu/cortexa9/config.buildinfo -O .config
#echo -e "${blue} dlconfigseed Downloading Davidc502's config.buildinfo to .config:${reset}"
#wget https://dc502wrt.org/releases/config.buildinfo -O .config
echo -e "${blue} configseed copy .config to current dir:${reset}"
cp ../.config .config
# ======================================================================================================== #
echo -e "${blue} newconfig Seeding .config:${reset}"
printf 'CONFIG_TARGET_mvebu=y\nCONFIG_TARGET_mvebu_cortexa9=y\nCONFIG_SIGNED_PACKAGES=y\n' >> .config
echo -e "${blue} newconfig Seeding extra .config:${reset}"
printf 'CONFIG_TARGET_mvebu_cortexa9_DEVICE_linksys_wrt3200acm=y\nCONFIG_CCACHE=y\nCONFIG_BUILD_LOG=y\n' >> .config
echo -e "${blue} delbin Removing output directory:${reset}"
rm -rf bin/
echo -e "${blue} Cleaning scripts/config:${reset}"
make scripts/config/ clean V=s
echo -e "${blue} defconfig Populating .config:${reset}"
make defconfig
echo -e "${blue} Checking architecture:${reset}"
grep -sq CONFIG_TARGET_mvebu=y .config
echo -e "${blue} property 'libc' set:${reset}"
sed -ne '/^CONFIG_LIBC=/ { s!^CONFIG_LIBC="\(.*\)"!\1!; s!^musl$!!; s!.\+!-&!p }' .config
echo -e "${blue} Preparing ./dl and linking it:${reset}"
# mkdir -p $PWD/dl && rm -rf ./dl && ln -sf $PWD/dl ./dl
rm -rf ./dl && mkdir -p ../dl && ln -sf ../dl ./dl
echo -e "${blue} menuconfig menuconfig .config, Please Wait:${reset}"
make menuconfig
echo -e "${blue} Building and installing GNU tar:${reset}"
make -j$(($(nproc)+1)) tools/tar/compile V=s
echo -e "${blue} Populating dl/:${reset}"
make -j$(($(nproc)+1)) download V=s
echo -e "${blue} Cleaning base-files:${reset}"
make package/base-files/clean V=s
echo -e "${blue} Cleaning luci:${reset}"
make package/luci/clean V=s
### -----------------------------------[CCACHE HOLD]---------------------------------- ###
echo -e "${blue} Setting ccache directory:${reset}"
export CCACHE_DIR=/home/eliminater74/Builds/openwrt/BUILD/openwrt/.ccache
echo -e "${blue} Fix Sloppiness of ccache:${reset}"
ccache --set-config=sloppiness=file_macro,locale,time_macros
### ---------------------------------------------------------------------------------- ###
echo -e "${blue} Building and installing tools:${reset}"
make -j$(($(nproc)+1)) tools/install V=s 2>&1 | tee logs/build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
echo -e "${blue} Building and installing toolchain:${reset}"
make -j$(($(nproc)+1)) toolchain/install V=s 2>&1 | tee logs/build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
echo -e "${blue} Building kmods:${reset}"
make -j$(($(nproc)+1)) target/compile 'IGNORE_ERRORS=n m' BUILD_LOG=1 V=s 2>&1 | tee logs/build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
echo -e "${blue} property 'kernelversion' set:${reset}"
make --no-print-directory -C target/linux/ val.LINUX_VERSION val.LINUX_RELEASE val.LINUX_VERMAGIC | xargs printf '%s-%s-%s\n'
echo -e "${blue} Cleaning up package build:${reset}"
make package/cleanup V=s
### --------------------------------------------------------------------------------------- ###
### ------------[ SYSTEM FILE NAME CHANGES WORKAROUND]------------------------------------- ###
echo -e "${red}Renaming Some system Files To Fix Some Packages: (Ugly Workaround)${reset}"
# sudo mv /usr/lib/libgcc_s.so.1 /usr/lib/libgcc_s.so.1.bak
# sudo mv /usr/lib/libpthread.so /usr/lib/libpthread.so.bak
# sudo mv /usr/lib/libpthread.a /usr/lib/libpthread.a.bak
# sudo mv /usr/lib/libc.a /usr/lib/libc.a.bak
# sudo mv /usr/lib/libpam.so /usr/lib/libpam.so.bak
# sudo mv /usr/lib/libiconv.so /usr/lib/libiconv.so.bak
### --------------------------------------------------------------------------------------- ###
echo -e "${blue} Building packages:${reset}"
make -j$(($(nproc)+1)) package/compile 'IGNORE_ERRORS=n m' BUILD_LOG=1 V=s 2>&1 | tee logs/build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
### --------------------------------------------------------------------------------------- ###
echo -e "${red}CHanging System Files Back:${reset}"
# sudo mv /usr/lib/libgcc_s.so.1.bak /usr/lib/libgcc_s.so.1
# sudo mv /usr/lib/libpthread.so.bak /usr/lib/libpthread.so
# sudo mv /usr/lib/libpthread.a.bak /usr/lib/libpthread.a
# sudo mv /usr/lib/libc.a.bak /usr/lib/libc.a
# sudo mv /usr/lib/libpam.so.bak /usr/lib/libpam.so
# sudo mv /usr/lib/libiconv.so.bak /usr/lib/libiconv.so
### --------------------------------------------------------------------------------------- ###
### ---------[ TMP Create Exit to Fix Broken Packages ]------------------------------------ ###
#echo -e "${red} Exited: Please Run Next Script After Fixing Packages:${reset}"
#exit
### --------------------------------------------------------------------------------------- ###
#echo -e "${red} Cleaning up package host opkg:${reset}"
#make package/opkg/host/clean V=s
#echo -e "${red} Building package Host opkg:${reset}"
#make -j$(($(nproc)+1)) package/opkg/host/compile V=s 'IGNORE_ERRORS=n m' BUILD_LOG=1
echo -e "${blue} Installing packages:${reset}"
make -j$(($(nproc)+1)) package/install V=s 2>&1 | tee logs/build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
echo -e "${blue} Indexing packages:${reset}"
make -j$(($(nproc)+1)) package/index CONFIG_SIGNED_PACKAGES= V=s 2>&1 | tee logs/build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
echo -e "${blue} Building and installing images:${reset}"
make -j$(($(nproc)+1)) target/install V=s 2>&1 | tee logs/build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
echo -e "${blue} Generating config.buildinfo, version.buildinfo and feeds.buildinfo:${reset}"
make -j1 buildinfo V=s || true
echo -e "${blue} Generate profiles.json in target folder:${reset}"
make -j1 json_overview_image_info V=s || true
echo -e "${blue} Calculating checksums:${reset}"
make -j1 checksum V=s
echo -e "${blue} df Reporting disk usage:${reset}"
df -h
echo -e "${blue} Setting ccache directory again:${reset}"
export CCACHE_DIR=/home/eliminater74/Builds/openwrt/BUILD/openwrt/.ccache
echo -e "${blue} ccachestat Reporting ccache stats:${reset}"
ccache -s
echo -e "${blue} :${reset}"
echo -e "${blue} :${reset}"
### ---------------[ Timer Display ]---------------------------------------------------- ###
if (( $SECONDS > 3600 )) ; then
let "hours=SECONDS/3600"
let "minutes=(SECONDS%3600)/60"
let "seconds=(SECONDS%3600)%60"
echo -e "${green} Completed in $hours hour(s), $minutes minute(s) and $seconds second(s)${reset}"
elif (( $SECONDS > 60 )) ; then
let "minutes=(SECONDS%3600)/60"
let "seconds=(SECONDS%3600)%60"
echo -e "${green} Completed in $minutes minute(s) and $seconds second(s)${reset}"
else
echo -e "${green} Completed in $SECONDS seconds${reset}"
fi
### ------------------------------------------------------------------------------------ ###
echo -e "${blue} :${reset}"
echo -e "${blue} :${reset}"
echo -e "${green} Finished: Your Image(s)/Package(s) are in ./bin:${reset}"
###################################################################################################################################
### BELOW NOT REALLY USED ###
#############################
echo -e "${blue} :${reset}"
echo -e "${blue} :${reset}"
echo -e "${blue} :${reset}"
my last working build was on 20201221, since then, hasnt worked at all.
I invoke make with specific targets like package/opkg/host/compile, target/compile only when debugging/testing something. I got the impression that these build targets are somewhat "loosely" depended on each other and got to prepare myself to check further should a random invoke fail
been down that road also, had just as many problems before going to a scrip way following the same way the buildbots for openwrt do.. it has worked for months just till 12/21/2020. Now it doesnt work
anymore.. get that errors about opkg all the time no matter what I do.. if I build a basic wrt3200acm min firmware, it works perfect without that error........
So it would be nice to know why I get this error:
also, I build on my Main Machine Arch Linux, also have tried on VirtualBox Debian Latest and Ubuntu both Desktop and Server latest....... and built both ways, using Make and using script..
and always Errors out........ So either way, something is wrong.