Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ee-gcc.exe: installation problem, cannot exec `<snip>/cpp.exe': Invalid argument #53

Open
mkst opened this issue Oct 8, 2023 · 1 comment

Comments

@mkst
Copy link
Contributor

mkst commented Oct 8, 2023

When trying to use wibo to replace wine, the command fails when trying to call cpp.exe.

Running under wibo:

Reading specs from Z:\backend\compilers\ps2\ee-gcc2.95.2-273a\bin\..\lib/gcc-lib/ee\2.95.2\specs
gcc driver version 2.9-ee-991111b/r4 executing gcc version 2.95.2-EE
 /backend/compilers/ps2/ee-gcc2.95.2-273a/lib/gcc-lib/ee/2.95.2/cpp.exe -lang-c -v -I Z:\backend\compilers\ps2\ee-gcc2.95.2-273a\bin\..\lib/gcc-lib/ee\2.95.2\ -isystem /backend/compilers/ps2/ee-gcc2.95.2-273a/lib/gcc-lib/ee/2.95.2/include -D__GNUC__=2 -D__GNUC_MINOR__=95 -Dmips -DMIPSEL -DR5900 -D_mips -D_MIPSEL -D_R5900 -D__mips__ -D__MIPSEL__ -D__R5900__ -D___mips__ -D_MIPSEL -D_R5900 -D__mips -D__MIPSEL -D__R5900 -D___mips -D__OPTIMIZE__ -D__LANGUAGE_C -D_LANGUAGE_C -DLANGUAGE_C -D__SIZE_TYPE__=unsigned -D__PTRDIFF_TYPE__=int -D__LONG_MAX__=9223372036854775807L -U__mips -D__mips=3 -D__mips64 -D__mips_eabi -D__mips_single_float /tmp/code.c /tmp\ccbaaaaa.i
ee-gcc.exe: installation problem, cannot exec `/backend/compilers/ps2/ee-gcc2.95.2-273a/lib/gcc-lib/ee/2.95.2/cpp.exe': Invalid argument

Running under wine:

Reading specs from /backend/compilers/ps2/ee-gcc2.95.2-273a/lib/gcc-lib/ee/2.95.2/specs
gcc driver version 2.9-ee-991111b/r4 executing gcc version 2.95.2-EE
 /backend/compilers/ps2/ee-gcc2.95.2-273a/lib/gcc-lib/ee/2.95.2/cpp.exe -lang-c -v -I Z:\backend\compilers\ps2\ee-gcc2.95.2-273a\bin\..\lib/gcc-lib/ee\2.95.2\ -isystem /backend/compilers/ps2/ee-gcc2.95.2-273a/lib/gcc-lib/ee/2.95.2/include -D__GNUC__=2 -D__GNUC_MINOR__=95 -Dmips -DMIPSEL -DR5900 -D_mips -D_MIPSEL -D_R5900 -D__mips__ -D__MIPSEL__ -D__R5900__ -D___mips__ -D_MIPSEL -D_R5900 -D__mips -D__MIPSEL -D__R5900 -D___mips -D__OPTIMIZE__ -D__LANGUAGE_C -D_LANGUAGE_C -DLANGUAGE_C -D__SIZE_TYPE__=unsigned -D__PTRDIFF_TYPE__=int -D__LONG_MAX__=9223372036854775807L -U__mips -D__mips=3 -D__mips64 -D__mips_eabi -D__mips_single_float /tmp/code.c /tmp\ccGaaaaa.i
GNU CPP version 2.95.2 v2 [AL 1.1, MM 40] BSD Mips
#include "..." search starts here:
End of search list.
 /backend/compilers/ps2/ee-gcc2.95.2-273a/lib/gcc-lib/ee/2.95.2/cc1.exe /tmp\ccGaaaaa.i -quiet -dumpbase code.c -O2 -version -o /tmp\cccbaaaa.s
GNU C version 2.95.2 SN BUILD v2.73a for Playstation2 (ee) compiled by CC.
 /backend/compilers/ps2/ee-gcc2.95.2-273a/lib/gcc-lib/ee/2.95.2/as.exe -O2 -v -mabi=eabi -o /tmp/object.o /tmp\cccbaaaa.s
GNU assembler version 2.9-ee-991111b (ee) using BFD version 2.9-ee-991111

I'm not sure what's going wrong. It is able to read the specs file which sits alongside the cpp.exe binary (although the log suggests that wine fully expands the path).

Edit:

Running cpp.exe manually via wibo works:

$ ~/github/wibo/build/wibo cpp.exe -E test.c 
# 1 "test.c"
int foobar(char x) {
  return 123;
}

OK, it's due to the backslashes. The command decomp.me wants to execute is like this:

~/github/wibo/build/wibo backend/compilers/ps2/ee-gcc2.95.2-273a/lib/gcc-lib/ee/2.95.2/cpp.exe -lang-c -v -I Z:\backend\compilers\ps2\ee-gcc2.95.2-273a\bin\..\lib/gcc-lib/ee\2.95.2\ -isystem /backend/compilers/ps2/ee-gcc2.95.2-273a/lib/gcc-lib/ee/2.95.2/include -D__GNUC__=2 -D__GNUC_MINOR__=95 -Dmips -DMIPSEL -DR5900 -D_mips -D_MIPSEL -D_R5900 -D__mips__ -D__MIPSEL__ -D__R5900__ -D___mips__ -D_MIPSEL -D_R5900 -D__mips -D__MIPSEL -D__R5900 -D___mips -D__OPTIMIZE__ -D__LANGUAGE_C -D_LANGUAGE_C -DLANGUAGE_C -D__SIZE_TYPE__=unsigned -D__PTRDIFF_TYPE__=int -D__LONG_MAX__=9223372036854775807L -U__mips -D__mips=3 -D__mips64 -D__mips_eabi -D__mips_single_float test.c /tmp\ccbaaaaa.i

but swapping out \ for / works:

~/github/wibo/build/wibo backend/compilers/ps2/ee-gcc2.95.2-273a/lib/gcc-lib/ee/2.95.2/cpp.exe -lang-c -v -I Z:/backend/compilers/ps2/ee-gcc2.95.2-273a/bin/../lib/gcc-lib/ee/2.95.2/ -isystem /backend/compilers/ps2/ee-gcc2.95.2-273a/lib/gcc-lib/ee/2.95.2/include -D__GNUC__=2 -D__GNUC_MINOR__=95 -Dmips -DMIPSEL -DR5900 -D_mips -D_MIPSEL -D_R5900 -D__mips__ -D__MIPSEL__ -D__R5900__ -D___mips__ -D_MIPSEL -D_R5900 -D__mips -D__MIPSEL -D__R5900 -D___mips -D__OPTIMIZE__ -D__LANGUAGE_C -D_LANGUAGE_C -DLANGUAGE_C -D__SIZE_TYPE__=unsigned -D__PTRDIFF_TYPE__=int -D__LONG_MAX__=9223372036854775807L -U__mips -D__mips=3 -D__mips64 -D__mips_eabi -D__mips_single_float test.c /tmp/ccbaaaaa.i

I feel like a blind 'find-replace' of \ to / is going to be lead to issues, but I dont know what the right way to solve this is? a heuristic to guess if a string containing \ is a path?

Further testing, it's these two arguments that are breaking the command:

  1. The final backslash here Z:\backend\compilers\ps2\ee-gcc2.95.2-273a\bin..\lib/gcc-lib/ee\2.95.2\
  2. The backslash in the output filename /tmp\ccbaaaaa.i

So a potential fix could be to replace all \ if the string contains any /?

@mkst
Copy link
Contributor Author

mkst commented Oct 17, 2023

Using main the command works, but still not right in decomp.me CI, will investigate.

$ ~/github/wibo/build/wibo ./ee-gcc.exe -v -S ~/github/wibo/sn64/test.cpp 
Reading specs from Z:\home\mark\github\decomp.me\backend\compilers\ps2\ee-gcc2.95.2-273a\bin\..\lib/gcc-lib/ee\2.95.2\specs
gcc driver version 2.9-ee-991111b/r4 executing gcc version 2.95.2-EE
 Z:\home\mark\github\decomp.me\backend\compilers\ps2\ee-gcc2.95.2-273a\bin\..\lib/gcc-lib/ee\2.95.2\cpp.exe -lang-c++ -v -I Z:\home\mark\github\decomp.me\backend\compilers\ps2\ee-gcc2.95.2-273a\bin\..\lib/gcc-lib/ee\2.95.2\ -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=95 -Dmips -DMIPSEL -DR5900 -D_mips -D_MIPSEL -D_R5900 -D__mips__ -D__MIPSEL__ -D__R5900__ -D___mips__ -D_MIPSEL -D_R5900 -D__mips -D__MIPSEL -D__R5900 -D___mips -D__EXCEPTIONS -D__LANGUAGE_C -D_LANGUAGE_C -DLANGUAGE_C -D__SIZE_TYPE__=unsigned -D__PTRDIFF_TYPE__=int -D__LONG_MAX__=9223372036854775807L -U__mips -D__mips=3 -D__mips64 -D__mips_eabi -D__mips_single_float /home/mark/github/wibo/sn64/test.cpp \tmp\ccNtFaaa.ii
GNU CPP version 2.95.2 v2 [AL 1.1, MM 40] BSD Mips
#include "..." search starts here:
End of search list.
 Z:\home\mark\github\decomp.me\backend\compilers\ps2\ee-gcc2.95.2-273a\bin\..\lib/gcc-lib/ee\2.95.2\cc1plus.exe \tmp\ccNtFaaa.ii -quiet -dumpbase test.cc -version -o test.s
GNU C++ version 2.95.2 SN BUILD v2.73a for Playstation2 (ee) compiled by CC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant