cemu-project / Cemu

Cemu - Wii U emulator
https://cemu.info
Mozilla Public License 2.0
6.61k stars 505 forks source link

[Linux] Build Failing on Ubuntu 22.04 (vcpkg install failure) #1164

Closed BlessedLongsword closed 2 months ago

BlessedLongsword commented 2 months ago

Current Behavior

Attempted to build Cemu on Ubuntu 22.04 using the build instructions, when trying to run:

cmake -S . -B build -DCMAKE_BUILD_TYPE=release -DCMAKE_C_COMPILER=/usr/bin/clang-15 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-15 -G Ninja -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja

The output is:

-- Bootstrapping vcpkg before install
-- Bootstrapping vcpkg before install - done
-- Running vcpkg install
A suitable version of cmake was not found (required v3.27.1) Downloading portable cmake 3.27.1...
Downloading cmake...
https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-linux-x86_64.tar.gz->/home/user/Cemu/dependencies/vcpkg/downloads/cmake-3.27.1-linux-x86_64.tar.gz
Extracting cmake...
error: failed to execute: /usr/bin/git --git-dir=/home/user/Cemu/dependencies/vcpkg/.git --work-tree=/home/user/Cemu/dependencies/vcpkg/buildtrees/versioning_/versions/boost-modular-build-helper/843c4331dc1453c80f99e25be4513c99074c5cf2_23241.tmp -c core.autocrlf=false read-tree -m -u 843c4331dc1453c80f99e25be4513c99074c5cf2
vcpkg was cloned as a shallow repository in: /home/user/Cemu/dependencies/vcpkg/.git
Try again with a full vcpkg clone.
error: git failed with exit code: (128).
fatal: failed to unpack tree object 843c4331dc1453c80f99e25be4513c99074c5cf2
note: while checking out port boost-modular-build-helper with git tree 843c4331dc1453c80f99e25be4513c99074c5cf2
-- Running vcpkg install - failed
CMake Error at dependencies/vcpkg/scripts/buildsystems/vcpkg.cmake:899 (message):
  vcpkg install failed.  See logs for more information:
  /home/user/Cemu/build/vcpkg-manifest-install.log
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/CMakeDetermineSystem.cmake:124 (include)
  CMakeLists.txt:36 (project)

And the logs mentioned in the output are:

error: failed to execute: /usr/bin/git --git-dir=/home/user/Cemu/dependencies/vcpkg/.git --work-tree=/home/user/Cemu/dependencies/vcpkg/buildtrees/versioning_/versions/boost-modular-build-helper/843c4331dc1453c80f99e25be4513c99074c5cf2_22068.tmp -c core.autocrlf=false read-tree -m -u 843c4331dc1453c80f99e25be4513c99074c5cf2
vcpkg was cloned as a shallow repository in: /home/user/Cemu/dependencies/vcpkg/.git
Try again with a full vcpkg clone.
error: git failed with exit code: (128).
fatal: failed to unpack tree object 843c4331dc1453c80f99e25be4513c99074c5cf2
note: while checking out port boost-modular-build-helper with git tree 843c4331dc1453c80f99e25be4513c99074c5cf2

There is a similar issue with an Arch based distribution, but I have not been successful to reproduce the solution that the original poster used for their problem.

Expected Behavior

Successful Cemu build

Steps to Reproduce

  1. sudo apt install -y cmake curl clang-15 freeglut3-dev git libgcrypt20-dev libglm-dev libgtk-3-dev libpulse-dev libsecret-1-dev libsystemd-dev libtool nasm ninja-build
  2. sudo apt install libusb-1.0-0-dev
  3. git clone --recursive https://github.com/cemu-project/Cemu
  4. cd Cemu
  5. cmake -S . -B build -DCMAKE_BUILD_TYPE=release -DCMAKE_C_COMPILER=/usr/bin/clang-15 -DCMAKE_CXX_COMPILER=/usr/bin/clang++-15 -G Ninja -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja (Failure)

System Info (Optional)

OS: Ubuntu 22.04.4 LTS GPU: NVIDIA Corporation GA106M [GeForce RTX 3060 Mobile / Max-Q] / Mesa Intel® Graphics (ADL GT2)

Emulation Settings (Optional)

No response

Logs (Optional)

error: failed to execute: /usr/bin/git --git-dir=/home/user/Cemu/dependencies/vcpkg/.git --work-tree=/home/user/Cemu/dependencies/vcpkg/buildtrees/versioning_/versions/boost-modular-build-helper/843c4331dc1453c80f99e25be4513c99074c5cf2_22068.tmp -c core.autocrlf=false read-tree -m -u 843c4331dc1453c80f99e25be4513c99074c5cf2
vcpkg was cloned as a shallow repository in: /home/user/Cemu/dependencies/vcpkg/.git
Try again with a full vcpkg clone.
error: git failed with exit code: (128).
fatal: failed to unpack tree object 843c4331dc1453c80f99e25be4513c99074c5cf2
note: while checking out port boost-modular-build-helper with git tree 843c4331dc1453c80f99e25be4513c99074c5cf2
EpicUsername12 commented 2 months ago

Please read the BUILD.md

Compiling Errors This section refers to running cmake -S... (truncated).

  • vcpkg install failed
    • Run the following in the root directory and try running the command again (don't forget to change directories afterwards):
      • cd dependencies/vcpkg && git fetch --unshallow
BlessedLongsword commented 2 months ago

I see, I completely missed that, apologies for the redundant issue and thank you for pointing that out. I actually ran into another problem upon retrying the cmake command, which I solved thanks to this stack overflow question.

The failure output I got is the one below, I will leave it here as I didn't find it in the troubleshoot, it is probably a specific case of:

  • Compiling failed during the boost-build dependency. It means you don't have a working/good standard library installation. Check the integrity of your system headers and making sure that C++ related packages are installed and intact.

To sum it up, clang++15 picks the most recent gcc installed, but it requires gcc-11 (for the libstdc++-11 dependency).

The cli output was:

-- Running vcpkg install
Detecting compiler hash for triplet x64-linux...
All requested packages are currently installed.
Total install time: 484 ns
The package boost is compatible with built-in CMake targets:

    find_package(Boost REQUIRED [COMPONENTS <libs>...])
    target_link_libraries(main PRIVATE Boost::boost Boost::<lib1> Boost::<lib2> ...)

The package openssl is compatible with built-in CMake targets:

    find_package(OpenSSL REQUIRED)
    target_link_libraries(main PRIVATE OpenSSL::SSL OpenSSL::Crypto)

The package zlib is compatible with built-in CMake targets:

    find_package(ZLIB REQUIRED)
    target_link_libraries(main PRIVATE ZLIB::ZLIB)

curl is compatible with built-in CMake targets:

    find_package(CURL REQUIRED)
    target_link_libraries(main PRIVATE CURL::libcurl)

The package fmt provides CMake targets:

    find_package(fmt CONFIG REQUIRED)
    target_link_libraries(main PRIVATE fmt::fmt)

    # Or use the header-only version
    find_package(fmt CONFIG REQUIRED)
    target_link_libraries(main PRIVATE fmt::fmt-header-only)

glslang provides CMake targets:

    find_package(glslang CONFIG REQUIRED)
    target_link_libraries(main PRIVATE glslang::OSDependent glslang::glslang glslang::MachineIndependent glslang::GenericCodeGen glslang::glslang-default-resource-limits glslang::OGLCompiler glslang::SPVRemapper glslang::SPIRV glslang::HLSL)

libusb can be imported via CMake FindPkgConfig module:
    find_package(PkgConfig REQUIRED)
    pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0)

    target_link_libraries(main PRIVATE PkgConfig::libusb)

hidapi provides CMake targets:

  # this is heuristically generated, and may not be correct
  find_package(hidapi CONFIG REQUIRED)
  target_link_libraries(main PRIVATE hidapi::hidapi hidapi::hidraw hidapi::libusb hidapi::include)

hidapi provides pkg-config modules:

    # C Library for USB/Bluetooth HID device access from Linux, Mac OS X, FreeBSD, and Windows. This is the hidraw implementation.
    hidapi-hidraw

    # C Library for USB HID device access from Linux, Mac OS X, FreeBSD, and Windows. This is the libusb implementation.
    hidapi-libusb

libzip provides CMake targets:

  # this is heuristically generated, and may not be correct
  find_package(libzip CONFIG REQUIRED)
  target_link_libraries(main PRIVATE libzip::zip)

libzip provides pkg-config modules:

    # library for handling zip archives
    libzip

pugixml provides CMake targets:

  # this is heuristically generated, and may not be correct
  find_package(pugixml CONFIG REQUIRED)
  target_link_libraries(main PRIVATE pugixml::static pugixml::pugixml)

pugixml provides pkg-config modules:

    # Light-weight, simple and fast XML parser for C++ with XPath support.
    pugixml

rapidjson provides CMake targets:

  # this is heuristically generated, and may not be correct
  find_package(RapidJSON CONFIG REQUIRED)
  target_link_libraries(main PRIVATE rapidjson)

rapidjson provides pkg-config modules:

    # A fast JSON parser/generator for C++ with both SAX/DOM style API
    RapidJSON

sdl2 provides CMake targets:

    find_package(SDL2 CONFIG REQUIRED)
    target_link_libraries(main
        PRIVATE
        $<TARGET_NAME_IF_EXISTS:SDL2::SDL2main>
        $<IF:$<TARGET_EXISTS:SDL2::SDL2>,SDL2::SDL2,SDL2::SDL2-static>
    )

The package wxwidgets provides CMake targets:

    find_package(wxWidgets CONFIG REQUIRED)
    target_link_libraries(main PRIVATE wx::core wx::base)

The package zstd provides CMake targets:

    find_package(zstd CONFIG REQUIRED)
    target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>)

-- Running vcpkg install - done
-- The C compiler identification is Clang 15.0.7
-- The CXX compiler identification is Clang 15.0.7
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang-15 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /usr/bin/clang++-15
-- Check for working CXX compiler: /usr/bin/clang++-15 - broken
CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message):
  The C++ compiler

    "/usr/bin/clang++-15"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/antonio/Cemu/build/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/ninja cmTC_eaf2d && [1/2] Building CXX object CMakeFiles/cmTC_eaf2d.dir/testCXXCompiler.cxx.o
    [2/2] Linking CXX executable cmTC_eaf2d
    FAILED: cmTC_eaf2d 
    : && /usr/bin/clang++-15   CMakeFiles/cmTC_eaf2d.dir/testCXXCompiler.cxx.o -o cmTC_eaf2d   && :
    /usr/bin/ld: cannot find -lstdc++: No such file or directory
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:36 (project)

-- Configuring incomplete, errors occurred!
See also "/home/antonio/Cemu/build/CMakeFiles/CMakeOutput.log".
See also "/home/antonio/Cemu/build/CMakeFiles/CMakeError.log".

Thanks again for your help!