From nobody Sun Dec 17 12:10:00 2023 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4StMGc1Z8fz54XHZ for ; Sun, 17 Dec 2023 12:10:16 +0000 (UTC) (envelope-from atma@convalesco.org) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4StMGb5DTTz3W8W for ; Sun, 17 Dec 2023 12:10:15 +0000 (UTC) (envelope-from atma@convalesco.org) Authentication-Results: mx1.freebsd.org; none Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id D028C5C0135; Sun, 17 Dec 2023 07:10:13 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sun, 17 Dec 2023 07:10:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=convalesco.org; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1702815013; x= 1702901413; bh=ethaED0lhAXWGCKQ/icFqJS3l01kNTTODuuK1/oNS9o=; b=O MBKeeR7fv5eHDkaa18QpS0DGq0g1/2Z2OCrACKe4ivWh/GAE/s194jLWBHq8/GOF v7ggOuRA8Wpk8Mb5F0ifKeJSBkqrFzvaG9ysDsA6kcBMYpRnDI7KJKlgDQEu7zOr RwWTVRoxbQQzOuxwMdfR+67XN1Q2oSalU3PIf4FAoOrEoeI3KiwlxIS3V4k5+4Xa maxESi5ATizQnspndyKMKg9iQ3+6G6k3Dj8zfDY6SebR9Hi9MSOMzs7Nv6iDiMGF BQlqbMOjt4o1h6mdUbTHfKnM6rTbfE0cVUytuZLMH6Ybcf+cMXYVcgzuuD74lkVl AxJv5dgUU7qyTm2T86Pug== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1702815013; x=1702901413; bh=ethaED0lhAXWGCKQ/icFqJS3l01k NTTODuuK1/oNS9o=; b=mY45zG+eJCyxQXPhHnpaot4sQPi0YLMQ7qh7EUze9IXE J568cGWUBxjWHXYHl7dUhZBziqekHtA1bCrHtdRYQH3x6IUMOw0myoyvVzBmHKpR r8CqK42a2yQ6C3vBXeSWEq9RorTBux+wDPN86/XOkZNFphPruKUHMJcE1QcVz52v eh3ymhCVzcqi9/im52maWbKQCg8pt/FOtcLeyRYZFnSkhDJbiu1rhtmsiXEALCW1 MVNL0WE4gqN09a2xAxFxHZSCqxHG2+WunszOXrxonxc2kvt+WoD7AuDD6wfZldnP 3topvqr5LrrMR171Zvneq+WcGnQNfiy+r9ikkfHUig== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvddtiedgfeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhkfgtggfuffgjvefvfhfosegrtd hmrehhtdejnecuhfhrohhmpefrrghnrghgihhothhishcutehtmhgrthiiihguihhsuceo rghtmhgrsegtohhnvhgrlhgvshgtohdrohhrgheqnecuggftrfgrthhtvghrnhepkeehte fhgfehhefggeekuefhveetffevvefgjefgvdeiffeuudelgeevvedtjeeknecuffhomhgr ihhnpehfrhgvvggsshgurdhorhhgpdhmihhtrdgvughunecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomheprghtmhgrsegtohhnvhgrlhgvshgtohdr ohhrgh X-ME-Proxy: Feedback-ID: if8a042fc:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 17 Dec 2023 07:10:12 -0500 (EST) From: Panagiotis Atmatzidis Message-Id: <292A20D8-94CB-47FE-B48B-D3EFF10079AC@convalesco.org> Content-Type: multipart/alternative; boundary="Apple-Mail=_BDBF1E2A-F9B7-44D8-BE88-11DB7616FC1E" List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Subject: Re: FreeRadius SQL driver undefined symbol __aeabi_uidivmod Date: Sun, 17 Dec 2023 14:10:00 +0200 In-Reply-To: Cc: "freebsd-arm@freebsd.org" To: Warner Losh References: <5331A126-5DF4-4758-A607-31F23DD5C5B7@convalesco.org> X-Mailer: Apple Mail (2.3731.700.6) X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:19151, ipnet:66.111.4.0/24, country:US] X-Spamd-Bar: ---- X-Rspamd-Queue-Id: 4StMGb5DTTz3W8W --Apple-Mail=_BDBF1E2A-F9B7-44D8-BE88-11DB7616FC1E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hello Warner, Thanks for the suggestions, worked like a charm! So here=E2=80=99s the = complete list of commands: ``` [root@aeschylus /usr/src]# mkdir /root/backup [root@aeschylus /usr/src]# cp /lib/libgcc_s.so.1 /root/backup/ [root@aeschylus /usr/src]# cp /usr/lib/debug/lib/libgcc_s.so.1.debug = /root/backup/ [root@aeschylus /usr/src]# cd /usr/src [root@aeschylus /usr/src]# patch -C < = /home/atma/arithmetic_symbols.patch # dry-run mode Hmm... Looks like a unified diff to me... The text leading up to this was: -------------------------- |diff --git a/lib/libgcc_s/Versions.def b/lib/libgcc_s/Versions.def |index d28e9042f744..b90bc705e3de 100644 |--- a/lib/libgcc_s/Versions.def |+++ b/lib/libgcc_s/Versions.def -------------------------- Patching file lib/libgcc_s/Versions.def using Plan A... Hunk #1 succeeded at 32 (offset 1 line). Hmm... The next patch looks like a unified diff to me... The text leading up to this was: -------------------------- |diff --git a/lib/libgcc_s/arm/Symbol.map b/lib/libgcc_s/arm/Symbol.map |index 92b54761d810..49b0820b2a73 100644 |--- a/lib/libgcc_s/arm/Symbol.map |+++ b/lib/libgcc_s/arm/Symbol.map -------------------------- Patching file lib/libgcc_s/arm/Symbol.map using Plan A... Hunk #1 succeeded at 16 (offset 1 line). done [root@aeschylus /usr/src]# patch < /home/atma/arithmetic_symbols.patch # = apply the patch [=E2=80=A6] # same as above [root@aeschylus /usr/src]# patch < /home/atma/arithmetic_symbols.patch # = apply the patch [root@aeschylus /usr/src]# cd lib/libgcc_s [root@aeschylus /usr/src]# make clean obj depend all [=E2=80=A6] [root@aeschylus /usr/src]# sudo make install [=E2=80=A6] ``` Radius comes up without errors. The SQL driver works as expected. Thank you! > On 17 Dec 2023, at 10:24 AM, Warner Losh wrote: >=20 >=20 >=20 > On Sun, Dec 17, 2023, 12:35=E2=80=AFAM Panagiotis Atmatzidis = > wrote: >>=20 >>=20 >>> On 17 Dec 2023, at 8:41 AM, Panagiotis Atmatzidis = > wrote: >>>=20 >>> Hello, >>>=20 >>> I=E2=80=99m trying to setup FreeRadius3 on RPi2 (armv6) running = FreeBSD-13.2. I=E2=80=99m using MySQL as a backend because it runs = nicely on a low resource hardware. >>>=20 >>> Enabling the SQL driver yields the following error: >>>=20 >>> ``` >>> Could not link driver rlm_sql_mysql: /usr/local/lib/libunwind.so.8: = Undefined symbol "__aeabi_uidivmod" >>> Make sure it (and all its dependent libraries!) are in the search = path of your system's ld >>> /usr/local/etc/raddb/mods-enabled/sql[27]: Instantiation failed for = module =E2=80=9Csql" >>> ``` >>>=20 >>> There is a discussion in bugtraq[^1] about this exact issue and = there seems to be a patch as well[^2]. Can someone help me apply this = patch or point me to a tutorial? >>>=20 >>> I used =E2=80=9Cpkg=E2=80=9D to install "mysql80-server" and = "freeradius3-mysql=E2=80=9C, however I have the ports collection = installed so I could use that if it helps. >>>=20 >>> Kind regards, >>>=20 >>> P. >>>=20 >>>=20 >>> [^1]: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D271087 >>> [^2]: = https://bugs.freebsd.org/bugzilla/attachment.cgi?bugid=3D271087&action=3Dv= iewall >>>=20 >>=20 >> Going through a similar request[^1] in the forums and a bit of = browsing the kernel tree helped figure things out. Sharing the solution = step-by-step for posterity. >>=20 >> Copy the patch (diff file) and place the patch to the home dir e.g. " = /home/atma/arithmetic_symbols.patch=E2=80=9D and then then: >>=20 >> ``` >> [root@aeschylus /usr/src]# cd /usr/src >> [root@aeschylus /usr/src]# patch -C < = /home/atma/arithmetic_symbols.patch >> Hmm... Looks like a unified diff to me... >> The text leading up to this was: >> -------------------------- >> |diff --git a/lib/libgcc_s/Versions.def b/lib/libgcc_s/Versions.def >> |index d28e9042f744..b90bc705e3de 100644 >> |--- a/lib/libgcc_s/Versions.def >> |+++ b/lib/libgcc_s/Versions.def >> -------------------------- >> Patching file lib/libgcc_s/Versions.def using Plan A... >> Hunk #1 succeeded at 32 (offset 1 line). >> Hmm... The next patch looks like a unified diff to me... >> The text leading up to this was: >> -------------------------- >> |diff --git a/lib/libgcc_s/arm/Symbol.map = b/lib/libgcc_s/arm/Symbol.map >> |index 92b54761d810..49b0820b2a73 100644 >> |--- a/lib/libgcc_s/arm/Symbol.map >> |+++ b/lib/libgcc_s/arm/Symbol.map >> -------------------------- >> Patching file lib/libgcc_s/arm/Symbol.map using Plan A... >> Hunk #1 succeeded at 16 (offset 1 line). >> done >> ``` >=20 >=20 > Ideally you'd do a full buildworld/installworld here. On these = machines that takes a lot of time. >=20 > You may be able to do: >=20 > % cd lib/libgcc_s > % make clean obj depend all > % sudo make install >=20 > But that assumes your system has all the compilers, libraries etc = installed on it... If you are cross building, then just do a full = buildworld since the above depends on make includes and possibly other = things running first. >=20 > If we still have armv6 snapshots, there's a chance that the = /lib/libgcc_s.so.1 from it will have the fix and you can copy it over... = but that might be more hassle and may be less safe than the above. >=20 > Good luck. And make backups of /lib/libgcc_s.so.1 before starting = (keep a copy in /lib, and use /rescue/sh if you mess this up and /bin/sh = can't run for single-user). >=20 > Warner >=20 >> -- >> Panagiotis (atmosx) Atmatzidis >> GPG: gpg --keyserver pgp.mit.edu = --recv-keys 1A7BFEC5 -- Panagiotis (atmosx) Atmatzidis GPG: gpg --keyserver pgp.mit.edu --recv-keys 1A7BFEC5 --Apple-Mail=_BDBF1E2A-F9B7-44D8-BE88-11DB7616FC1E Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hello = Warner,

Thanks for the suggestions, worked like a = charm! So here=E2=80=99s the complete list of = commands:

```
[root@aeschylus /usr/src]# mkdir = /root/backup
[root@aeschylus /usr/src]# cp = /lib/libgcc_s.so.1 /root/backup/
[root@aeschylus = /usr/src]# cp /usr/lib/debug/lib/libgcc_s.so.1.debug = /root/backup/
[root@aeschylus /usr/src]# cd = /usr/src
[root@aeschylus /usr/src]# patch -C < = /home/atma/arithmetic_symbols.patch # dry-run mode
Hmm... =  Looks like a unified diff to me...
The text leading up = to this was:
--------------------------
|diff --git = a/lib/libgcc_s/Versions.def b/lib/libgcc_s/Versions.def
|index = d28e9042f744..b90bc705e3de 100644
|--- = a/lib/libgcc_s/Versions.def
|+++ = b/lib/libgcc_s/Versions.def
--------------------------
Patching file lib/libgcc_s/Versions.def using Plan A...
Hunk = #1 succeeded at 32 (offset 1 line).
Hmm...  The next = patch looks like a unified diff to me...
The text leading up = to this was:
--------------------------
|diff --git = a/lib/libgcc_s/arm/Symbol.map = b/lib/libgcc_s/arm/Symbol.map
|index = 92b54761d810..49b0820b2a73 100644
|--- = a/lib/libgcc_s/arm/Symbol.map
|+++ = b/lib/libgcc_s/arm/Symbol.map
--------------------------
Patching file lib/libgcc_s/arm/Symbol.map using Plan = A...
Hunk #1 succeeded at 16 (offset 1 = line).
done

[root@aeschylus /usr/src]# patch < = /home/atma/arithmetic_symbols.patch # apply the = patch
[=E2=80=A6] # same as = above
[root@aeschylus /usr/src]# patch < = /home/atma/arithmetic_symbols.patch # apply the = patch
[root@aeschylus /usr/src]# cd = lib/libgcc_s
[root@aeschylus /usr/src]# make clean obj depend = all
[=E2=80=A6]
[root@aeschylus /usr/src]# sudo make = install
[=E2=80=A6]
```

Radius comes up without errors. The SQL driver = works as expected.

Thank = you!

On 17 Dec 2023, = at 10:24 AM, Warner Losh <imp@bsdimp.com> wrote:



On Sun, Dec 17, 2023, 12:35=E2=80=AFAM = Panagiotis Atmatzidis <atma@convalesco.org> = wrote:


On 17 Dec 2023, at 8:41 AM, Panagiotis Atmatzidis = <atma@convalesco.org> wrote:

Hello,

I=E2=80= =99m trying to setup FreeRadius3 on RPi2 (armv6) running FreeBSD-13.2. = I=E2=80=99m using MySQL as a backend because it runs nicely on a low = resource hardware.

Enabling the SQL driver = yields the following = error:

```
Could not link driver = rlm_sql_mysql: /usr/local/lib/libunwind.so.8: Undefined symbol = "__aeabi_uidivmod"
Make sure it (and all its dependent = libraries!) are in the search path of your system's = ld
/usr/local/etc/raddb/mods-enabled/sql[27]: Instantiation = failed for module = =E2=80=9Csql"
```

There is a = discussion in bugtraq[^1] about this exact issue and there seems to be a = patch as well[^2]. Can someone help me apply this patch or point me to a = tutorial?

I used =E2=80=9Cpkg=E2=80=9D to = install "mysql80-server" and "freeradius3-mysql=E2=80=9C, however I have = the ports collection installed so I could use that if it = helps.

Kind = regards,

P.


[^1]: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D2710= 87


Going through a similar request[^1] in the = forums and a bit of  browsing the kernel tree helped figure things = out. Sharing the solution step-by-step for = posterity.

Copy the patch (diff file) and place = the patch to the home dir e.g. " /home/atma/arithmetic_symbols.patch=E2=80=9D= and then then:

```
[root@aeschylus /usr/src]# cd = /usr/src
[root@aeschylus /usr/src]# patch -C < = /home/atma/arithmetic_symbols.patch
Hmm...  Looks like a = unified diff to me...
The text leading up to this = was:
--------------------------
|diff --git = a/lib/libgcc_s/Versions.def b/lib/libgcc_s/Versions.def
|index = d28e9042f744..b90bc705e3de 100644
|--- = a/lib/libgcc_s/Versions.def
|+++ = b/lib/libgcc_s/Versions.def
--------------------------
Patching file lib/libgcc_s/Versions.def using Plan A...
Hunk = #1 succeeded at 32 (offset 1 line).
Hmm...  The next = patch looks like a unified diff to me...
The text leading up = to this was:
--------------------------
|diff --git = a/lib/libgcc_s/arm/Symbol.map = b/lib/libgcc_s/arm/Symbol.map
|index = 92b54761d810..49b0820b2a73 100644
|--- = a/lib/libgcc_s/arm/Symbol.map
|+++ = b/lib/libgcc_s/arm/Symbol.map
--------------------------
Patching file lib/libgcc_s/arm/Symbol.map using Plan = A...
Hunk #1 succeeded at 16 (offset 1 = line).
done
```

Ideally you'd do a = full buildworld/installworld here. On these machines that takes a lot of = time.

You may be able = to do:

% cd = lib/libgcc_s
% make clean obj depend = all
% sudo make install

But that assumes your system = has all the compilers, libraries etc installed on it... If you are cross = building, then just do a full buildworld since the above depends on make = includes and possibly other things running first.

If we still have armv6 = snapshots, there's a chance that the /lib/libgcc_s.so.1 from it will = have the fix and you can copy it over... but that might be more hassle = and may be less safe than the above.

Good luck. And make backups of = /lib/libgcc_s.so.1 before starting (keep a copy in /lib, and use = /rescue/sh if you mess this up and /bin/sh can't run for = single-user).

Warner

--
Panagiotis (atmosx) = Atmatzidis
GPG:       gpg --keyserver pgp.mit.edu --recv-keys 1A7BFEC5

--
Panagiotis (atmosx) Atmatzidis
GPG:   =     gpg --keyserver pgp.mit.edu = --recv-keys 1A7BFEC5





= --Apple-Mail=_BDBF1E2A-F9B7-44D8-BE88-11DB7616FC1E--