[MacPorts] #69551: libsdl2_image error with gcc: error: attributes should be specified before the declarator in a function definition
MacPorts
noreply at macports.org
Wed Mar 20 17:32:27 UTC 2024
#69551: libsdl2_image error with gcc: error: attributes should be specified before
the declarator in a function definition
-----------------------------------------+---------------------------
Reporter: barracuda156 | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.9.1
Keywords: tiger, leopard, snowleopard | Port: libsdl2_image
-----------------------------------------+---------------------------
The error confirmed on Tiger and Snow Leopard when building with gcc:
{{{
libtool: compile: /opt/local/bin/gcc-mp-7 -DPACKAGE_NAME=\"SDL2_image\"
-DPACKAGE_TARNAME=\"SDL2_image\" -DPACKAGE_VERSION=\"2.8.2\"
"-DPACKAGE_STRING=\"SDL2_image 2.8.2\""
-DPACKAGE_BUGREPORT=\"https://github.com/libsdl-org/SDL_image/issues\"
-DPACKAGE_URL=\"\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1
-DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1
-DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1
-DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\"
-DSDL_BUILD_MAJOR_VERSION=2 -DSDL_BUILD_MINOR_VERSION=8
-DSDL_BUILD_MICRO_VERSION=2 -DPACKAGE=\"SDL2_image\" -DVERSION=\"2.8.2\"
-DUSE_STBIMAGE=1 -DLOAD_JPG=1 -DLOAD_PNG=1 -DLOAD_TIF=1 -DLOAD_WEBP=1
-DLOAD_BMP=1 -DLOAD_GIF=1 -DLOAD_LBM=1 -DLOAD_PCX=1 -DLOAD_PNM=1
-DLOAD_SVG=1 -DLOAD_TGA=1 -DLOAD_XCF=1 -DLOAD_XPM=1 -DLOAD_XV=1
-DLOAD_QOI=1 -DSDL_IMAGE_SAVE_PNG=1 -DSDL_IMAGE_SAVE_JPG=1 -I. -I./include
-I/opt/local/include -I/opt/local/include/webp -pipe -Os -arch ppc
-DSDL_IMAGE_USE_COMMON_BACKEND -D_THREAD_SAFE -I/opt/local/include/SDL2
-Wall -fvisibility=hidden -MT src/libSDL2_image_la-IMG_webp.lo -MD -MP -MF
src/.deps/libSDL2_image_la-IMG_webp.Tpo -c src/IMG_webp.c -fno-common
-DPIC -o src/.libs/libSDL2_image_la-IMG_webp.o
libtool: compile: /opt/local/bin/gcc-mp-7 -DPACKAGE_NAME=\"SDL2_image\"
-DPACKAGE_TARNAME=\"SDL2_image\" -DPACKAGE_VERSION=\"2.8.2\"
"-DPACKAGE_STRING=\"SDL2_image 2.8.2\""
-DPACKAGE_BUGREPORT=\"https://github.com/libsdl-org/SDL_image/issues\"
-DPACKAGE_URL=\"\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1
-DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1
-DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1
-DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\"
-DSDL_BUILD_MAJOR_VERSION=2 -DSDL_BUILD_MINOR_VERSION=8
-DSDL_BUILD_MICRO_VERSION=2 -DPACKAGE=\"SDL2_image\" -DVERSION=\"2.8.2\"
-DUSE_STBIMAGE=1 -DLOAD_JPG=1 -DLOAD_PNG=1 -DLOAD_TIF=1 -DLOAD_WEBP=1
-DLOAD_BMP=1 -DLOAD_GIF=1 -DLOAD_LBM=1 -DLOAD_PCX=1 -DLOAD_PNM=1
-DLOAD_SVG=1 -DLOAD_TGA=1 -DLOAD_XCF=1 -DLOAD_XPM=1 -DLOAD_XV=1
-DLOAD_QOI=1 -DSDL_IMAGE_SAVE_PNG=1 -DSDL_IMAGE_SAVE_JPG=1 -I. -I./include
-I/opt/local/include -I/opt/local/include/webp -pipe -Os -arch ppc
-DSDL_IMAGE_USE_COMMON_BACKEND -D_THREAD_SAFE -I/opt/local/include/SDL2
-Wall -fvisibility=hidden -MT src/libSDL2_image_la-IMG_stb.lo -MD -MP -MF
src/.deps/libSDL2_image_la-IMG_stb.Tpo -c src/IMG_stb.c -o src
/libSDL2_image_la-IMG_stb.o >/dev/null 2>&1
libtool: compile: /opt/local/bin/gcc-mp-7 -DPACKAGE_NAME=\"SDL2_image\"
-DPACKAGE_TARNAME=\"SDL2_image\" -DPACKAGE_VERSION=\"2.8.2\"
"-DPACKAGE_STRING=\"SDL2_image 2.8.2\""
-DPACKAGE_BUGREPORT=\"https://github.com/libsdl-org/SDL_image/issues\"
-DPACKAGE_URL=\"\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1
-DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1
-DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1
-DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\"
-DSDL_BUILD_MAJOR_VERSION=2 -DSDL_BUILD_MINOR_VERSION=8
-DSDL_BUILD_MICRO_VERSION=2 -DPACKAGE=\"SDL2_image\" -DVERSION=\"2.8.2\"
-DUSE_STBIMAGE=1 -DLOAD_JPG=1 -DLOAD_PNG=1 -DLOAD_TIF=1 -DLOAD_WEBP=1
-DLOAD_BMP=1 -DLOAD_GIF=1 -DLOAD_LBM=1 -DLOAD_PCX=1 -DLOAD_PNM=1
-DLOAD_SVG=1 -DLOAD_TGA=1 -DLOAD_XCF=1 -DLOAD_XPM=1 -DLOAD_XV=1
-DLOAD_QOI=1 -DSDL_IMAGE_SAVE_PNG=1 -DSDL_IMAGE_SAVE_JPG=1 -I. -I./include
-I/opt/local/include -I/opt/local/include/webp -pipe -Os -arch ppc
-DSDL_IMAGE_USE_COMMON_BACKEND -D_THREAD_SAFE -I/opt/local/include/SDL2
-Wall -fvisibility=hidden -MT src/libSDL2_image_la-IMG_xv.lo -MD -MP -MF
src/.deps/libSDL2_image_la-IMG_xv.Tpo -c src/IMG_xv.c -o src
/libSDL2_image_la-IMG_xv.o >/dev/null 2>&1
src/IMG_webp.c:74:1: error: attributes should be specified before the
declarator in a function definition
int IMG_InitWEBP()
^~~
make[1]: *** [src/libSDL2_image_la-IMG_webp.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
mv -f src/.deps/libSDL2_image_la-IMG_xv.Tpo src/.deps/libSDL2_image_la-
IMG_xv.Plo
make[1]: *** Waiting for unfinished jobs....
mv -f src/.deps/libSDL2_image_la-IMG_svg.Tpo src/.deps/libSDL2_image_la-
IMG_svg.Plo
mv -f src/.deps/libSDL2_image_la-IMG_stb.Tpo src/.deps/libSDL2_image_la-
IMG_stb.Plo
make[1]: Leaving directory
`/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libsdl2_image/libsdl2_image/work/SDL2_image-2.8.2'
make: *** [all-recursive] Error 1
}}}
This happens due to a wrong code in `IMG_webp.c`:
{{{
#ifdef __APPLE__
/* Need to turn off optimizations so weak framework load check works
*/
__attribute__ ((optnone))
#endif
}}}
Once this is removed, the port builds fine. So perhaps it is clang-only
and should be conditional, or otherwise some alternative fix is needed.
--
Ticket URL: <https://trac.macports.org/ticket/69551>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list