Open skhaz opened 9 months ago
It's weird. It could be a regression of conan 2.0.14 (released today). It's like if CMakeDeps was mixing up relative path defined by cpp_info.includedirs
of sdl recipe with a sysroot path defined in cmake toolchain file of emsdk recipe (this sysroot path is also appended to CMAKE_FIND_ROOT_PATH
by the same toolchain, there might be some tricky side effects with CMakeDeps).
@SpaceIm, just to emphasize, this occurs only on the profile using the emsdk (locally, macOS host, or in CI, Ubuntu); I have CI running on the three main platforms and they have not been affected.
@SpaceIm, I don't believe it's a regression; I tested with some previous versions up to 2.0.12, which is when I started using it.
Unless it's something in the SDL2 package or in the Conan backend.
Is there any way to perform a rollback besides downgrading the package installed via pip?
I downgraded Conan to version 2.0.11 and SDL2 to version 2.28.2, and the same error persists. So I don't know what it could be.
@SpaceIm, I discovered the issue; it actually occurs in recent versions of the EMSDK. By downgrading to an earlier version, the problem does not occur.
Working version for SDL2 emsdk/3.1.44
Closing.
The problem of emsdk I think is that it also contains pre-build binaries of libraries like sdl, and headers of SDL are in a different folder. Maybe we should remove these pre-build binaries from sysroot of emsdk during packaging.
@SpaceIm, I raised the issue on the emsdk repository, a project collaborator said that emsdk should be built with the -sUSE_SDL=2
flag. I believe that at some point Conan removed this. If so, is there a way to enable this flag?
Thank you.
Reference: https://github.com/emscripten-core/emsdk/issues/1301#issuecomment-1814850196
Actually we don't want SDL2 in emsdk recipe, because it would collide with SDL2 package from conan.
Just for reference, here is the content of bin/upstream/emscripten/system
in emsdk/3.1.48
on macOS x86_64, and I see SDL2 headers (but no lib), it might be a problem for us:
$ ls /Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/*/*
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/bin/sdl-config
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/bin/sdl-config.bat
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/bin/sdl-config.py
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/bin/sdl2-config
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/bin/sdl2-config.bat
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/bin/sdl2-config.py
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/emscripten.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/wasm_simd128.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/README.md
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/al.c
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/asan_js.c
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/dlmalloc.c
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/emmalloc.c
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/jsmath.c
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/push_llvm_changes.py
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/push_musl_changes.py
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/stb_image.c
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/update_compiler_rt.py
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/update_libcxx.py
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/update_libcxxabi.py
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/update_libunwind.py
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/update_musl.py
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/AL:
al.h alc.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/EGL:
egl.h eglext.h eglplatform.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/GL:
freeglut_std.h gl.h glew.h glext.h glfw.h glu.h glut.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/GLES:
gl.h glext.h glplatform.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/GLES2:
gl2.h gl2ext.h gl2platform.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/GLES3:
gl2ext.h gl3.h gl31.h gl32.h gl3platform.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/GLFW:
glfw3.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/KHR:
khrplatform.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/SDL:
COPYING SDL_config.h.in SDL_config_wiz.h SDL_hints.h SDL_mixer.h SDL_power.h SDL_stdinc.h SDL_video.h
SDL.h SDL_config_android.h SDL_copying.h SDL_image.h SDL_mouse.h SDL_quit.h SDL_surface.h begin_code.h
SDL_assert.h SDL_config_emscripten.h SDL_cpuinfo.h SDL_input.h SDL_mutex.h SDL_rect.h SDL_syswm.h close_code.h
SDL_atomic.h SDL_config_iphoneos.h SDL_endian.h SDL_joystick.h SDL_name.h SDL_render.h SDL_thread.h
SDL_audio.h SDL_config_macosx.h SDL_error.h SDL_keyboard.h SDL_opengl.h SDL_revision.h SDL_timer.h
SDL_blendmode.h SDL_config_minimal.h SDL_events.h SDL_keycode.h SDL_opengles.h SDL_rotozoom.h SDL_touch.h
SDL_clipboard.h SDL_config_nintendods.h SDL_gesture.h SDL_loadso.h SDL_opengles2.h SDL_rwops.h SDL_ttf.h
SDL_compat.h SDL_config_pandora.h SDL_gfxPrimitives.h SDL_log.h SDL_pixels.h SDL_scancode.h SDL_types.h
SDL_config.h SDL_config_windows.h SDL_haptic.h SDL_main.h SDL_platform.h SDL_shape.h SDL_version.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/X11:
X.h Xatom.h Xfuncs.h XlibConf.h Xmd.h Xproto.h Xutil.h extensions keysymdef.h
XKBlib.h Xfuncproto.h Xlib.h Xlibint.h Xosdefs.h Xprotostr.h cursorfont.h keysym.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/compat:
arm_neon.h ctype.h immintrin.h math.h nmmintrin.h smmintrin.h stdlib.h sys tmmintrin.h wctype.h xmmintrin.h
avxintrin.h emmintrin.h malloc.h netdb.h pmmintrin.h stdarg.h string.h time.h wchar.h xlocale.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/emscripten:
atomic.h em_js.h emscripten.h heap.h posix_socket.h threading_legacy.h wasmfs.h
bind.h em_macros.h eventloop.h html5.h promise.h trace.h webaudio.h
console.h em_math.h exports.h html5_webgl.h proxying.h val.h websocket.h
dom_pk_codes.h em_types.h fetch.h html5_webgpu.h stack.h version.h wget.h
em_asm.h emmalloc.h fiber.h key_codes.h threading.h wasm_worker.h wire.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/fakesdl:
SDL.h SDL_config.h SDL_gfxPrimitives.h SDL_keycode.h SDL_name.h SDL_quit.h SDL_shape.h SDL_ttf.h
SDL_assert.h SDL_copying.h SDL_haptic.h SDL_loadso.h SDL_opengl.h SDL_rect.h SDL_stdinc.h SDL_types.h
SDL_atomic.h SDL_cpuinfo.h SDL_hints.h SDL_log.h SDL_opengles.h SDL_render.h SDL_surface.h SDL_version.h
SDL_audio.h SDL_endian.h SDL_image.h SDL_main.h SDL_opengles2.h SDL_revision.h SDL_syswm.h SDL_video.h
SDL_blendmode.h SDL_error.h SDL_input.h SDL_mixer.h SDL_pixels.h SDL_rotozoom.h SDL_thread.h
SDL_clipboard.h SDL_events.h SDL_joystick.h SDL_mouse.h SDL_platform.h SDL_rwops.h SDL_timer.h
SDL_compat.h SDL_gesture.h SDL_keyboard.h SDL_mutex.h SDL_power.h SDL_scancode.h SDL_touch.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/uuid:
uuid.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/wasi:
api.h wasi-helpers.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/webgl:
webgl1.h webgl1_ext.h webgl2.h webgl2_ext.h webgl_api.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/include/webgpu:
README.md webgpu.h webgpu_cpp.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/cmake:
SDL2
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/compiler-rt:
CREDITS.TXT __trap.c emscripten_setjmp.c include readme.txt stack_ops.S
LICENSE.TXT emscripten_exception_builtins.c emscripten_tempret.s lib stack_limits.S
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/embind:
bind.cpp
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/fetch:
emscripten_fetch.c
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/gl:
gl.c libprocaddr.c webgl1.c webgl2.c webgl_internal.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/html5:
callback.c dom_pk_codes.c emscripten_wget.c key_codes.c offscreencanvas.c
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/libc:
README.md dynlink.c emscripten_memcpy.c emscripten_scan_stack.c pthread_sigmask.c wasi-helpers.c
atexit_dummy.c emscripten_console.c emscripten_memcpy_bulkmem.S emscripten_syscall_stubs.c raise.c
compat emscripten_fiber.c emscripten_memmove.c emscripten_time.c sbrk.c
crt1.c emscripten_get_heap_size.c emscripten_memset.c kill.c sigaction.c
crt1_proxy_main.c emscripten_internal.h emscripten_memset_bulkmem.S mktime.c sigtimedwait.c
crt1_reactor.c emscripten_libc_stubs.c emscripten_mmap.c musl tzset.c
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/libcxx:
CREDITS.TXT LICENSE.TXT include readme.txt src
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/libcxxabi:
CREDITS.TXT LICENSE.TXT include readme.txt src
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/libunwind:
LICENSE.TXT include readme.txt src
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/pkgconfig:
egl.pc glesv2.pc glfw3.pc sdl.pc
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/pthread:
em_task_queue.c emscripten_thread_init.c library_pthread.c proxying_stub.c thread_mailbox.c
em_task_queue.h emscripten_thread_state.S library_pthread_stub.c pthread_create.c thread_mailbox.h
emscripten_futex_wait.c emscripten_tls_init.c proxying.c pthread_kill.c thread_profiler.c
emscripten_futex_wake.c emscripten_yield.c proxying_legacy.c pthread_self_stub.c threading_internal.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/standalone:
__main_void.c standalone.c standalone_wasm_stdio.c
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/wasm_worker:
library_wasm_worker.c library_wasm_worker_stub.c
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/wasmfs:
backend.h file_table.cpp memory_backend.h proxied_async_js_impl_backend.h syscalls.cpp wasmfs_internal.h
backends file_table.h no_fs.c special_files.cpp thread_utils.h
emscripten.cpp fuzzer paths.cpp special_files.h virtual.h
file.cpp js_api.cpp paths.h support.cpp wasmfs.cpp
file.h js_impl_backend.h pipe_backend.h support.h wasmfs.h
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/webgpu:
README.md webgpu_cpp.cpp
/Users/spaceim/.conan2/p/b/emsdkf06e877bfd6a1/p/bin/upstream/emscripten/system/lib/websocket:
websocket_to_posix_socket.c
@SpaceIm, I understand, that makes sense. But how do I enable SDL2 in emsdk for a WebAssembly build? It used to work without needing to change anything and it's broken now.
Well, we have to understand why CMakeDeps tries to look into emsdk sysroot instead of conan cache for sdl discovery, and I think it can be reported to conan client. I don't have more time to investigate.
If you could share the diff between emsdk/3.1.44 & emsdk/3.1.48 packages on the same plaform, it could help:
diff of files list in bin/upstream/emscripten/system diff of bin/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
@SpaceIm, sure thing, I will look into that, I thought it was a known cause.
There is a sdl2-config.cmake
in bin/.emscripten_cache/sysroot/lib/cmake/SDL2/
(bin/.emscripten_cache/sysroot
is the sysroot of emsdk, it's defined in its toolchain and even added to CMAKE_FIND_ROOT_PATH
, so anything under this folder has precedence for find_package, find_library, find_path etc over anything else generated by CMakeDeps).
I think that this file is found during your CMake configuration, and also the one from CMakeDeps generated by conan, so it breaks because this sdl2-config.cmake defines SDL2_INCLUDE_DIRS
so I guess it corrupts logic of SDL2Config.cmake generated by CMakeDeps:
set(SDL2_INCLUDE_DIRS "${EMSCRIPTEN_SYSROOT}/include/SDL2")
set(SDL2_LIBRARIES "-sUSE_SDL=2")
if(NOT TARGET SDL2::SDL2)
add_library(SDL2::SDL2 INTERFACE IMPORTED)
set_target_properties(SDL2::SDL2 PROPERTIES
INTERFACE_COMPILE_OPTIONS "-sUSE_SDL=2"
INTERFACE_LINK_LIBRARIES "-sUSE_SDL=2")
add_library(SDL2::SDL2-static INTERFACE IMPORTED)
set_target_properties(SDL2::SDL2-static PROPERTIES
INTERFACE_COMPILE_OPTIONS "-sUSE_SDL=2"
INTERFACE_LINK_LIBRARIES "-sUSE_SDL=2")
add_library(SDL2::SDL2main INTERFACE IMPORTED)
endif()
Why does it work for you with 3.1.44 and not 3.1.48? I don't know, I don't see any significant difference.
I think that emsdk recipe should remove several files in emsdk packages (files related to SDL2, glfw, and stb for example: headers, libs, source file, cmake file and pkgconfig files), the risk is too high that things can collide with CMakeDeps or libs from conan cache.
The defect appeared starting from version 3.1.45. Version 3.1.44 was the last one that worked.
The issue persists. Also, it doesn't look like include directories are populated correctly, as consumers can't find emscripten.h
out of the box
@sykhro, please see my last comment.
@sykhro, please see my last comment.
I saw that. I unfortunately need 3.1.50
Description
Since today I am getting the following error when compiling with
emsdk
. Before it worked fine.It doesn't compile on my machine or in the GitHub Action.
Other profiles works well, like Windows, macOS e Ubuntu.
Steps to reproduce
Create a project which uses SDL2 and then compile it with emsdk.
Logs