[FFmpeg-devel] Can't use __musl__ macro

Brad Smith brad at comstyle.com
Fri Aug 30 14:28:53 EEST 2024


On 2024-08-30 7:07 a.m., Ramiro Polla wrote:
>
> On 2024-08-30 05:50, Brad Smith wrote:
>> On 2024-08-29 9:47 a.m., Ramiro Polla wrote:
>>> On Mon, Aug 12, 2024 at 7:16 AM Lance Fredrickson
>>> <lancethepants at gmail.com>  wrote:
>>>> In commit 9e674b31606c805dd31b4bb754364a72a5877238 of ffmpeg this 
>>>> change
>>>> tries to detect musl libc by way of a "__musl__" macro. This macro
>>>> however, doesn't exist in musl. This results in an "incompatible 
>>>> pointer
>>>> type" error under gcc-14.2 as detection falls through to the #else
>>>> definition. This was in version 6.1.2 and looks like it is still 
>>>> present
>>>> in master.  I can't say what the correct fix would be, I just manually
>>>> patched for now.
>>> musl tries to make itself undetectable. Instead of relying on system
>>> #ifdefs which may or may not be correct, we should instead check for
>>> the proper signature at configure time.
>>>
>>> I sent a patch for this (look for the thread "[PATCH] configure:
>>> improve check for POSIX ioctl").
>>>
>>> I tested it with musl, glibc, and the android ndk. Brad, could you
>>> test that this works as expected on BSD?
>>
>> Here is the config output.. test_code cc sys/ioctl.h int ioctl(int, 
>> int, ...); test_cc BEGIN /tmp/ffconf.of6GnZkt/test.c 1 #include 
>> <sys/ioctl.h> 2 int main(void) { int ioctl(int, int, ...);; return 0; 
>> } END /tmp/ffconf.of6GnZkt/test.c cc -D_ISOC11_SOURCE 
>> -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -std=c17 
>> -fomit-frame-pointer -fPIC -I/usr/X11R6/include -I/usr/X11R6/include 
>> -I/usr/X11R6/include -pthread -I/usr/X11R6/include 
>> -I/usr/X11R6/include/libdrm -c -o /tmp/ffconf.of6GnZkt/test.o 
>> /tmp/ffc onf.of6GnZkt/test.c /tmp/ffconf.of6GnZkt/test.c:2:22: error: 
>> conflicting types for 'ioctl' int main(void) { int ioctl(int, int, 
>> ...);; return 0; } ^ /usr/include/sys/ioctl.h:52:5: note: previous 
>> declaration is here int ioctl(int, unsigned long, ...); ^ 1 error 
>> generated.
>>
>
> Thanks! I assume the build worked as well since configure detected 
> that it's not POSIX ioctl.

Ugh. Just looking at that from the archive I see that came out garbled 
for some reason.

Yes, the build completed and no warnings from v4l2.


More information about the ffmpeg-devel mailing list