Open rroa opened 10 years ago
Bump! @gsathya
The build fails in part because of a hard coded reference to the autotools version in the configure file.
I attempted to re-run automake but then a lot of required files were missing. I also changed the version number to am__api_version but that didn't do the trick.
I'm not sure why this is happening >.>
This is how I build sdl2-image -
➜ tmp: pwd
/Users/mozilla/tmp
➜ tmp: git clone https://github.com/gsathya/SDL-emscripten.git
Cloning into 'SDL-emscripten'...
remote: Counting objects: 78394, done.
remote: Compressing objects: 100% (38725/38725), done.
remote: Total 78394 (delta 37172), reused 78394 (delta 37172)
Receiving objects: 100% (78394/78394), 115.18 MiB | 415.00 KiB/s, done.
Resolving deltas: 100% (37172/37172), done.
Checking connectivity... done.
➜ tmp: cd SDL-emscripten
➜ SDL-emscripten: emconfigure ./configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2" --prefix=/Users/mozilla/tmp/sdl-build
checking build system type... x86_64-apple-darwin13.3.0
checking host system type... asmjs-unknown-emscripten
[...]
-en SDL2 Configure Summary:
Building Static Libraries
Enabled modules : atomic audio video render events joystick haptic power filesystem timers file loadso
Assembly Math :
Audio drivers : emscripten disk dummy
Video drivers : emscripten dummy opengl_es2
Input drivers :
Using libudev : NO
Using dbus : NO
➜ SDL-emscripten: emmake make
/bin/sh build-scripts/mkinstalldirs build
mkdir -p -- build
/bin/sh build-scripts/updaterev.sh
[...]
➜ SDL-emscripten: emmake make install
/bin/sh build-scripts/updaterev.sh
/bin/sh build-scripts/mkinstalldirs /Users/mozilla/tmp/sdl-build/bin
mkdir -p -- /Users/mozilla/tmp/sdl-build/bin
[...]
➜ SDL-emscripten: cd ..
➜ tmp: git clone git@github.com:gsathya/sdl2-image.git
Cloning into 'sdl2-image'...
remote: Counting objects: 3887, done.
remote: Total 3887 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3887/3887), 40.63 MiB | 1.13 MiB/s, done.
Resolving deltas: 100% (2018/2018), done.
Checking connectivity... done.
➜ tmp: cd sdl2-image
➜ sdl2-image: emconfigure ./configure --disable-sdltest --with-sdl-prefix=/Users/mozilla/tmp/sdl-build --prefix=/Users/mozilla/tmp/sdl2-image-build
checking build system type... x86_64-apple-darwin13.3.0
[...]
➜ sdl2-image: emmake make
[..]
➜ sdl2-image: emmake make install
./install-sh -c -d '/Users/mozilla/tmp/sdl2-image-build/lib'
/bin/sh ./libtool --mode=install /usr/bin/install -c libSDL2_image.la '/Users/mozilla/tmp/sdl2-image-build/lib'
libtool: install: /usr/bin/install -c .libs/libSDL2_image-2.0.0.dylib /Users/mozilla/tmp/sdl2-image-build/lib/libSDL2_image-2.0.0.dylib
libtool: install: (cd /Users/mozilla/tmp/sdl2-image-build/lib && { ln -s -f libSDL2_image-2.0.0.dylib libSDL2_image.dylib || { rm -f libSDL2_image.dylib && ln -s libSDL2_image-2.0.0.dylib libSDL2_image.dylib; }; })
libtool: install: /usr/bin/install -c .libs/libSDL2_image.lai /Users/mozilla/tmp/sdl2-image-build/lib/libSDL2_image.la
libtool: install: /usr/bin/install -c .libs/libSDL2_image.a /Users/mozilla/tmp/sdl2-image-build/lib/libSDL2_image.a
libtool: install: chmod 644 /Users/mozilla/tmp/sdl2-image-build/lib/libSDL2_image.a
libtool: install: /Users/mozilla/Documents/emscripten/emranlib /Users/mozilla/tmp/sdl2-image-build/lib/libSDL2_image.a
----------------------------------------------------------------------
Libraries have been installed in:
/Users/mozilla/tmp/sdl2-image-build/lib
[...]
Also, the README-emscripten.txt has an ambiguous reference to a path that needs clarification. What's --prefix=/path/to/install? Is it the path to the current sdl2-image cloned repo?
This is the path where you want sdl2-image headers to be stored (if you don't want to store it in /usr/local/{bin, include, lib}). In the above example the headers are in /Users/mozilla/tmp/sdl2-image-build
.
Thanks for your response. @gsathya
Here's the error I get when I try to make:
➜sdl2-image: emmake make CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /home/raulroa/Code/libraries/sdl2-image/missing aclocal-1.13 /home/raulroa/Code/libraries/sdl2-image/missing: line 81: aclocal-1.13: command not found WARNING: 'aclocal-1.13' is missing on your system. You should only need it if you modified 'acinclude.m4' or 'configure.ac' or m4 files included by 'configure.ac'. The 'aclocal' program is part of the GNU Automake package: http://www.gnu.org/software/automake It also requires GNU Autoconf, GNU m4 and Perl in order to run: http://www.gnu.org/software/autoconf http://www.gnu.org/software/m4/ http://www.perl.org/ make: *\ [aclocal.m4] Error 127
/home/raulroa/Code/libraries/sdl2-image/missing: line 81: aclocal-1.13: command not found
Sounds like you don't have aclocal. Try apt-get install autotools-dev automake
?
Thanks again for your fast response @gsathya.
I do have autotools and automake installed. Like I said in my original message the issue had to do with a version mismatch of the tools used to generate the Makefile.
Investigating deeper I found out that there are actual subtle changes between the 1.13 and 1.14 versions of autotools & automake (attention to AM_INIT_AUTOMAKE). I was able to overcome this by running autoreconf & automake
Here's the reference to that:
I ran make after these changes and then stepped into a new issue. I was getting this error:
mv -f .deps/IMG.Tpo .deps/IMG.Plo mv: cannot stat ‘.deps/IMG.Tpo’: No such file or directory make: *\ [IMG.lo] Error 1
To overcome this I did the following:
➜sdl2-image: cd .deps
➜sdl2-image/.deps: touch renamer
➜sdl2-image/.deps: pico renamer
for file in *.Plo; do
cp "$file" "basename $file .Plo
.Tpo"
done
➜sdl2-image/.deps: chmod +x renamer
➜sdl2-image/.deps: ./renamer
➜sdl2-image/.deps: cp showimage.Po showimage.Tpo
➜sdl2-image/.deps: cd ..
➜sdl2-image: emmake make
showimage.c:46:83: error: no member named 'a' in 'struct SDL_Color' SDL_SetRenderDrawColor(renderer, col[i].r, col[i].g, col[i].b, col[i].a);
showimage.c:79:9: error: implicit declaration of function 'SDL_CreateWindowAndRenderer' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
if (SDL_CreateWindowAndRenderer(0, 0, flags, &window, &renderer) < 0) {
^
showimage.c:79:9: note: did you mean 'SDL_CreateSoftwareRenderer'?
if (SDL_CreateWindowAndRenderer(0, 0, flags, &window, &renderer) < 0) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~
SDL_CreateSoftwareRenderer
/home/raulroa/Code/xcompiler/emscripten/system/include/SDL/SDL_render.h:174:40: note: 'SDL_CreateSoftwareRenderer' declared here
extern DECLSPEC SDL_Renderer \* SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface \* surface);
^
showimage.c:96:19: error: implicit declaration of function 'IMG_LoadTexture' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
texture = IMG_LoadTexture(renderer, argv[i]);
^
showimage.c:96:19: note: did you mean 'SDL_LockTexture'?
texture = IMG_LoadTexture(renderer, argv[i]);
^~~~~~~~~~~~~~~
SDL_LockTexture
/home/raulroa/Code/xcompiler/emscripten/system/include/SDL/SDL_render.h:361:29: note: 'SDL_LockTexture' declared here
extern DECLSPEC int SDLCALL SDL_LockTexture(SDL_Texture \* texture,
^
showimage.c:96:17: warning: incompatible integer to pointer conversion assigning to 'SDL_Texture _' (aka 'struct SDL_Texture *') from 'int' [-Wint-conversion]
texture = IMG_LoadTexture(renderer, argv[i]);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 3 errors generated.
ERROR root: compiler frontend failed to generate LLVM bitcode, halting
make: *_\* [showimage.o] Error 1
It looks like the references made using the configure are not maintained and the make tries to use Emscripten's SDL 1.3
Ok. So I modified the Makefile and added the extra flags for the compiler to find my SDL2/includes. Finally the library seems to compile.
Sadly the only thing at the build/lib directory is the pkg-config file.
I recently hit a very similar problem and it actually appears to be an issue with the timestamps when you clone a repo. For example, you may not actually need all the automake tools installed to build SDL2_image (this machine doesn't have them and it builds fine).
This is at least true when I get the files directly from the zip. But if I add all the files to a repo, and then clone that repo elsewhere, it now fails to build. (The zip actually contains a bunch of .gitignore files that initially cause differences but once you sort that out it still doesn't work). All of the files in both trees are identical and none are missing from either side yet the clone fails to build. I think what is happening is that the .in/.am/*.ac/ etc files modified times have now all changed and the configure script detects that and tried to reconfigure. But the problem was actually that the dates and the relative ordering was damaged in the original commit.
This is further complicated by the fact that Ubuntu doesn't seem to support installing the exact version of autotools required (and there are apparently some differences with 1.14). If someone has actually sorted this out so that they can get the build files out of a git repo with the modified dates intact (to avoid pulling in the automake dependency), I would love to hear about it.
in SDL2 and SDL2-image in emscripten ports (used on incoming branch with USE_SDL=2
and USE_SDL_IMAGE=2
, autotools are not invoked, so this should not be an issue.
@kripken could you describe the process of building SDL_IMAGE manually, without using autotools?
Here is the code in ports that builds it,
https://github.com/kripken/emscripten/blob/master/tools/ports/sdl_image.py
It literally just compiles the necessary files, and links them (with the right include path).
I had the same problem while building, the solution was simple before configure, call autogen.sh
The build fails in part because of a hard coded reference to the autotools version in the configure file.
I attempted to re-run automake but then a lot of required files were missing. I also changed the version number to am__api_version but that didn't do the trick.
Also, the README-emscripten.txt has an ambiguous reference to a path that needs clarification. What's --prefix=/path/to/install? Is it the path to the current sdl2-image cloned repo?