Building, changes to config not saving

What happens if you strictly follow jeff's advice above (do everything as non-root user)?

1 Like

When you select a package, that package, plus its dependencies are added to the build. When you remove same, the dependencies will be left behind, so over time cruft will build up. Best to start from scratch, working towards your desired image. Useful tools in getting there are:

./scripts/diffconfig.sh > configdiffX
cp configdiffX .config
make defconfig

Set aside a configdiff of your friends .config, and imo start from scratch.

2 Likes

@tmomas
I have been building as non root since it was first mentioned in the thread. That's why I mentioned that I also changed the owner to non root.

@anomeome
I followed your directions then did make.

make[3] -C target/linux install
make -r world: build failed. Please re-run make with -j1 V=s or V=sc for a higher verbosity level to see what's going on
/clients/openwrt-18.06/include/toplevel.mk:216: recipe for target 'world' failed
make: *** [world] Error 1

I'll try downloading a whole new version and see what happens.

New git download, I removed a couple of packages and added curl. Countless warnings.

elf.hpp:267:44: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
       std::string get_version_file() const throw (std::bad_alloc);
                                            ^~~~~
elf.hpp:269:44: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
       std::string get_name_version() const throw (std::bad_alloc);
                                            ^~~~~
elf.hpp:308:29: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
       version_requirement() throw (std::bad_alloc);
                             ^~~~~

 make[3] -C tools/mpfr compile
+ curl -f --connect-timeout 20 --retry 5 --location --insecure https://mirror.csclub.uwaterloo.ca/gnu/mpfr/mpfr-4.0.2.tar.xz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0number.c: In function '_bc_rec_mul':

Just warnings so I'll go through the entire process and see what happens.

Those don't look to be "default" package selections.

Until you can get to the point that you can confirm that you can successfully build "vanilla" OpenWrt, you won't have a baseline to determine if the problems are with your friend's config and/or source or not.

As mentioned, I downloaded using git, I removed only two or three packages, added curl and am building. I also picked a type and then ran make. It's odd that I'm not getting results that seem to make sense to anyone. I don't think I'm doing anything unusual. Here is another error I'm watching if it means anything.

ar: `u' modifier ignored since `D' is the default (see `U')
configure: WARNING:
*** Makeinfo is missing or too old.
*** Info documentation will not be built.
Links are now set up to build a cross-compiler
 from x86_64-pc-linux-gnu to mipsel-openwrt-linux-musl.

It's still building :). I think I'll stop it now, remove the whole thing, download again and this time only make menuconfig, save as it is and make. See what happens.

Just so you all can be sure I'm doing what you're suggesting :).

$ git clone https://git.openwrt.org/openwrt/openwrt.git
Cloning into 'openwrt'...
remote: Enumerating objects: 464672, done.
remote: Counting objects: 100% (464672/464672), done.
remote: Compressing objects: 100% (128867/128867), done.
Receiving objects:  37% (175775/464672), 35.79 MiB | 96.00 KiB/s

Once done, I'm only going to run the script commands, go into make menuconfig, hit save, exit and run make.

Select a specific target, like the TP-Link Archer C7v2

Don’t use make -jN which it looks like you’ve been doing. For a multi-threaded build, you must have the build system fully initialized for effectively the same build, unless you sequence things yourself.

Edit: I have just re-confirmed that the steps I posted result in a complete, "error-free" build for the TP-Link Archer C7v2.

I've tried various combinations including -j but won't this time.

Wow, it finally completed. Ok, now what? Can I try removing a package or two and build again?

Now that you know your build environment is "good", then you can try adding or removing packages as you need.

I usually add to my config, either directly or through menuconfig and the developer section

CONFIG_DEVEL=y
CONFIG_BUILD_LOG=y
CONFIG_CCACHE=y

The first enables developer options (at all)
The second writes logs to ./logs/ that can help diagnose problems, especially if you are running a multi-threaded build.
The third is a time-saver that helps to avoid completely recompiling code, even if you've done a clean or the like.

Understand what the following does and why, before using it

make -jN clean download world

In many situations, it works because it makes sure that most of the build dependencies are resolved before another thread needs them. It is not "guaranteed" to build without errors! Yes, on an error, you need to go back to make or make V=s with no -j option. Yes, there are times you need to remove your complete ./build_dir/ and ./tmp/ folders from your OpenWrt build root.

I would make sure you are comfortable with make menuconfig and ./scripts/diffconfig (as well as using git) before starting back with your friend's source code and config.

Please keep in mind, I also mentioned that my current env also works, but only if I don't try removing packages. If I simply build, it completes just like the new code I just downloaded.

make -jN clean download world

If I understand this, it means clean first, then build the world package and download what ever is needed to do so. It also means -jN (number of simultaneous processes).

I'm not sure where to add what you are suggesting but I assume it is in the .config of the Config.in file. I've not added this yet.

I tried this 'make -j8 clean download world' and it completed.
Therefore, I did the same on my friends buildroot but without 'world' to see what happens and that worked also. The build actually completed. However, there are no files in the bin/targets/ramips I was trying to build so, maybe I lost something since testing so will revert back to the original and try again.

.config is the "master" config for OpenWrt in the top-level directory, It is what make menuconfig modifies.

Config.in is likely some part of the GNU-style autoconf system, perhaps from your friend's package.

make clean download doesn't build anything. make alone works only because it assumes the "world" target if no targets are entered ("world" is a convention that pretty much everyone uses to mean "build everything"). Hence why the command line I gave you ends with world

You're on your own with your friend's build root. You need to understand what has been configured there, then carefully add to your working build root only what you need. It is likely only a source directory and then selecting their additions in menuconfig. See the suggestions above on using ./scripts/diffconfig

Ok then. I just wanted to try it on his build.
What should I do next with the new build you had me download?

See the suggestions above on using ./scripts/diffconfig

I'll take a look at that again.

diffconfig gives you a list of what is different between a "vanilla' build and what is configured

Before heading out last night, I went ahead and ran make again on my friends buildroot and this time it completed. It doesn't make any sense. Is it possible that I downloaded something onto the OS itself when I was doing the tests your suggested?

I tried again just now and still see packages that I wanted to remove being built or included. For example, I'm wanting to get rid of all ppp, iw/wireless, firewall to make the resulting build fit on a small 4mb device but as you can see, wireless stiff is still being built even thought I removed them in the menuconfig.

make[3] -C package/firmware/wireless-regdb compile
make[3] -C package/network/config/swconfig compile
make[3] -C package/network/utils/iptables compile
make[3] -C package/network/utils/iwinfo compile

I guess there is something about that friends build that is not saving or is overriding or something. This is my friends config diff.

$ cat configdiffX
CONFIG_TARGET_ramips=y
CONFIG_TARGET_ramips_rt305x=y
CONFIG_TARGET_ramips_rt305x_Default=y
# CONFIG_DRIVER_11N_SUPPORT is not set
# CONFIG_FEED_luci is not set
# CONFIG_FEED_packages is not set
# CONFIG_FEED_routing is not set
# CONFIG_FEED_telephony is not set
# CONFIG_IPV6 is not set
# CONFIG_KERNEL_IPV6 is not set
CONFIG_LIBCURL_COOKIES=y
CONFIG_LIBCURL_FILE=y
CONFIG_LIBCURL_FTP=y
CONFIG_LIBCURL_HTTP=y
CONFIG_LIBCURL_MBEDTLS=y
CONFIG_LIBCURL_NO_SMB="!"
CONFIG_LIBCURL_PROXY=y
CONFIG_PACKAGE_bash=m
CONFIG_PACKAGE_ca-bundle=y
CONFIG_PACKAGE_curl=y
# CONFIG_PACKAGE_dnsmasq is not set
# CONFIG_PACKAGE_firewall is not set
# CONFIG_PACKAGE_hostapd-common is not set
# CONFIG_PACKAGE_iptables is not set
# CONFIG_PACKAGE_iw is not set
# CONFIG_PACKAGE_iwinfo is not set
# CONFIG_PACKAGE_kmod-cfg80211 is not set
# CONFIG_PACKAGE_kmod-ipt-conntrack is not set
# CONFIG_PACKAGE_kmod-ipt-nat is not set
# CONFIG_PACKAGE_kmod-ipt-offload is not set
# CONFIG_PACKAGE_kmod-mac80211 is not set
# CONFIG_PACKAGE_kmod-nf-conntrack is not set
# CONFIG_PACKAGE_kmod-nf-flow is not set
# CONFIG_PACKAGE_kmod-nf-ipt6 is not set
# CONFIG_PACKAGE_kmod-nf-nat is not set
# CONFIG_PACKAGE_kmod-rt2800-soc is not set
# CONFIG_PACKAGE_kmod-rt2x00-lib is not set
CONFIG_PACKAGE_libcurl=y
# CONFIG_PACKAGE_libip6tc is not set
CONFIG_PACKAGE_libmbedtls=y
CONFIG_PACKAGE_libncurses=m
CONFIG_PACKAGE_libreadline=m
CONFIG_PACKAGE_libstdcpp=y
# CONFIG_PACKAGE_ppp is not set
CONFIG_PACKAGE_terminfo=m
# CONFIG_PACKAGE_wpad-mini is not set
CONFIG_PACKAGE_kmod-eeprom-93cx6=y
CONFIG_PACKAGE_kmod-ipt-core=y
CONFIG_PACKAGE_kmod-lib-crc-ccitt=y
CONFIG_PACKAGE_kmod-lib-crc-itu-t=y
# CONFIG_PACKAGE_kmod-mppe is not set
CONFIG_PACKAGE_kmod-nf-ipt=y
CONFIG_PACKAGE_kmod-nf-reject=y
CONFIG_PACKAGE_kmod-ppp=y
# CONFIG_PACKAGE_kmod-ppp-synctty is not set
# CONFIG_PACKAGE_kmod-pppoa is not set
CONFIG_PACKAGE_kmod-pppoe=y
# CONFIG_PACKAGE_kmod-pppol2tp is not set
CONFIG_PACKAGE_kmod-pppox=y
# CONFIG_PACKAGE_kmod-pptp is not set
CONFIG_PACKAGE_kmod-slhc=y
CONFIG_PACKAGE_libip4tc=y
CONFIG_PACKAGE_libiwinfo=y
CONFIG_PACKAGE_libxtables=y
CONFIG_PACKAGE_wireless-regdb=y

In menuconfig, ? on a given item will let you see what might be adding it back in.

Ah, cool. So looking at firewall for example, it says 'fwtool' is what is related. When I go to that one, it shows as -*- which I cannot remove. Looking at ? for fwtool shows nothing associated with that in terms of more firewall packages.

However, it shows things I cannot remove such as base-files etc.

Utility for appending and extracting firmware metadata and signatures                                                                                                               x
  x Felix Fietkau <nbd@nbd.name>                                                                                                                                                        x
  x
  x                                                                                                                                                                                     x
  x Symbol: PACKAGE_fwtool [=y]                                                                                                                                                         x
  x Type  : tristate                                                                                                                                                                    x
  x Prompt: fwtool                                                                                                                                                                      x
  x   Location:                                                                                                                                                                         x
  x     -> Base system                                                                                                                                                                  x
  x   Defined at tmp/.config-package.in:339                                                                                                                                             x
  x   Selects: PACKAGE_libc [=y] && PACKAGE_libpthread [=y] && PACKAGE_librt [=n] && PACKAGE_libssp [=n]                                                                                x
  x   Selected by: PACKAGE_base-files [=y]                                                                                                    

Therefore, I now assume there is something else that requires fwtool.

core base-files requires it, like said above.

Ps.

fwtool has nothing to do with firewall. No idea where you got that impression.

Utility for appending and extracting firmware metadata and signatures

I got that impression because I'm just leaning here :).
And yes, I realized that after digging some more into the tree.
Still digging to find what else is related to packages I'm trying to remove now that you've given me some more leads on how to do that.
When looking at certain packages, I can now see if there are any which are left selected using ?. Very useful.