conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.28k stars 981 forks source link

[bug] Imported target "SDL2::SDL2-static" includes non-existent path #17085

Open skhaz opened 1 month ago

skhaz commented 1 month ago

Describe the bug

After bumping emsdk to latest (3.1.50), it looks like that SDL static is missing from it.

CMake Error in CMakeLists.txt:
  Imported target "SDL2::SDL2-static" includes non-existent path

    "/home/runner/.conan2/p/emsdk94273ab0a026a/p/bin/upstream/emscripten/cache/sysroot/include/SDL2"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.

How to reproduce it

Clone the repository https://github.com/khromatizo/carimbo

Try to make a WebAssembly build

conan install . --output-folder=build --build=missing --profile=/Users/rodrigodelduca/.conan2/profiles/webassembly
cmake .. -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Release -DSANDBOX=ON
cmake --build . && ./carimbo

webassembly profile

include(default)

[settings]
arch=wasm
os=Emscripten

[tool_requires]
*: emsdk/3.1.50
memsharded commented 1 month ago

Hi @skhaz

Thanks for your report.

Some quick question. Does this mean that with the previous version of the emsdk package it works correctly?

Can you please also report the Conan version, your full profile (the output of conan install would be great). Have you tried building in different OSs?

This could be more a recipe issue than a Conan client issue, in that case, we will move this to the conan-center-index repo.

skhaz commented 1 month ago

Does this mean that with the previous version of the emsdk package it works correctly?

Yes.

SDL was working on emsdk/3.1.44. When I bumped to 3.1.50, the error started to ocurr.

Can you please also report the Conan version, your full profile

The latest from pip.

Windows, Linux and macOS works fine.

Profile is the default one detected by Conan plus, the WebAssembly one.

More details here https://github.com/khromatizo/carimbo/blob/main/.github/workflows/build.yaml

memsharded commented 1 month ago

I am trying to reproduce, but this is failing much earlier, like in the build of fmt:

(conan2_310) λ conan install . -of=build --build=missing -pr=myprofile

======== Input profiles ========
Profile host:
[settings]
arch=wasm
build_type=Release
compiler=msvc
compiler.cppstd=17
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=194
os=Emscripten
[tool_requires]
*: emsdk/3.1.44

Graph root
    conanfile.txt: conanfile.txt
Requirements
    fmt/11.0.2#5c7438ef4d5d69ab106a41e460ce11f3 - Downloaded (conancenter)
    libcurl/8.10.1#a3113369c86086b0e84231844e7ed0a9 - Downloaded (conancenter)
    libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd - Downloaded (conancenter)
    libspng/0.7.4#56ba231839e37d5f370be5a9dbb4beb1 - Downloaded (conancenter)
    lua/5.4.6#658d6089093cf01992c2737ab2e96763 - Downloaded (conancenter)
    nlohmann_json/3.11.3#45828be26eb619a2e04ca517bb7b828d - Downloaded (conancenter)
    ogg/1.3.5#062626875f5c8c59f069f76f148098ef - Downloaded (conancenter)
    openal-soft/1.23.1#e7024bb790b58439f3da3a3098594b92 - Downloaded (conancenter)
    openssl/3.3.2#9f9f130d58e7c13e76bb8a559f0a6a8b - Downloaded (conancenter)
    physfs/3.2.0#ce2cc3c35002b14680c5cb6f53ffbe7e - Downloaded (conancenter)
    sdl/2.30.7#18e0d26b5a7ce52903a0e38a50183f33 - Downloaded (conancenter)
    sol2/3.3.1#d0bfc452402c43e44872f2a8302b6ed8 - Downloaded (conancenter)
    vorbis/1.3.7#37e58f52e59a6232199b34ef402714a6 - Downloaded (conancenter)
    zlib/1.3.1#f52e03ae3d251dec704634230cd806a2 - Downloaded (conancenter)
Build requirements
    cmake/3.30.1#6d832cf2d46f6ec969ca5ed5b41f91eb - Downloaded (conancenter)
    emsdk/3.1.44#a6d941a26a1c416d25e3505805703a58 - Downloaded (conancenter)
    msys2/cci.latest#f6bb451a181a3f452024ea43ca744061 - Downloaded (conancenter)
    nodejs/16.3.0#a7eaed2d69910ba185e2ddce7a926cd1 - Downloaded (conancenter)
    strawberryperl/5.32.1.1#707032463aa0620fa17ec0d887f5fe41 - Downloaded (conancenter)
Resolved version ranges
    cmake/[>3.27 <4]: cmake/3.30.1
    openssl/[>=1.1 <4]: openssl/3.3.2
    zlib/[>=1.2.11 <2]: zlib/1.3.1

Requirements
    fmt/11.0.2#5c7438ef4d5d69ab106a41e460ce11f3:3a5a2bd6c5d28e97cf2202588aeb5f2600392713 - Build
    libcurl/8.10.1#a3113369c86086b0e84231844e7ed0a9:d932b58e2c557bf77004b097dd8862e070814769 - Build
    libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd:7d2797d0e30a823e891abc54109fceb0bc1b11de - Build
    libspng/0.7.4#56ba231839e37d5f370be5a9dbb4beb1:586db93210f5f5832e613128d7eb62a4f6e598d0 - Build
    lua/5.4.6#658d6089093cf01992c2737ab2e96763:cd7583e3f925d8d9d8347e7171776dee0a7d9e47 - Build
    nlohmann_json/3.11.3#45828be26eb619a2e04ca517bb7b828d:da39a3ee5e6b4b0d3255bfef95601890afd80709#552828a2560333bcbeff9d087ce0af0f - Download (conancenter)
    ogg/1.3.5#062626875f5c8c59f069f76f148098ef:7d2797d0e30a823e891abc54109fceb0bc1b11de - Build
    openal-soft/1.23.1#e7024bb790b58439f3da3a3098594b92:7d2797d0e30a823e891abc54109fceb0bc1b11de - Build
    openssl/3.3.2#9f9f130d58e7c13e76bb8a559f0a6a8b:bb72e5b6e6a9ebdce5678055767c5a4b93deba19 - Build
    physfs/3.2.0#ce2cc3c35002b14680c5cb6f53ffbe7e:4f0999d8d8519ee4afd19489d14f1edd3e452743 - Build
    sdl/2.30.7#18e0d26b5a7ce52903a0e38a50183f33:665bd5b9e2b94830ee873a5dc97fe2f65a003216 - Build
    sol2/3.3.1#d0bfc452402c43e44872f2a8302b6ed8:da39a3ee5e6b4b0d3255bfef95601890afd80709#ffff232cb3c25993339400c9c8278b36 - Download (conancenter)
    vorbis/1.3.7#37e58f52e59a6232199b34ef402714a6:7fc7a65683507401294e2ad2c5f630b004b6fc12 - Build
    zlib/1.3.1#f52e03ae3d251dec704634230cd806a2:7d2797d0e30a823e891abc54109fceb0bc1b11de - Build

-------- Installing package fmt/11.0.2 (7 of 19) --------
fmt/11.0.2: Building from source
fmt/11.0.2: Package fmt/11.0.2:3a5a2bd6c5d28e97cf2202588aeb5f2600392713
fmt/11.0.2: Copying sources to build folder
fmt/11.0.2: Building your package in C:\Users\.conan2\p\b\fmt3374869b1c223\b
fmt/11.0.2: Calling generate()
fmt/11.0.2: Generators folder: C:\Users\.conan2\p\b\fmt3374869b1c223\b\build\generators
fmt/11.0.2: CMakeToolchain generated: conan_toolchain.cmake
fmt/11.0.2: CMakeToolchain generated: C:\Users\.conan2\p\b\fmt3374869b1c223\b\build\generators\CMakePresets.json
fmt/11.0.2: CMakeToolchain generated: C:\Users\.conan2\p\b\fmt3374869b1c223\b\src\CMakeUserPresets.json
fmt/11.0.2: Generating aggregated env files
fmt/11.0.2: Generated aggregated env files: ['conanbuild.bat', 'conanrun.sh']
fmt/11.0.2: Calling build()
fmt/11.0.2: apply_conandata_patches(): No patches defined in conandata
fmt/11.0.2: Running CMake.configure()
fmt/11.0.2: RUN: cmake -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/.conan2/p/b/fmt3374869b1c223/p" -DFMT_DOC="OFF" -DFMT_TEST="OFF" -DFMT_INSTALL="ON" -DFMT_LIB_DIR="lib" -DFMT_OS="ON" -DFMT_UNICODE="ON" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" "C:/Users/.conan2/p/b/fmt3374869b1c223/b/src"
-- CMake version: 3.25.3
-- Using Conan toolchain: C:/Users/.conan2/p/b/fmt3374869b1c223/b/build/generators/conan_toolchain.cmake
-- Conan toolchain: Including user_toolchain: C:/Users/.conan2/p/emsdk34912423ab824/p/bin/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake
-- Conan toolchain: CMAKE_GENERATOR_TOOLSET=v143
-- Conan toolchain: Setting CMAKE_POSITION_INDEPENDENT_CODE=ON (options.fPIC)
-- Conan toolchain: C++ Standard 17 with extensions OFF
-- Conan toolchain: Setting BUILD_SHARED_LIBS = OFF
-- {fmt} version: 11.0.2
-- Build type: Release
-- Performing Test HAS_NULLPTR_WARNING
-- Performing Test HAS_NULLPTR_WARNING - Failed
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/.conan2/p/b/fmt3374869b1c223/b/build

fmt/11.0.2: Running CMake.build()
fmt/11.0.2: RUN: cmake --build "C:\Users\.conan2\p\b\fmt3374869b1c223\b\build" --config Release
MSBuild version 17.10.4+10fbfbf2e for .NET Framework

  Checking Build System
  Building Custom Rule C:/Users/.conan2/p/b/fmt3374869b1c223/b/src/CMakeLists.txt
cl : command line  warning D9002: ignoring unknown option '-O3' [C:\Users\.conan2\p\b\fmt3374869b1c223\b\build\fmt.vcxproj]
cl : command line  warning D9002: ignoring unknown option '-std=c++17' [C:\Users\.conan2\p\b\fmt3374869b1c223\b\build\fmt.vcxproj]
cl : command line  warning D9002: ignoring unknown option '-O3' [C:\Users\.conan2\p\b\fmt3374869b1c223\b\build\fmt.vcxproj]
cl : command line  warning D9002: ignoring unknown option '-std=c++17' [C:\Users\.conan2\p\b\fmt3374869b1c223\b\build\fmt.vcxproj]
  format.cc
cl : command line  warning D9002: ignoring unknown option '-O3' [C:\Users\.conan2\p\b\fmt3374869b1c223\b\build\fmt.vcxproj]
cl : command line  warning D9002: ignoring unknown option '-std=c++17' [C:\Users\.conan2\p\b\fmt3374869b1c223\b\build\fmt.vcxproj]
  os.cc
C:\Users\.conan2\p\b\fmt3374869b1c223\b\src\include\fmt\base.h(458,28): error C2338: static_assert failed: 'Unicode support requires compiling with /ut f-8' [C:\Users\.conan2\p\b\fmt3374869b1c223\b\build\fmt.vcxproj]
C:\Users\\.conan2\p\b\fmt3374869b1c223\b\src\include\fmt\base.h(458,28): error C2338: static_assert failed: 'Unicode support requires compiling with /ut f-8' [C:\Users\.conan2\p\b\fmt3374869b1c223\b\build\fmt.vcxproj]
C:\Users\.conan2\p\b\fmt3374869b1c223\b\src\include\fmt\format-inl.h(1417,3): warning C4530: C++ exception handler used, but unwind semantics are not e nabled. Specify /EHsc [C:\Users\.conan2\p\b\fmt3374869b1c223\b\build\fmt.vcxproj]
C:\Users\.conan2\p\b\fmt3374869b1c223\b\src\src\os.cc(147,3): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify
/EHsc [C:\Users\.conan2\p\b\fmt3374869b1c223\b\build\fmt.vcxproj]

fmt/11.0.2: ERROR:
Package '3a5a2bd6c5d28e97cf2202588aeb5f2600392713' build failed
fmt/11.0.2: WARN: Build folder C:\Users\.conan2\p\b\fmt3374869b1c223\b\build
ERROR: fmt/11.0.2: Error in build() method, line 106
        cmake.build()
        ConanException: Error 1 while executing

I'd like to start by having a successful build with the previous emsdk version, but I am not an expert in wasm, do you have any idea or any recommendation why the above would be failing in my case?

skhaz commented 1 month ago

I will create a minimal reproducible project. Give a couple of hours/days. Thank you in advance.

skhaz commented 1 month ago

@memsharded, I have created the MRP.

When I run cmake .. -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Release I got the following error

-- Using Conan toolchain: /opt/workspace/khromatizo/mre-sdl-and-emsdk/build/conan_toolchain.cmake
-- Conan toolchain: Defining libcxx as C++ flags: -stdlib=libc++
-- Conan toolchain: C++ Standard 17 with extensions ON
-- Configuring done (0.3s)
CMake Error in CMakeLists.txt:
  Imported target "SDL2::SDL2-static" includes non-existent path

    "/Users/rodrigodelduca/.conan2/p/emsdk7274ce025c32d/p/bin/upstream/emscripten/cache/sysroot/include/SDL2"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.

-- Generating done (0.0s)
CMake Generate step failed.  Build files cannot be regenerated correctly.

My default profile:

[settings]
arch=armv8
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=16
os=Macos

The MRP code https://github.com/colorfulworks/mre-sdl-and-emsdk

skhaz commented 1 month ago

I could confirm, SDL works on emsdk/3.1.44, but not for emsdk/3.1.50. Should I raise an issue on emsdk repository?

memsharded commented 1 month ago

Thanks for the reproduction code, this kind of thing really helps.

I have tried first in Windows, but fails to build iconv too:

======== Input profiles ======== 
Profile host:                    
[settings]                       
arch=wasm                        
build_type=Release               
compiler=msvc                    
compiler.cppstd=17               
compiler.runtime=dynamic         
compiler.runtime_type=Release    
compiler.version=194             
os=Emscripten                    
[tool_requires]                  
*: emsdk/3.1.44                  

libiconv/1.17: RUN: "/c/users/.conan2/p/b/libic2f9c398fe20a2/b/src/configure" --disable-shared --enable-static --prefix=/ --bindir=${prefix}/bin --sbindir=${prefix}/bin --libdir=${prefix}/lib --includedir=${prefix}/include --oldincludedir=${prefix}/include --host=wasm32-local-emscripten --build=x86_64-unknown-windows
mkdir: cannot create directory ‘/dev/shm’: Read-only file system

Creating /dev/shm directory failed.
POSIX semaphores and POSIX shared memory will not work

mkdir: cannot create directory ‘/dev/mqueue’: Read-only file system

Creating /dev/mqueue directory failed.
POSIX message queues will not work

configure: loading site script /etc/config.site
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for wasm32-local-emscripten-strip... :
checking for a race-free mkdir -p... /c/users/.conan2/p/msys2f4cb7e2e02a17/p/bin/msys64/usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make sets $(MAKE)... (cached) yes
checking for wasm32-local-emscripten-gcc... /c/users/.conan2/p/b/libic2f9c398fe20a2/b/src/build-aux/compile cl -nologo
checking whether the C compiler works... no
configure: error: in `/c/Users/.conan2/p/b/libic2f9c398fe20a2/b/build-release':
configure: error: C compiler cannot create executables
See `config.log' for more details

It could be that it is missing some config for using autotools in windows.

I'll try it in Linux now.

skhaz commented 1 month ago

I will setup a GitHub Action to build it on Windows, Linux & macOS.

I will let you know when it done.

For now I am using the older version.

Do you think it worth to raise an issue on emsdk?

memsharded commented 1 month ago

I have managed to reproduce in Linux, don't worry, no need to setup the GH, I have enough to investigate atm. Thanks!

memsharded commented 1 month ago

Some interesting result:

I am not sure why the complain is about the imported target SDL2 not finding the path:

 Imported target "SDL2::SDL2-static" includes non-existent path

    "/home/.conan2/p/emsdk94273ab0a026a/p/bin/upstream/emscripten/cache/sysroot/include/SDL2"

The previous emsdk version didn't have this folder, in fact the final package binary looks wildly different between the two versions, it is a bit surprising that things changed that much in some patches versions only.