all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "André Batista" <nandre@riseup.net>
To: Andreas Enge <andreas@enge.fr>
Cc: "Ludovic Courtès" <ludo@gnu.org>, guix-devel@gnu.org
Subject: Re: Merging ‘core-updates’ real soon
Date: Mon, 26 Aug 2024 11:33:56 -0300	[thread overview]
Message-ID: <ZsySVP8D9pMVWJwy@andel> (raw)
In-Reply-To: <ZscKAHMOkmHJZoK6@jurong>

Hi Andreas,

qui 22 ago 2024 às 11:50:56 (1724338256), andreas@enge.fr enviou:
> Am Wed, Aug 21, 2024 at 10:43:05PM +0200 schrieb Ludovic Courtès:
> > To me, that’s the last blocker, even though there’s room for improvement
> > here and there (for instance, FFmpeg currently fails to build on
> > i686-linux).
> 
> Just so that others do not have to repeat my check: ffmpeg fails to find
> openal in the configure phase for i686:
> ld: /tmp/guix-build-ffmpeg-6.1.1.drv-0/ffconf.FrPUM7mP/test.o: in function `check_alGetError':
> test.c:(.text+0x1): undefined reference to `alGetError'
> collect2: error: ld returned 1 exit status
> check_lib openal AL/al.h alGetError -lopenal
> check_func_headers AL/al.h alGetError -lopenal
> test_ld cc -lopenal
> test_cc
> BEGIN /tmp/guix-build-ffmpeg-6.1.1.drv-0/ffconf.FrPUM7mP/test.c
>     1   #include <AL/al.h>
>     2   #include <stdint.h>
>     3   long check_alGetError(void) { return (long) alGetError; }
>     4   int main(void) { int ret = 0;
>     5    ret |= ((intptr_t)check_alGetError) & 0xFFFF;
>     6   return ret; }
> END /tmp/guix-build-ffmpeg-6.1.1.drv-0/ffconf.FrPUM7mP/test.c
> 

This is not the whole story.

ffmpeg's configure script tries different library search paths
incantations and this error refers to when it tries with no
command line arguments.

On some other tries it actually finds openal and alGetError, but then
it aborts with the following linking error:

ld: /tmp/guix-build-ffmpeg-6.1.1.drv-0/ffconf.fLOeyoSu/test.o: non-canonical reference to canonical protected function `alGetError' in /gnu/store/j4qdsqxb95yllkby0w2dx6d9lib24zmn-openal-1.23.1/lib/libopenal.so
ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status

Searching for it, it seems this was previously a runtime error, that
now fails at compile time[1] and is due to the pointer type cast
when referencing alGetError on line 5 above and the segmented memory
model of x86.

Notice that this code snippet is run for all libraries and on the ones
I've checked that have no issues linking the protection is default:

$ LANG=C readelf -a /gnu/store/3b65jkdm5ip7j9j0xarzpp8iyqfgq0m7-x265-3.5/lib/libx265.so.199 | grep x265_api_get
   827: 0009d500   322 FUNC    GLOBAL DEFAULT   12 x265_api_get_199

or

$ LANG=C readelf -a /gnu/store/8f9irjzk1zcg8z97p4zw239hnqn0plqk-xvid-1.3.7/lib/libxvidcore.so.4.3 | grep xvid_global
    33: 00015790  4010 FUNC    GLOBAL DEFAULT   12 xvid_global

while on openal it is 'protected':

$ LANG=C readelf -a /gnu/store/j4qdsqxb95yllkby0w2dx6d9lib24zmn-openal-1.23.1/lib/libopenal.so.1.23.1 | grep alGetErro
000fd45c  0000f001 R_386_32          00026a80   alGetError
   240: 00026a80   246 FUNC    GLOBAL PROTECTED   12 alGetError

Since, however, pointer equality is not needed as the above code only
tries to check if it can get a non null pointer to the given function
and the code is not meant to be run, I believe it would be safe in this
case to bypass this safety check[2] and force configure to succeed
(we already now that openal was found).

So I've bypassed this check here by adding a 'true' clause and then it
configures and builds fine.

However, when running tests it fails the checkasm_audiodsp test with
the following error:

checkasm: using random seed 3387428695
SSE:
 - audiodsp.audiodsp [OK]
SSE2:
 - audiodsp.audiodsp [OK]
SSSE3:
   audiodsp.vector_clip_int32_ssse3 (audiodsp.c:112)
 - audiodsp.audiodsp [FAILED]
checkasm: 1 of 4 tests have failed
threads=1

This _could_ be a hardware error here, but line 112 of audiodsp.c is
also doing some pointer comparison and, well it's doing some audio
vector thingy so afaik it could also be related.

So what I'm tending to now is to create a separate openal-for-ffmpeg
package definition, patching its CMakeLists.txt at line 350 whe it
tries to check if gcc has protected or default visibility support,
remove that setting and conditionaly enable this alternate package
when building on i686.

Does that make sense?

I'll try that and report back if no one shows a better solution[3].

Cheers,

1. https://sourceware.org/bugzilla/show_bug.cgi?id=28875
2. https://sourceware.org/bugzilla/show_bug.cgi?id=29512
3. AKA, is there a similar simple and effetive test for dynamic
symbols that does not rely on pointer references?


  reply	other threads:[~2024-08-26 14:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-21 20:43 Merging ‘core-updates’ real soon Ludovic Courtès
2024-08-21 22:07 ` Kaelyn
2024-08-22 15:39   ` Ludovic Courtès
2024-08-22  9:50 ` Andreas Enge
2024-08-26 14:33   ` André Batista [this message]
2024-08-27 19:04     ` André Batista
2024-08-28 16:48       ` André Batista
2024-08-28 18:56         ` Kaelyn
2024-08-29 23:41           ` André Batista
2024-08-22 12:07 ` Ricardo Wurmus
2024-08-22 13:00   ` Andreas Enge
2024-08-22 17:51 ` Roman Scherer
  -- strict thread matches above, loose matches on Subject: below --
2024-08-22 19:12 nathan via Development of GNU Guix and the GNU System distribution.
2024-08-25 18:19 ` John Kehayias
2024-08-28 21:16   ` Ludovic Courtès
2024-08-29  9:17     ` Ludovic Courtès
2024-08-29 19:53       ` Ludovic Courtès
2024-08-29 21:05         ` Kaelyn
2024-08-29 21:53         ` Nicolas Goaziou via Development of GNU Guix and the GNU System distribution.
2024-08-30  8:16           ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZsySVP8D9pMVWJwy@andel \
    --to=nandre@riseup.net \
    --cc=andreas@enge.fr \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.