Opened 3 years ago

Last modified 6 days ago

#61696 assigned defect

transcode @1.1.7: error: implicit declaration of function 'audio_resample_close' is invalid in C99

Reported by: mf2k (Frank Schima) Owned by: Liontooth (David Liontooth)
Priority: Normal Milestone:
Component: ports Version:
Keywords: catalina bigsur monterey ventura sonoma Cc: dbevans (David B. Evans), MaurizioLoreti, bunk3m (Bunk3m)
Port: transcode

Description (last modified by mf2k (Frank Schima))

Xcode 12.4. Big Sur.

I believe this is the first error:

:info:build filter_resample.c:153:9: error: implicit declaration of function 'audio_resample_close' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
:info:build         audio_resample_close(pd->resample_ctx);
:info:build         ^

Attachments (1)

main.log (601.2 KB) - added by mf2k (Frank Schima) 3 years ago.

Download all attachments as: .zip

Change History (11)

Changed 3 years ago by mf2k (Frank Schima)

Attachment: main.log added

comment:1 Changed 3 years ago by mf2k (Frank Schima)

Description: modified (diff)

comment:2 Changed 3 years ago by mf2k (Frank Schima)

Description: modified (diff)

comment:3 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: MaurizioLoreti added
Keywords: catalina bigsur monterey added

Has duplicate #63798.

comment:4 Changed 2 weeks ago by ryandesign (Ryan Carsten Schmidt)

Cc: bunk3m added
Keywords: ventura sonoma added
Summary: transcode: error: implicit declaration of function 'audio_resample_close' is invalid in C99transcode @1.1.7: error: implicit declaration of function 'audio_resample_close' is invalid in C99

Has duplicates #65747 and #69660.

comment:5 Changed 13 days ago by kencu (Ken)

some updates found here:

http://git.pld-linux.org/?p=packages/transcode.git

nixos just disables ffmpeg now:

https://github.com/NixOS/nixpkgs/blob/release-23.11/pkgs/applications/audio/transcode/default.nix

disabling ffmpeg looks tempting if no other fix shows up for the ffmpeg changes.

or perhaps just dump this ancient port, dead upstream

comment:6 Changed 9 days ago by kencu (Ken)

this works, although frowned upon of course:

configure.cppflags-append -Wno-implicit-function-declaration
% port -v installed transcode
The following ports are currently installed:
  transcode @1.1.7_29+a52dec+experimental+faac+freetype+full+imagemagick+libdv+libogg+libpostproc+libquicktime+libsdl+libtheora+libvorbis+libxml2+lzo+mjpegtools+x11+x264+xvid (active) requested_variants='' platform='darwin 21' archs='x86_64' date='2024-04-30T22:48:41-0700'

I have not been (able / willing / patient enough) to sort out how to add all the proper function declarations to the code. I tried for a while.

comment:7 in reply to:  6 Changed 9 days ago by ryandesign (Ryan Carsten Schmidt)

Replying to kencu:

this works, although frowned upon of course:

configure.cppflags-append -Wno-implicit-function-declaration

CPPFLAGS are used for both C and C++ code but implicit function declarations are a C compiler warning. That flag should not be used for C++ code. (clang++ does not warn but g++ does: cc1plus: warning: command-line option '-Wno-implicit-function-declaration' is valid for C/ObjC but not for C++)

Instead of turning off the warning entirely, it's better to turn the error back into a warning with -Wno-error=implicit-function-declaration. If we disable the error, we should also mark the port as incompatible with arm64.

If you have a patch for your work in progress on quashing these issues, please attach it!

comment:8 Changed 7 days ago by kencu (Ken)

builds on macOS 12.7 x86_64 at least.

needs some testing, but ... should work as well it is does anywhere else, as there are no actual code changes, just function definitions added.

https://github.com/macports/macports-ports/pull/23818

comment:9 Changed 6 days ago by ryandesign (Ryan Carsten Schmidt)

I was looking into this too but what I found was that the ffmpeg audio resample API being used here was deprecated in 2013 and removed from ffmpeg in 2017 in version 4.0. I would imagine that any attempt to by transcode to actually call these functions will cause a runtime crash since the functions do not exist anymore. The function call is in filter_resample.so. I gather this filter has to do with changing the sample rate of audio. I wanted to try to provoke that crash by using transcode to convert a video and change its sample rate, but I couldn't even figure out how to convert a video at all.

If you can get it to work, and it doesn't crash, and we want to keep ffmpeg support, then we might add this patch from arch linux that we haven't yet copied (I added it to my copy of the port already before realizing the above):

https://gitlab.archlinux.org/archlinux/packaging/packages/transcode/-/blob/36df429f94b00b8b209dcd7bd2303c255ebdd225/transcode-swresample.patch

However if this filter crashes, we should remove it. And if we can't figure out how to convert any video with transcode and ffmpeg, then we could disable the ffmpeg support like some Linux distributions have (despite the statement in the README that ffmpeg is not optional). They said the code being used here was removed in ffmpeg 5.0. We could also delete the port (and the three ports that depend on it) entirely, as you suggested above and as the other Linux distributions (those that haven't just disabled its ffmpeg support) have done.

comment:10 Changed 6 days ago by kencu (Ken)

Indeed, all I did was get this to build by adding in the missing function definitions, but it is quite possible that parts of this that use ffmpeg have been broken for a long long time now, including on the systems where it builds now.

I glanced at moving this software to the new ffmpeg resampling API and found it not something I wanted to take on. The transcode-swresample.patch you found would not seem to be enough to do that (all the old functions are still being called, for example), but I didn't test.

The patches I used are left behind in the PR if you find them of any use.

Note: See TracTickets for help on using tickets.