aldostools / webMAN-MOD

Extended services for PS3 console (web server, ftp server, netiso, ntfs, ps3mapi, etc.)
https://aldostools.github.io/webMAN-MOD/
GNU General Public License v3.0
1.32k stars 175 forks source link

ps3netsrv : trying to compile on synology ds212j #345

Open Gis70 opened 4 years ago

Gis70 commented 4 years ago

Hi,

I'm trying to compile ps3netsrv for a NAS synology ds212j but i encountered an error :

make gcc -Wall -I./include -I./polarssl-1.3.2/include -std=gnu99 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DPOLARSSL -D_OS_WINDOWS -static -O3 -s -DNDEBUG -Wall -I./include -I./polarssl-1.3.2/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DPOLARSSL -D_OS_WINDOWS -static -O3 -s -DNDEBUG -c -o src/scandir.o src/scandir.c In file included from src/scandir.c:6: ./include/dirent2.h:30:16: error: io.h: No such file or directory src/scandir.c:118:2: warning: no newline at end of file make: *** [src/scandir.o] Error 1

I don't know what is IO.h i don't find it on google.

Does somebody could help me ?

Thx

kam821 commented 4 years ago

@Gis70 @aldostools If you want to compile ps3netsrv based on polarssl, edit Make.sh and then compile By default the line "make -C polarssl-1.3.2/library" is missing.

#!/bin/bash

if [ -f polarssl-1.3.2/bin/libpolarssl-linux.a ]
then
        mv polarssl-1.3.2/bin/libpolarssl-linux.a polarssl-1.3.2/library/libpolarssl.a
fi

make -C polarssl-1.3.2/library

if [ -f Makefile.linux ]
then
        mv Makefile Makefile.win
        mv Makefile.linux Makefile
fi

make
kam821 commented 4 years ago

@aldostools Another issue(?) is that ps3netsrv compilation instruction (Readme) by using meson/ninja may be misleading for beginners.

This command prepares environment in buildrelease directory. meson buildrelease --buildtype=release

But this executes compilation in builddir directory. ninja -C builddir

It may be a good idea to change one line to keep both names the same.

aldostools commented 4 years ago

@kam821 Thank you for the suggestion.

I don't use meson and I don't know its parameters. I use Windows. That code was submitted by another user.

If you know a better way to use it, please submit the fix (it can be a zip with the corrected files) and I'll be glad to make the changes in the repository.

Gis70 commented 4 years ago

Hello thank you for your reply, but It doesn't work, i can't compile, I have the same errors

aptonline commented 4 years ago

I’d recommend installing docker on the Synology and using the available docker image which works great.

https://hub.docker.com/r/shawly/ps3netsrv

UPDATE: Sorry didn’t see the Synology DiskStation you were using, DS212 isn’t supported for docker :(

kelesi commented 4 years ago

I was able to compile and statically link the 20200519 version on Linux Mint for my Libreelec box. I compiled two versions - one using Makefile in root (using polarssl) and one using Meson/Ninja (using mbedtls). Both run, but fail to mount games. The older linux binary works fine (https://github.com/aldostools/webMAN-MOD/tree/master/Projects/ps3netsrv/bins/Linux)

The error message: viso error: failed to create virtual iso open error on "/GAMES/BLUSxxxx-XXXXXX" (viso=1) viso error: closing viso

Is the issue related to used libraries or does the new version break Linux compatibility?

kam821 commented 4 years ago

@kelesi @aldostools Confirm. 20200519/mbedtls version - PS3ISOs work fine, but when I tried to mount PSPISO, same message appears (only difference is viso=2)

aldostools commented 4 years ago

viso=2 means that the folder is being mounted as BDISO, instead of as a PS3ISO.

remote folder /PSPISO cannot be mounted with the current build of webMAN MOD. This commit 6fcc81691a36d0d6486c6d2110c4b03571763074 already fixes the issue, but the binaries are not updated yet.

kelesi commented 4 years ago

@aldostools What about viso=1? I compiled linux version of ps3netsrv using the commit you mentioned. I cannot mount any game in GAMES folder. Old prebuilt version works fine.

aldostools commented 4 years ago

I uploaded a new commit of webMAN MOD with the changes that I mentioned...

I have tested mounting several games in GAMES and they mount fine on Windows 10.

This is the latest build of ps3netsrv 20200519A (with source code included): ps3netsrv_20200519A.zip

kelesi commented 4 years ago

This is the latest build of ps3netsrv 20200519A (with source code included): ps3netsrv_20200519A.zip

Compiled with your latest commit, but unfortunately still the same issue. PS3ISO mounts ok, mounting from GAMES fails:

viso error: failed to create virtual iso 
open error on "/GAMES/BLUSxxxx-XXXXXX" (viso=1)
viso error: closing viso
aldostools commented 4 years ago

Please try compiling the project using the VIsoFile.cpp and VIsoFile.h from the original project: https://github.com/aldostools/webMAN-MOD/blob/master/_Projects_/ps3netsrv/bins/old/ps3netsrv-src-deank.7z

I wonder why it is working properly on my Windows 10.

Are you using linux? What flavor?

kelesi commented 4 years ago

I compiled and linked it statically on Linux Mint 19.3 and I am running it on LibreELEC. I tried the Windows build from my desktop and this indeed works.

I will try your suggestion and report back.

kelesi commented 4 years ago

Compiled binary after replacing the files is working.

aldostools commented 4 years ago

Thank you for your feedback

aldostools commented 4 years ago

ps3netsrv 20200519B now uses the original untouched VisoFile.cpp from Cobra Team for linux builds. Window builds use my modded version that provide better performance building the viso, additional memory checks and report more error messages. https://github.com/aldostools/webMAN-MOD/releases/download/1.47.27/ps3netsrv_20200519B.zip

kelesi commented 4 years ago

Thanks for support. I tried to find out the cause of the issue. I added some debug messages and it fails in VIsoFile::build in this part for empty directories: if (count < 0 || !dirs) return false;

The original code just checks for count <0. I changed it to: if (count < 0 || (count > 0 && !dirs)) return false;

But now it fails with buffer overflow in the next part where it gathers the files.

kelesi commented 4 years ago

Good news. The buffer overflows are present only when building using meson/ninja and mbedtls. After the small change above and building just with make and polarssl, it works without problems. So after all we don't need different VIsoFile versions for Windows and Linux. Should I create a PR?

aldostools commented 4 years ago

@kelesi Thank you for your feedback. In if (count < 0 || !dirs) return false; the compiler is misinterpreting the expression as if(count < (0 || !dirs)) return false; The expression is corrected using explicit parentesis : if ((count < 0) || (!dirs)) return false;

That explains why it works with my compiler, but not with yours.

I have updated several expressions like that in main,cpp and VisoFile_mod.cpp of this build: ps3netsrv_20200520.zip

I also replaced the original VisoFile.cpp with a true untoched version. The previous build had an incorrect name in the include.

kelesi commented 4 years ago

@aldostools Thanks for fast fix.

It works fine now with the polarssl build (using VIsoFile_mod.cpp). I still get buffer overflow for the meson/mbedtls build (regardless if using VIsoFile.cpp or VIsoFile_mod.cpp). I created a PR, where I updated the readme files according to this and also updated the static x86_x64 binary with my working build.

shawly commented 4 years ago

For anyone that doesn't want to compile ps3netsrv for their Synology, my Docker image for ps3netsrv supports ARM. I also just updated it to the latest version 20200520.

https://github.com/shawly/docker-ps3netsrv

aldostools commented 4 years ago

For anyone that doesn't want to compile ps3netsrv for their Synology, my Docker image for ps3netsrv supports ARM. I also just updated it to the latest version 20200520.

https://github.com/shawly/docker-ps3netsrv

Awesome!!

shawly commented 4 years ago

For anyone that doesn't want to compile ps3netsrv for their Synology, my Docker image for ps3netsrv supports ARM. I also just updated it to the latest version 20200520. https://github.com/shawly/docker-ps3netsrv

Awesome!!

Wouldn't be possible without your work! 👍

JostenSyon commented 3 years ago

@shawly unfortunately my device doesn't support (poor support) docker (old mycloud v1 device), I tried to compile the same binary for arm but unsuccessfully. I must use a old version for raspberry that crashes every time I copy a game xD using file on it: ps3netsrv_raspberry: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=0xd586e36ce34daff6379b2320f54c4248d7f4acd8, not stripped