You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good day and I'm new to emscripten. I use archlinux to create my programs and build stuffs with SDL2 and I installed emscripten to port my game to the web. The compilation works well when I only modified settings to build with SDL2 only. However, when I tried to set my SDL2_Image, SDL2_Mixer and SDL2_TTF, I get an encounter with this error.
Emscripten Version:
3.1.71-git
cache:INFO: generating port: sysroot/lib/wasm32-emscripten/libSDL2_image_png.a... (this will be cached in "/home/fruitpunch/.cache/emscripten/sysroot/lib/wasm32-emscripten/libSDL2_image_png.a" for subsequent builds)
Traceback (most recent call last):
File "/usr/lib/emscripten/emcc.py", line 1639, in <module>
Traceback (most recent call last):
Traceback (most recent call last):
File "/usr/lib/emscripten/emcc.py", line 1639, in <module>
File "/usr/lib/emscripten/emcc.py", line 1639, in <module>
sys.exit(main(sys.argv))
sys.exit(main(sys.argv))
^^^^^^^^^^^^^^
^^^^^^^^^^^^^^
File "/usr/lib/python3.12/contextlib.py", line 81, in inner
File "/usr/lib/python3.12/contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
return func(*args, **kwds)
File "/usr/lib/emscripten/emcc.py", line 1632, in main
sys.exit(main(sys.argv))
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/emscripten/emcc.py", line 1632, in main
^^^^^^^^^^^^^^
File "/usr/lib/python3.12/contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/emscripten/emcc.py", line 1632, in main
Traceback (most recent call last):
File "/usr/lib/emscripten/emcc.py", line 1639, in <module>
Traceback (most recent call last):
File "/usr/lib/emscripten/emcc.py", line 1639, in <module>
ret = run(args)
^^^^^^^^^
File "/usr/lib/emscripten/emcc.py", line 675, in run
ret = run(args)
^^^^^^^^^
File "/usr/lib/emscripten/emcc.py", line 675, in run
ret = run(args)
^^^^^^^^^
This is my makefile I've wrote at the moment when building my web game.
#################################################### Written by acerstructor###################################################TARGET = CONSOLETEMPLATE_C
# C COMPILER CONFIG# ---------------------CC =gcc
CFLAGS =-Wall -std=c99
# Output fileOUT = ${TARGET}${SUFFIX}
# BUILD TYPE: RELEASE | DEBUG (Default)BUILD_TYPE ?=DEBUG
# PLATFORMS# ---------------------# WINDOWS# WEB# LINUX (Default)PLATFORM ?=LINUX
# PROGRAM ARCHITECTURE : X86 | X64 (Default)ARCHITECTURE ?=X64
# Output DirectoryBIN_DIR :=bin
# DirectoriesSRC_DIR :=src
OBJ_DIR :=obj
RES_DIR :=res
# Find all .c files inside SRC_DIR and its subdirectoriesSRC_SUBDIRS =$(wildcard$(SRC_DIR)/*/ $(SRC_DIR)/*/*/)SRC =$(wildcard$(SRC_DIR)/*.c $(SRC_DIR)/*/*.c $(SRC_DIR)/*/*/*.c)# Define corresponding .o files in OBJ_DIROBJ_SUBDIRS =$(patsubst$(SRC_DIR)/%, $(OBJ_DIR)/%, $(SRC_SUBDIRS))OBJ =$(patsubst$(SRC_DIR)/%.c, $(OBJ_DIR)/%.o, $(SRC))SDL2_CONFIG =sdl2-config
PKG_CONFIG =pkg-config
# Check what platform is selected for build process# COMPILER CONFIGURATIONifeq ($(PLATFORM), WINDOWS)
# COMPILER CONFIG FOR WINDOWS 64 BIT
CC =x86_64-w64-mingw32-gcc
SDL2_CONFIG =x86_64-w64-mingw32-sdl2-config
PKG_CONFIG =x86_64-w64-mingw32-pkg-config
# if ARCHITECTURE is set to 32bit
ifeq ($(ARCHITECTURE), X86)
# COMPILER CONFIG FOR WINDOWS 32 BIT
CC =i686-w64-mingw32-gcc
SDL2_CONFIG =i686-w64-mingw32-sdl2-config
PKG_CONFIG =i686-w64-mingw32-pkg-config
endif
SUFFIX=.exe
else ifeq ($(PLATFORM), WEB)
# COMPILER CONFIG FOR WEB
CC =emcc
EMFLAGS =-sUSE_SDL=2 -sUSE_SDL_TTF=2 -sUSE_SDL_IMAGE=2 -sUSE_SDL_MIXER=2 -sSDL2_IMAGE_FORMATS='["png"]' -sSDL2_MIXER_FORMATS='["mp3"]'
CFLAGS +=${EMFLAGS}
LDFLAGS +=${EMFLAGS}
OUT =index.html
#SUFFIX =.jsendif# Check what build type is selectedifeq ($(BUILD_TYPE), RELEASE)
CFLAGS +=-O3 -s
else # Sets to DEBUG by default
CFLAGS +=-g -DDEBUG
endif##### 3RD-PARTY LIBRARIES #####SDL2_CFLAGS =$(shell ${SDL2_CONFIG} --cflags)SDL2_LIBS =$(shell ${SDL2_CONFIG} --libs)SDL2_IMAGE_CFLAGS =$(shell ${PKG_CONFIG} SDL2_image --cflags)SDL2_IMAGE_LIBS =$(shell ${PKG_CONFIG} SDL2_image --libs)SDL2_TTF_CFLAGS =$(shell ${PKG_CONFIG} SDL2_ttf --cflags)SDL2_TTF_LIBS =$(shell ${PKG_CONFIG} SDL2_ttf --libs)SDL2_MIXER_CFLAGS =$(shell ${PKG_CONFIG} SDL2_mixer --cflags)SDL2_MIXER_LIBS =$(shell ${PKG_CONFIG} SDL2_mixer --libs)# PUT ALL LIBRARY FLAGS TO CFLAGSCFLAGS += ${SDL2_CFLAGS} ${SDL2_IMAGE_CFLAGS} ${SDL2_TTF_CFLAGS} ${SDL2_MIXER_CFLAGS}
ifneq ($(PLATFORM), WEB)
# PUT ALL LIBRARY LINKING FLAGS TO LDFLAGS
LDFLAGS += ${SDL2_LIBS} ${SDL2_IMAGE_LIBS} ${SDL2_TTF_LIBS} ${SDL2_MIXER_LIBS}
endif# BUILD THE PROGRAM$(TARGET): $(OBJ)
@echo "[LOG] Creating bin directory... "; mkdir -p $(BIN_DIR)
@echo -n "[LINKING] "$(CC)$(OBJ) -o $(BIN_DIR)/${OUT}${LDFLAGS}
@echo "----- BUILD COMPLETE! ------"$(OBJ): $(OBJ_DIR)/%.o : $(SRC_DIR)/%.c | $(OBJ_DIR)$(OBJ_SUBDIRS)
@echo -n "[COMPILING] "$(CC) -c $< -o $@$(CFLAGS)# Create obj directory if it doesn't exist$(OBJ_DIR):
@mkdir -p $@$(OBJ_SUBDIRS):
@mkdir -p $@clean:
@echo "[LOG] obj files are cleaned..."
@rm -rf $(OBJ_DIR)/*.o $(OBJ_DIR)/*/*.o $(OBJ_DIR)/*/*/*.o $(BIN_DIR)/${OUT}# Removes both bin and objcleanall:
@echo "[LOG] obj and bin files are cleaned..."
@rm -rf $(BIN_DIR)$(OBJ_DIR)
.
Here is my initialization function I've wrote
boolInitGame()
{
if (SDL_Init(SDL_INIT_VIDEO) !=0) return false;
windowPtr=SDL_CreateWindow(
"SDL2TEMPLATE_C",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
500, 500,
SDL_WINDOW_MAXIMIZED
);
if (windowPtr==NULL) return false;
rendererPtr=SDL_CreateRenderer(
windowPtr,
-1,
SDL_RENDERER_ACCELERATED
);
if (rendererPtr==NULL) return false;
if (IMG_Init(IMG_INIT_PNG) ==0) return false;
if (TTF_Init() !=0) return FALSE;
if (Mix_Init(MIX_INIT_MP3) ==0) return false;
return true;
}
The text was updated successfully, but these errors were encountered:
Nevermind, I downloaded and installed an AUR for emsdk and runned sudo emsdk install latest since it wouldn't work without running it as an administrator. Right now, my build works well and there are no errors. Feels like magic to me but no news is good news to me. Apologies for being a nuissance but thanks for helping out guys. :D
Uh oh!
There was an error while loading. Please reload this page.
Good day and I'm new to emscripten. I use archlinux to create my programs and build stuffs with SDL2 and I installed emscripten to port my game to the web. The compilation works well when I only modified settings to build with SDL2 only. However, when I tried to set my SDL2_Image, SDL2_Mixer and SDL2_TTF, I get an encounter with this error.
Emscripten Version:
3.1.71-git
This is my makefile I've wrote at the moment when building my web game.
Here is my initialization function I've wrote
The text was updated successfully, but these errors were encountered: