GIMP | Argument -Wimplicit-function-declaration incompatible with Mac M1 arm64? (#6954)
Ryan Schmidt
ryandesign at macports.org
Sat Jun 12 00:12:12 UTC 2021
The short answer is that the gimp2 port should indicate that the implicit declaration of strchr is not a problem by adding this line to the Portfile:
configure.checks.implicit_function_declaration.whitelist-append strchr
I've made this change:
https://github.com/macports/macports-ports/commit/10089b4bc0113fb796b8c90182a2a7fb1b839998
The long answer:
clang in Xcode 12 and later consider implicit declaration of functions an error. This can cause software that doesn't include the required headers to fail to build, but can also cause configure test failures that are much harder to detect. Therefore MacPorts was enhanced in version 2.7.0 to make such configure test failures more evident. That's what the "Configuration logfiles contain indications of -Wimplicit-function-declaration; check that features were not accidentally disabled" MacPorts warning is about.
In the case of gimp2, the config.log shows that the specific failure is:
configure:33282: checking for /usr/bin/clang options needed to detect all undeclared functions
configure:33304: /usr/bin/clang -c -pipe -Os -arch x86_64 -Wall -Wdeclaration-after-statement -Wmissing-prototypes -Werror=missing-prototypes -Wstrict-prototypes -Wmissing-declarations -Winit-self -Wpointer-arith -Wold-style-definition -Wmissing-format-attribute -Wformat-security -Wtype-limits -fno-common -fdiagnostics-show-option -Wreturn-type -I/opt/local/include conftest.c >&5
conftest.c:81:8: error: implicitly declaring library function 'strchr' with type 'char *(const char *, int)' [-Werror,-Wimplicit-function-declaration]
(void) strchr;
^
conftest.c:81:8: note: include the header <string.h> or explicitly provide a declaration for 'strchr'
1 error generated.
So this configure test is *deliberately* not including the header required for strchr in order to see how the compiler reacts to that. This appears to be a new standard test in autoconf 2.71. So any other port whose autotools build system was built with that new version of autoconf or any port like gimp2 that regenerates its autotools build system with MacPorts autoconf (which is new enough to include this new test) will need to indicate that a failure to find strchr is not a problem, as shown above.
Advice for other implicit function declaration situations:
Most detected implicit declarations of functions do indicate that a required header wasn't included and should be fixed the usual way, by including that header, as previously discussed.
A third possibility is that the configure script checks for functions that simply don't exist on macOS. In that case, the configure script is working correctly to identify the features of the OS. Those functions which configure scripts check for which don't exist on macOS should be listed in the files the ports tree in _resources/port1.0/checks/implicit_function_declaration/ so that each affected port doesn't need to whitelist those functions. I'll create empty placeholder files there now.
On Jun 10, 2021, at 19:47, Peter West wrote:
> As advised by some previous messages regarding -Wimplicit-function-declaration, I reported this to Gimp bugs, and I received the reply below.
>
> As mentioned in the response, gimp2 built for me, but hung on startup.
>
> There’s a question here about the use of gimp-macos-build scripts and jhbuild, which I cannot answer.
>
> Should this question go onto the dev list?
>
> I am reluctant to get into the weeds of the gimp build, as I’ve never built anything complex on Mac before, but if no-one else is in a position to do so, I may have to. Any other M1 users who would like to see Gimp native, please put your hand up.
>
>
> —
> Peter West
> pbw at ehealth.id.au
> “…whoever says, ‘You fool!’ will be liable to the hell of fire.”
>
>> Begin forwarded message:
>>
>> From: "Jehan (@Jehan)"
>> Subject: Re: GIMP | Argument -Wimplicit-function-declaration incompatible with Mac M1 arm64? (#6954)
>> Date: 10 June 2021 at 5:28:42 pm AEST
>> To: pbw at pbw.id.au
>> Reply-To: GNOME / GIMP <incoming+33b1afd72909024031f4a147c254c88d at gitlab.gnome.org>
>>
>> Jehan commented:
>>
>> Hi @p-b-west !
>>
>> The build log includes this warning. Warning: Configuration logfiles contain indications of -Wimplicit-function-declaration; check that features were not accidentally disabled: strchr: found in gimp-2.10.22/config.log finite: found in gimp-2.10.22/config.log
>>
>> Well you are our best bet to find the solution to this! Most of devs here don't use macOS which is why we have a hard time even providing the non-M1 build, even less the M1 one! 😕
>>
>> In any case, yes there are a bunch of strchr in the code (both core and in plug-ins, as can be checked by a grep through code), so if it turns out this function is not available/disabled or that something needs to be done to have it on the build, you'd be the best fit to investigate it, especially since you at least got a first build to complete!
>>
>> The other people who worked on a macOS build and who may be able to help are: @samm-git and @DesMcGuinness (for the main macOS build) and @evultrole who worked on the M1 build, though I don't know what the status is now (see #5288).
>>
>> By the way, does the MacPorts build use our gimp-macos-build scripts with jhbuild? Something different? Because obviously we are particularly interested to also have a working upstream M1 build!
>>
>> —
>> Reply to this email directly or view it on GitLab.
>> You're receiving this email because you have been mentioned on gitlab.gnome.org. If you'd like to receive fewer emails, you can unsubscribe from this thread or adjust your notification settings.
>>
>
More information about the macports-users
mailing list