libsdl-org / SDL_image

Image decoding for many popular formats for Simple Directmedia Layer.
zlib License
513 stars 174 forks source link

Failure to build SDL3_image #426

Closed gruelingpine185 closed 5 months ago

gruelingpine185 commented 5 months ago

SDL3_image fails to compile and errors with a "unknown type name 'SDL_Version'; did you mean 'SDL_version'?". I didn't do much digging, but I glanced at the most recent commit in this repo and it said something about updating for recent SDL3 changes. I'm guessing SDL_Version -> SDL_version was part of those changes? Here is the output for trying to build it.

sdl_image main ➜ cmake -S . -B build
-- The C compiler identification is AppleClang 15.0.0.15000100
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring SDL3_image 3.0.0
-- Performing Test CHECK_CPU_ARCHITECTURE_X64
-- Performing Test CHECK_CPU_ARCHITECTURE_X64 - Success
-- Linker identification: GNUlike
-- Performing Test LINKER_SUPPORTS_VERSION_SCRIPT
-- Performing Test LINKER_SUPPORTS_VERSION_SCRIPT - Failed
-- Performing Test HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS
-- Performing Test HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS - Success
-- libavif-1.0 or compatible not found
-- libavif NOT found
-- Found TIFF: /usr/local/lib/libtiff.dylib (found version "4.6.0")
-- SDL3_image: Using system libtiff
-- Dynamic libtiff: libtiff.6.dylib
-- Could NOT find webp (missing: webp_LIBRARY webp_INCLUDE_PATH webpdemux_LIBRARY webpdemux_INCLUDE_PATH)
-- libwebp NOT found
-- Found Perl: /usr/bin/perl (found version "5.30.3")
-- SDL3_image backends:
-- - enabled:  stb imageio bmp gif jpg lbm pcx png pnm qoi svg tga tif xcf xpm xv
-- - disabled: wic avif jxl webp
-- Configuring done (2.3s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/gruelingpine/projects/splash/vendor/sdl_image/build
sdl_image main ➜ cd build
sdl_image/build main ➜ ls
CMakeCache.txt          CPackProjectConfig.cmake    SDL3_imageConfig.cmake      dummy.sym
CMakeFiles          CPackSourceConfig.cmake     SDL3_imageConfigVersion.cmake   sdl3-image.pc
CPackConfig.cmake       Makefile            cmake_install.cmake
sdl_image/build main ➜ make
[  3%] Building C object CMakeFiles/SDL3_image-shared.dir/src/IMG.c.o
In file included from /Users/gruelingpine/projects/splash/vendor/sdl_image/src/IMG.c:24:
/Users/gruelingpine/projects/splash/vendor/sdl_image/include/SDL3_image/SDL_image.h:88:23: error: unknown type name 'SDL_Version'; did you mean 'SDL_version'?
extern DECLSPEC const SDL_Version * SDLCALL IMG_Linked_Version(void);
                      ^~~~~~~~~~~
                      SDL_version
/usr/local/include/SDL3/SDL_version.h:56:3: note: 'SDL_version' declared here
} SDL_version;
  ^
/Users/gruelingpine/projects/splash/vendor/sdl_image/src/IMG.c:93:7: error: unknown type name 'SDL_Version'; did you mean 'SDL_version'?
const SDL_Version *IMG_Linked_Version(void)
      ^~~~~~~~~~~
      SDL_version
/usr/local/include/SDL3/SDL_version.h:56:3: note: 'SDL_version' declared here
} SDL_version;
  ^
/Users/gruelingpine/projects/splash/vendor/sdl_image/src/IMG.c:95:12: error: unknown type name 'SDL_Version'; did you mean 'SDL_version'?
    static SDL_Version linked_version;
           ^~~~~~~~~~~
           SDL_version
/usr/local/include/SDL3/SDL_version.h:56:3: note: 'SDL_version' declared here
} SDL_version;
  ^
3 errors generated.
make[2]: *** [CMakeFiles/SDL3_image-shared.dir/src/IMG.c.o] Error 1
make[1]: *** [CMakeFiles/SDL3_image-shared.dir/all] Error 2
make: *** [all] Error 2
gruelingpine185 commented 5 months ago

May I make a PR to update the SDL_Version to SDL_version and hopefully fix the build issues?

sezero commented 5 months ago

Your SDL3 is not up-to-date: update from SDL main branch, delete all caches and retry, please.

gruelingpine185 commented 5 months ago

Am I doing this right? My folder structure looks like this:

splash player $✘!+? ➜ tree -L 2
.
├── Makefile
├── bin
│   ├── game.o
│   ├── main.o
│   ├── splash
│   └── window.o
├── compile_commands.json
├── inc
│   ├── game.h
│   ├── paddle.h
│   ├── rect.h
│   ├── utils.h
│   └── window.h
├── res
│   └── paddle.png
├── src
│   ├── game.cpp
│   ├── main.cpp
│   ├── paddle.cpp
│   ├── rect.cpp
│   └── window.cpp
└── vendor
    ├── compile_commands.json
    ├── sdl3
    └── sdl_image

I do a git pull which updated the SDL repo and I (from root) did git rm --cached vendor/sdl* which should capture both vendor/sdl3/ and vendor/sdl_image/. I rebuilt them both and I still get the "unknown type name 'SDL_Version'" error as above.


Sorry for the late response, I had to be somewhere.

madebr commented 5 months ago

When you're using git submodules, you need to make sure those are updated as well.

git submodule update --recursive

Then, you need to cd into each dependency and checkout the latest commit on the main branch.