Re: FreeRadius SQL driver undefined symbol __aeabi_uidivmod

From: Panagiotis Atmatzidis <atma_at_convalesco.org>
Date: Sun, 17 Dec 2023 12:10:00 UTC
Hello Warner,

Thanks for the suggestions, worked like a charm! So here’s 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
[…] # 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
[…]
[root@aeschylus /usr/src]# sudo make install
[…]
```

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 AM Panagiotis Atmatzidis <atma@convalesco.org <mailto:atma@convalesco.org>> wrote:
>> 
>> 
>>> On 17 Dec 2023, at 8:41 AM, Panagiotis Atmatzidis <atma@convalesco.org <mailto:atma@convalesco.org>> wrote:
>>> 
>>> Hello,
>>> 
>>> I’m trying to setup FreeRadius3 on RPi2 (armv6) running FreeBSD-13.2. I’m 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 “sql"
>>> ```
>>> 
>>> 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 “pkg” to install "mysql80-server" and "freeradius3-mysql“, 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=271087
>>> [^2]: https://bugs.freebsd.org/bugzilla/attachment.cgi?bugid=271087&action=viewall
>>> 
>> 
>> 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” 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 <http://pgp.mit.edu/> --recv-keys 1A7BFEC5

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