vitasdk / vdpm

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

arm-vita-eabi-gcc/g++ does seem to not find standard C/C++ libaries #41

Closed Jorenar closed 5 years ago

Jorenar commented 5 years ago

I've tried to compile Lua Player Plus Vita by Rinnegatamante. After managing to get over with no utils.h and no lua.hpp (which I still don't know if will work, because everything I did was change to #include </usr/local/include/luajit-2.0/lua.hpp>), but after seeing such communicate:

arm-vita-eabi-g++ -fno-lto -g -Wl,-q -O3 -DWANT_FASTWAV -DHAVE_LIBSPEEXDSP -DHAVE_LIBSNDFILE -DHAVE_MPG123 -DWANT_FMMIDI=1 -DWANT_FASTAIFF -DUSE_AUDIO_RESAMPLER -DHAVE_OGGVORBIS -DHAVE_OPUSFILE -DSQLITE_OS_OTHER=1 -DSQLITE_TEMP_STORE=3 -DSQLITE_THREADSAFE=0 -fno-exceptions -std=gnu++11 -fpermissive   -c -o source/luaVideo.o source/luaVideo.cpp
source/luaVideo.cpp:25:10: fatal error: stdlib.h: No such file or directory
 #include <stdlib.h>
          ^~~~~~~~~~
compilation terminated.
<builtin>: recipe for target 'source/luaVideo.o' failed
make: *** [source/luaVideo.o] Error 1

I've run out of ideas. For some reason I tried compiling ctrl from samples and I saw:

[ 12%] Building C object CMakeFiles/ctrl_sample.dir/src/main.c.obj
/home/x/tmp/samples/ctrl/src/main.c:1:10: fatal error: stdio.h: No such file or directory
 #include <stdio.h>
          ^~~~~~~~~
compilation terminated.
CMakeFiles/ctrl_sample.dir/build.make:62: recipe for target 'CMakeFiles/ctrl_sample.dir/src/main.c.obj' failed
make[2]: *** [CMakeFiles/ctrl_sample.dir/src/main.c.obj] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/ctrl_sample.dir/all' failed
make[1]: *** [CMakeFiles/ctrl_sample.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

I was using latest vitasdk form commit 2587b93c4b87f2d871efe9410edb0e1afaaff813

OS: Ubuntu 18.04.2 LTS (Xubuntu 18.04) Kernel: Linux x 4.15.0-45-generic

d3m3vilurr commented 5 years ago

it would be lpp-vita issue @Rinnegatamante can you handle this? maybe we need to add LuaJIT into packages

qimiko commented 5 years ago

you may've messed up a g++/gcc install check your /usr/include directory for stdio.h and stdlib.h also check if a program featuring stdio.h compiles with normal gcc

Jorenar commented 5 years ago

Sample ctrl from vitasdk/samples also didn't compile, so it isn't an issue with lpp-vita. gcc/g++ compiles my code normally, so problem also is not there.

After reinstallation of vitasdk the ctrl compiled, but lpp-vita throw an error:

arm-vita-eabi-g++ -fno-lto -g -Wl,-q -O3 -DWANT_FASTWAV -DHAVE_LIBSPEEXDSP -DHAVE_LIBSNDFILE -DHAVE_MPG123 -DWANT_FMMIDI=1 -DWANT_FASTAIFF -DUSE_AUDIO_RESAMPLER -DHAVE_OGGVORBIS -DHAVE_OPUSFILE -DSQLITE_OS_OTHER=1 -DSQLITE_TEMP_STORE=3 -DSQLITE_THREADSAFE=0 -fno-exceptions -std=gnu++11 -fpermissive   -c -o source/luaVideo.o source/luaVideo.cpp
source/luaVideo.cpp:31:11: fatal error: utils.h: No such file or directory
  #include <utils.h> // utils.h file from vita2d
           ^~~~~~~~~
compilation terminated.
<builtin>: recipe for target 'source/luaVideo.o' failed
make: *** [source/luaVideo.o] Error 1

so I replaced /usr/local/vitasdk/arm-vita-eabi/include/ with include directory from vitasdk/vita-headers and again (this time for camera_sample):

[ 12%] Building C object CMakeFiles/camera_sample.dir/src/main.c.obj
/home/x/tmp/samples/camera/src/main.c:2:10: fatal error: stdio.h: No such file or directory
 #include <stdio.h>
          ^~~~~~~~~
compilation terminated.
CMakeFiles/camera_sample.dir/build.make:62: recipe for target 'CMakeFiles/camera_sample.dir/src/main.c.obj' failed
make[2]: *** [CMakeFiles/camera_sample.dir/src/main.c.obj] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/camera_sample.dir/all' failed
make[1]: *** [CMakeFiles/camera_sample.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
d3m3vilurr commented 5 years ago

@Jorengarenar I updated vitasdk toolchain for checking this issue. camera sample work properly. imo, your dev env would be wrong.

  1. how install sdk?
  2. echo $VITASDK result.
Rinnegatamante commented 5 years ago

utils.h as the comment says is from vita2d. Copy-paste that file in your include folder in vitasdk (Even if you should already have it if you have vita2d installed).

Unless you plan to extend lpp-vita, there's no need to compile it on your own by the way.

Jorenar commented 5 years ago

@d3m3vilurr As I said, problem with C/C++ STD library occurs when I replace default /usr/local/vitasdk/arm-vita-eabi/include with directory include from repository vita-headers.

  1. I installed with basic method:

    git clone https://github.com/vitasdk/vdpm
    cd vdpm
    ./bootstrap-vitasdk.sh
    ./install-all.sh

    with:

    export VITASDK=/usr/local/vitasdk
    export PATH=$VITASDK/bin:$PATH # add vitasdk tool to $PATH

    in .bashrc

  2. $ echo $VITASDK
    /usr/local/vitasdk

After reinstalling VITASDK again today, missing utils.h appeared, but compilation attempt gave me:

arm-vita-eabi-g++ -fno-lto -g -Wl,-q -O3 -DWANT_FASTWAV -DHAVE_LIBSPEEXDSP -DHAVE_LIBSNDFILE -DHAVE_MPG123 -DWANT_FMMIDI=1 -DWANT_FASTAIFF -DUSE_AUDIO_RESAMPLER -DHAVE_OGGVORBIS -DHAVE_OPUSFILE -DSQLITE_OS_OTHER=1 -DSQLITE_TEMP_STORE=3 -DSQLITE_THREADSAFE=0 -fno-exceptions -std=gnu++11 -fpermissive   -c -o source/luaVideo.o source/luaVideo.cpp
source/luaVideo.cpp:31:11: fatal error: utils.h: No such file or directory
  #include <utils.h> // utils.h file from vita2d
           ^~~~~~~~~
compilation terminated.
<builtin>: recipe for target 'source/luaVideo.o' failed
make: *** [source/luaVideo.o] Error 1

As if it didn't exist. Could this be because utils.h has two instances?

$ find /usr/local/vitasdk/ | grep /utils.h
/usr/local/vitasdk/arm-vita-eabi/include/psp2kern/kernel/utils.h
/usr/local/vitasdk/arm-vita-eabi/include/vitasdk/utils.h

@Rinnegatamante And unless I don't have Windows

d3m3vilurr commented 5 years ago

@Jorengarenar okay it's not a vdpm problem.

  1. you was overwriting all include directory files. it's just your fault.
  2. where is utils.h is lpp-vita project thing.

short answer: please make the issue into lpp-vita. long answer: might be lpp-vita's include path was wrong https://github.com/Rinnegatamante/lpp-vita/blob/master/Makefile#L4 it would be sources/include

anyway please move to the lpp-vita project :)

Rinnegatamante commented 5 years ago

"Unless i don't have Windows"?

Jorenar commented 5 years ago

@Rinnegatamante Sorry only after looking little deeper at the project I understood it's probably not possible to compile it for Linux. I have this naive impulse that if something is on GitHub and there isn't Linux release, then "for Linux use compile it yourself". Totally my bad, I apologize for all that fuss