opnsense / ports

OPNsense ports on top of FreeBSD
https://opnsense.org/
Other
157 stars 112 forks source link

realtek-re-kmod package missing for aarch64 build? #150

Closed JohannesNeu closed 1 year ago

JohannesNeu commented 2 years ago

Hi, I try to build a RPI image on a raspberry pi 4 and if I understand the build process correctly, then opnsense tools will fetch its packets from opnsense/ports instead of the freebsd ports that pkg would use, right?

I am asking because I get this error message:

The following package(s) are locked and may not be removed:

        ca_root_nss
        curl
        expat
        git
        indexinfo
        libffi
        libidn2
        libnghttp2
        libpsl
        libunistring
        mpdecimal
        openssl
        p5-Error
        pcre2
        perl5
        pkg
        python38
        readline

Deinstallation has been requested for the following 3 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
        gmp: 6.2.1
        nettle: 3.8
        radsecproxy: 1.8.2

Number of packages to be removed: 3

The operation will free 7 MiB.
[1/3] Deinstalling radsecproxy-1.8.2...
[1/3] Deleting files for radsecproxy-1.8.2: .......... done
[2/3] Deinstalling nettle-3.8...
[2/3] Deleting files for nettle-3.8: .......... done
[3/3] Deinstalling gmp-6.2.1...
[3/3] Deleting files for gmp-6.2.1: .......... done
Installing pkg-1.17.5_1...
the most recent version of pkg-1.17.5_1 is already installed
Could not find package: realtek-re-kmod
*** Error code 1

Stop.
make: stopped in /tmp/opnsense/tools

While I can install realtek-re-kmod on the build machine using pkg install realtek-re-kmod without a problem. I checked https://www.freshports.org/net/realtek-re-kmod to see where the package should be, but I cannot find it in the opnsense/ports net subfolder. Am I missing something?

fichtner commented 2 years ago

Not sure what you mean as it is here... https://github.com/opnsense/ports/tree/master/net/realtek-re-kmod

If there is no package the build likely failed for it. It's properly set up in ports.conf from what I can tell and always ends up correctly in our nightly builds

JohannesNeu commented 2 years ago

I guess I missed this line, which is why I couldnt find it: truncated

It seems odd that it would not be able to find the package although it is here in the git repo. Is there a way to get more information from the build process to figure out why it would not find the package?

fichtner commented 2 years ago

Just force a ports rebuild of realtek-re-kmod? oO

JohannesNeu commented 2 years ago

That sounds like a plan, how would I do this? I read that I should use portsmaster, is that correct? If so: how do I make sure that it is the opnsense/ports package realtek-re-kmod that is forced to rebuild instead of the freebsd one of the host?

fichtner commented 2 years ago

err what, no we have build tools for this... and I'm having a deja-vu here pointing to https://github.com/opnsense/tools#about-the-opnsense-tools

JohannesNeu commented 2 years ago

ok, so I created two fresh folders and set up a new build environment in each of them and then tried to build the packages on their own to figure out what may be going wrong:

mkdir -p /tmp/armtest
cd /tmp/armtest
git clone https://github.com/opnsense/tools
cd tools
env ROOTDIR=/tmp/armtest make update
env ROOTDIR=/tmp/armtest make ports-realtek-re-kmod DEVICE=ARM64
mkdir -p /tmp/rpitest
cd /tmp/rpitest
git clone https://github.com/opnsense/tools
cd tools
env ROOTDIR=/tmp/rpitest make update
env ROOTDIR=/tmp/rpitest make ports-realtek-re-kmod DEVICE=RPI

in both cases I get the same error message:

[20220701003939] ===> Building for realtek-re-kmod-196.04
make[1]: "/usr/share/mk/bsd.sysdir.mk" line 15: Unable to locate the kernel source tree. Set SYSDIR to override.

make[1]: stopped in /usr/obj/tmp/armtest/ports/net/realtek-re-kmod/work/rtl_bsd_drv_v196.04
[20220701003939] ===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make: stopped in /tmp/armtest/ports/net/realtek-re-kmod
Creating repository in /usr/obj/tmp/armtest/tools/config/22.1/OpenSSL:aarch64/.pkg-new/: 100%
Packing files for repository: 100%
>>> Running build step: clean
>>> Passing arguments: packages
>>> Removing packages set
>>> Creating package mirror set for 22.1.9_46-OpenSSL-aarch64... done
-rw-r--r--  1 root  wheel   713M Jul  1 00:43 packages-22.1.9_46-OpenSSL-aarch64.tar
>>> WARNING: The build provided additional info.
>>> Rebuilt version 3.5.3 for databases/py-redis@py39
>>> Rebuilt version 3.9.13_7 for databases/py-sqlite3@py39
>>> Rebuilt version 3.12.3 for databases/pymongo
>>> Skipped version 2.37.0 for devel/git
>>> Skipped version 3.1.5 for devel/pecl-xdebug
>>> Rebuilt version 3.0.1 for devel/py-Jinja2@py39
>>> Rebuilt version 2.8.0 for devel/py-pycodestyle@py39
>>> Rebuilt version 5.0.0 for devel/py-ujson@py39
>>> Rebuilt version 4.3.0 for devel/scons
>>> Rebuilt version 3.11.2 for dns/py-dns-lexicon@py39
>>> Rebuilt version 2.2.1,1 for dns/py-dnspython@py39
>>> Rebuilt version 12.7 for net-im/py-telepot@py39
>>> Rebuilt version 0.8.1 for net-mgmt/py-opn-cli
>>> Rebuilt version 21.4 for net/cloud-init@py39
>>> Skipped version 5.2.d20220622,1 for net/ntopng
>>> Rebuilt version 0.8.0 for net/py-netaddr@py39
>>> Rebuilt version 2.1.3 for net/py-speedtest-cli@py39
>>> ERROR: The build encountered fatal issues!
>>> Aborted version 196.04 for net/realtek-re-kmod
*** Error code 1

Stop.
make: stopped in /tmp/armtest/tools

the missing kernel source tree may not be missing when I do "make arm DEVICE=RPI" because it tries to build the kernel before creating realtek-re-kmod? So the result of these tests may not be applicable to the errors I see when I build the whole image? If so: what package would I need to build to get the kernel source tree to check whether there is another error beneath this one?

fichtner commented 2 years ago

similar to https://github.com/opnsense/tools/pull/294 if you insist on ROOTDIR modification. it seems PORTSDIR is properly handled by ports but SRCDIR is expected to be exported as SRC_BASE for whatever reason or the wrong value is bootstrapped (the /usr/src default).

https://github.com/opnsense/ports/blob/063479f94c97bb21d09233c7a54159d0bfaeebba/Mk/bsd.port.mk#L1028

JohannesNeu commented 2 years ago

I tried to figure out what the linked merge request describes and tried several combinations on how I could add either SRCDIR or SRC_BASE:

env ROOTDIR=/tmp/rpitest make ports-realtek-re-kmod DEVICE=RPI SRC_BASE=/tmp/rpitest/src
env ROOTDIR=/tmp/rpitest make ports-realtek-re-kmod DEVICE=RPI SRCDIR=/tmp/rpitest/src
env ROOTDIR=/tmp/rpitest SRCDIR=/tmp/rpitest/src make ports-realtek-re-kmod DEVICE=RPI

but they all end with the same error:

>>> ERROR: The build encountered fatal issues!
>>> Aborted version 196.04 for net/realtek-re-kmod
*** Error code 1

I checked the output of the arguments, which are listed right after starting "make" and I can find SRCDIR which seems to have the correct path, but I cannot find SRC_BASE anywhere:

SRCABI=FreeBSD:13:aarch64
SRCBRANCH=stable/22.1
SRCDIR=/tmp/rpitest/src
SRCREVISION=13.0

Looking at the link you attached I guess none of my tries will work until this pull request is approved, because the old shell script doesnt really care about SRCDIR, but uses "make -C ${PORTSDIR}/\${PORT}" instead?

Shouldn't basically everyone run into problems like this, when they try to compile an image in a different folder than /usr/tools?

fichtner commented 2 years ago

ROOTDIR was added by a FreeBSD developer. I’m not sure he built more than base and kernel so anything is possible. SRC_BASE=${SRCDIR} should work when set in the MAKE_ARGS although I’m not sure about chroot structure when cloning src.git. Overrides are nice but try to confirm ROOTDIR is the issue first by trying a build that doesn’t use it and work on from there.

JohannesNeu commented 2 years ago

I tried to build the module in the /usr/tools directory with:

root@generic:/usr/tools # make ports-realtek-re-kmod DEVICE=RPI

and it seems to work:

...
fig/22.1/OpenSSL:aarch64/.pkg-new/:Creating repository in /usr/obj/usr/tools/config/22.1/OpenSSL:aarch64/.pkg-new/:Creating repository in /usr/obj/usr/tools/config/22.1/OpenSSL:aarch64/.pkg-new/: 100%
Packing files for repository: 100%
>>> Running build step: clean
>>> Passing arguments: packages
>>> Removing packages set
>>> Creating package mirror set for 22.1.9_80-OpenSSL-aarch64... done
-rw-r--r--  1 root  wheel   755M Jul  2 15:00 packages-22.1.9_80-OpenSSL-aarch64.tar
>>> WARNING: The build provided additional info.
>>> Skipped version 3.5.3_1 for databases/py-redis@py39
>>> Skipped version 2.37.0 for devel/git
>>> Skipped version 3.1.5 for devel/pecl-xdebug
>>> Rebuilt version 3.0.1 for devel/py-Jinja2@py39
>>> Rebuilt version 2.8.0 for devel/py-pycodestyle@py39
>>> Rebuilt version 4.3.0 for devel/scons
>>> Rebuilt version 3.11.3 for dns/py-dns-lexicon@py39
>>> Skipped version 7.84.0 for ftp/curl
>>> Rebuilt version 12.7 for net-im/py-telepot@py39
>>> Rebuilt version 0.8.1 for net-mgmt/py-opn-cli
>>> Skipped version 6.0.6 for net-mgmt/zabbix6-agent
>>> Skipped version 6.0.6 for net-mgmt/zabbix6-proxy
>>> Skipped version 2.0.10 for net/bird2
>>> Rebuilt version 21.4 for net/cloud-init@py39
>>> Skipped version 5.2.d20220622,1 for net/ntopng
>>> Rebuilt version 0.8.0 for net/py-netaddr@py39
>>> Rebuilt version 2.1.3 for net/py-speedtest-cli@py39
>>> Rebuilt version 196.04 for net/realtek-re-kmod
>>> Rebuilt version 2,1 for net/wireguard
>>> Rebuilt version 0.11.2_3 for security/py-fail2ban@py39
>>> Rebuilt version 5.5.0 for sysutils/ansible@py39
>>> Rebuilt version 1.12a for sysutils/cciss_vol_status
>>> Skipped version 3.4 for sysutils/dmidecode
>>> Skipped version 3.37.1 for sysutils/syslog-ng
>>> Skipped version 2.11.11 for textproc/minify
>>> Rebuilt version 1.18.61 for www/py-boto3@py39
root@generic:/usr/tools # 

so I think we can be sure that using ROOTDIR is the cause. But what ot do next? Remove the description from the tools README that advertises the possibility to build in a different directory, or wait for a fix? I could do some testing if someone comes up with a possible solution.