ps2dev / ps2sdk-ports

Ports of useful libraries to PS2SDK
Other
107 stars 43 forks source link

GTest fails to build with missing fileno / fdopen #172

Open jendo42 opened 1 month ago

jendo42 commented 1 month ago

I encountered this build issue

/home/jendo/Sources/ps2dev/build/ps2sdk-ports/build/googletest/googletest/include/gtest/internal/gtest-port.h:2021:40:
error: 'fileno' was not declared in this scope; did you mean 'FileNo'?
 2021 | inline int FileNo(FILE* file) { return fileno(file); }
      |                                        ^~~~~~
      |                                        FileNo
/home/jendo/Sources/ps2dev/build/ps2sdk-ports/build/googletest/googletest/include/gtest/internal/gtest-port.h: In function 'FILE* testing::internal::posix::FDOpen(int, const char*)':
/home/jendo/Sources/ps2dev/build/ps2sdk-ports/build/googletest/googletest/include/gtest/internal/gtest-port.h:2104:56:
error: 'fdopen' was not declared in this scope; did you mean 'fopen'?
 2104 | inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
      |                                                        ^~~~~~
      |                                                        fopen
In file included from /home/jendo/Sources/ps2dev/build/ps2sdk-ports/build/googletest/googletest/src/gtest-all.cc:45:
/home/jendo/Sources/ps2dev/build/ps2sdk-ports/build/googletest/googletest/src/gtest-port.cc: In constructor 'testing::internal::CapturedStream::CapturedStream(int)':
/home/jendo/Sources/ps2dev/build/ps2sdk-ports/build/googletest/googletest/src/gtest-port.cc:1100:31: error: '::mkstemp' has not been declared
 1100 |     const int captured_fd = ::mkstemp(const_cast<char*>(name_template.data()));
      |                               ^~~~~~~
make[3]: *** [googletest/CMakeFiles/gtest.dir/build.make:63: googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.obj] Error 1
make[3]: Leaving directory '/home/jendo/Sources/ps2dev/build/ps2sdk-ports/build/googletest/build_ee'
make[2]: *** [CMakeFiles/Makefile2:227: googletest/CMakeFiles/gtest.dir/all] Error 2
make[2]: Leaving directory '/home/jendo/Sources/ps2dev/build/ps2sdk-ports/build/googletest/build_ee'
make[1]: *** [Makefile:141: all] Error 2
make[1]: Leaving directory '/home/jendo/Sources/ps2dev/build/ps2sdk-ports/build/googletest/build_ee'
make: *** [Makefile:56: cmakelibs] Error 2
make: *** Waiting for unfinished jobs....

When I added -DGTEST_HAS_FILE_SYSTEM=0 then it compiled. Maybe some changes in c glue?