Closed barracuda156 closed 2 months ago
This code in the source breaks build with gcc: https://github.com/libsdl-org/SDL_image/blob/39c8ebb0e912d072005771dc4f2317930c51c081/src/IMG_webp.c#L75-L79
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, however, works fine:
--- src/IMG_webp.c 2024-01-02 05:35:11.000000000 +0800 +++ src/IMG_webp.c 2024-03-31 17:21:16.000000000 +0800 @@ -71,11 +71,11 @@ if (lib.FUNC == NULL) { IMG_SetError("Missing webpdemux.framework"); return -1; } #endif -int IMG_InitWEBP() #ifdef __APPLE__ /* Need to turn off optimizations so weak framework load check works */ __attribute__ ((optnone)) #endif +int IMG_InitWEBP() { if (lib.loaded == 0) { #if defined(LOAD_WEBP_DYNAMIC) && defined(LOAD_WEBPDEMUX_DYNAMIC)
This code in the source breaks build with gcc: https://github.com/libsdl-org/SDL_image/blob/39c8ebb0e912d072005771dc4f2317930c51c081/src/IMG_webp.c#L75-L79
This, however, works fine: