vitasdk / vdpm

SDK installer and package "manager" for $VITASDK
GNU Lesser General Public License v2.1
222 stars 62 forks source link

Compilation failing on ARM (both macOS and Debian container) #80

Open jacksonbenete opened 2 years ago

jacksonbenete commented 2 years ago

Looks like I can install VitaSDK using all the provided scripts and following the instructions. But every time I try a "cmake ." it fails to compile the test program.

I'm on M1, is it possible to have a release on autobuild for arm macOS? (not sure if it would solve the problem though) I also tried on a debian container and it fails compiling the test program.

root@b89ca405054d:/build/samples/hello_world# cmake .
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/local/vitasdk/bin/arm-vita-eabi-gcc
-- Check for working C compiler: /usr/local/vitasdk/bin/arm-vita-eabi-gcc -- broken
CMake Error at /usr/share/cmake-3.13/Modules/CMakeTestCCompiler.cmake:52 (message):
  The C compiler

    "/usr/local/vitasdk/bin/arm-vita-eabi-gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /build/samples/hello_world/CMakeFiles/CMakeTmp

    Run Build Command:"/usr/bin/make" "cmTC_9b445/fast"
    /usr/bin/make -f CMakeFiles/cmTC_9b445.dir/build.make CMakeFiles/cmTC_9b445.dir/build
    make[1]: Entering directory '/build/samples/hello_world/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_9b445.dir/testCCompiler.c.obj
    /usr/local/vitasdk/bin/arm-vita-eabi-gcc   -Wl,-q    -o CMakeFiles/cmTC_9b445.dir/testCCompiler.c.obj   -c /build/samples/hello_world/CMakeFiles/CMakeTmp/testCCompiler.c
    /usr/local/vitasdk/bin/arm-vita-eabi-gcc: 1: /usr/local/vitasdk/bin/arm-vita-eabi-gcc: ELF: not found
    /usr/local/vitasdk/bin/arm-vita-eabi-gcc: 3: /usr/local/vitasdk/bin/arm-vita-eabi-gcc: Syntax error: Unterminated quoted string
    make[1]: *** [CMakeFiles/cmTC_9b445.dir/build.make:66: CMakeFiles/cmTC_9b445.dir/testCCompiler.c.obj] Error 2
    make[1]: Leaving directory '/build/samples/hello_world/CMakeFiles/CMakeTmp'
    make: *** [Makefile:121: cmTC_9b445/fast] Error 2

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

-- Configuring incomplete, errors occurred!
See also "/build/samples/hello_world/CMakeFiles/CMakeOutput.log".
See also "/build/samples/hello_world/CMakeFiles/CMakeError.log".
erfg12 commented 2 years ago

Same here. On my MacBook Air M1 and in an Ubuntu Arm VM compiling fails.

SonicMastr commented 2 years ago

For M1, there's nothing for you right now. But for Linux based AARCH64/ARM64 systems, there is a fork with ARM support here.

It's been a while, but the problem is this is entirely a self-hosted autobuild runner, so it cannot be merged into VitaSDK right now until public ARM runners are added to actions.

iamcco commented 1 year ago

same here.

xfangfang commented 1 year ago

@iamcco I've encountered a similar issue before. For ARM Mac, the problem arises because some executable files like arm-vita-eabi-gcc were compiled for Intel Mac, and they have dependencies on x86 libraries. On an ARM Mac, only the ARM libraries are available, so they cannot execute properly. The solution is either to distribute these dependencies along with the files or locally compile these executable files.

iamcco commented 1 year ago

@iamcco I've encountered a similar issue before. For ARM Mac, the problem arises because some executable files like arm-vita-eabi-gcc were compiled for Intel Mac, and they have dependencies on x86 libraries. On an ARM Mac, only the ARM libraries are available, so they cannot execute properly. The solution is either to distribute these dependencies along with the files or locally compile these executable files.

@xfangfang Thanks, I'll look into it.

rreha commented 3 months ago

I'm currently experiencing the same issue, except that I'm actually on an Intel Mac and not M1...

hammerill commented 3 months ago

Fresh MacBook Air M1 user here. Currently compiling my Vita project using x86 emulator version of Lima as described in here.

Compilation feels like 5x slower. But hey, it gets the job done!

hammerill commented 3 months ago

But for Linux based AARCH64/ARM64 systems, there is a fork with ARM support here.

Oh, probably I had to try that first with normal version of Lima (which emulates normal Ubuntu with ARM).

xfangfang commented 3 months ago

@hammerill I am using using https://orbstack.dev, running a Docker image of vitasdk to compile for vita, compared to Docker Desktop, OrbStack supports rosetta to run Docker images or Linux, which makes the running speed almost similar to x86_64.

https://docs.orbstack.dev/compare/colima

hammerill commented 3 months ago

@xfangfang thank you for suggesting that! But still I've decided to stay with Lima. As I said that the Arm64 version of VDPM could possibly work with default conf of Lima, I've tried it out, and it worked flawlessly! Now, it compiles everything at acceptable speed.

By the way, @SonicMastr , I've merged the upstream branch in my fork in order to compile the project I've worked on with latest VDPM version. Your version was kind of stale and complained about libxmp being absent. Merging with upstream VDPM fixed that. You could accept my PR if you want.

In general, I find this Lima + Arm64 VDPM technique a viable solution for developing Vita homebrew on Macs.