pocomane / MiSTer_Batch_Control

Simple utility to control the MiSTer FPGA from the command line
47 stars 8 forks source link

Compiling fails #6

Closed mrchrisster closed 3 years ago

mrchrisster commented 3 years ago

Trying to compile my own version arm-linux-gnueabihf-gcc: error: unrecognized command line option ‘-std-c99’; did you mean ‘-std=c99’? When I use arm-linux-gnueabihf-gcc -std=c99 -D_XOPEN_SOURCE=700 -o mbc mbc.c

I get a binary that is half the size of the official release and doesnt work

-rwxr-xr-x 1 root root 30K Apr 3 02:00 mbc

Same when using arm-linux-musleabihf-gcc -std=c99 -D_XOPEN_SOURCE=700 -o mbc mbc.c

pocomane commented 3 years ago

Did you change the compile script? The current version contains:

arm-linux-musleabihf-gcc -std=c99 -D_XOPEN_SOURCE=700 -static -O2 -o mbc ../mbc.c ||die

so -std=c99, not -std-c99 as reported from your previous error.

Please also note the -static flag: without it a dynamic binary is generated, that does not works on MiSTer since the rest of the code is compiled with glibc instead of muslc. Theoretically, you can use a standard gcc with glibc to make a dynamic binary, but in practice you have to pay attention to the glibc version, gcc compiler etc. This is was the primary reason why I decided to use gcc + muslc + static for such simple tools: it produces very portable binaries.

For the size, the current build.sh contains:

arm-linux-musleabihf-strip mbc ||die

that it is needed exactly to reduce the file size (dropping all the debug and linking information)

pocomane commented 3 years ago

Sorry, I just realized you probably was talking of the single-line in the Readme. I fixed it. For the size, the strip trick is still valid.

mrchrisster commented 3 years ago

I was indeed :) Thanks for your awesome script btw, it adds much needed functionality to MiSTer. I'll try compiling again later. I'm working together with Mellified on integrating mbc into our Attract script ( https://github.com/mrchrisster/mister-arcade-attract/ ) We both use cifs shares with MiSTer and unfortunately mbc doesn't seem to like it. I'm just trying to confirm that webmenu doesnt have this issue but I'm also getting some weird behaviour with webmenu when using cifs

mrchrisster commented 3 years ago

I can compile a working version of mbc now with static flag, thanks. I'm trying to understand why /media/fat/games/neogeo# mbc load_rom NEOGEO "/media/fat/games/NeoGeo/Last Resort (lresort).neo" 427 - error - No such file or directory - Can not resolve /media/fat/games/NeoGeo/Last Resort (lresort).neo 451 - error - No such file or directory - Can not bind the rom 459 - error - No such file or directory - Can not unbind the rom produces an error when the directory is mounted through mount_cifs.sh but works fine when no share is mounted. Looking at your source code char* rpath = realpath(path, 0); seems to be the culprit. The directory " !!!MBC" gets created btw. Any idea?

pocomane commented 3 years ago

I do not know how CIFS mount works. It seems wierd that they have issue with realpath: it is a standard posix function that resolves relative paths. You can try to disable it (rpath = path), but you could lose the ability to use relative path for roms (actually, re-reading the code, it seems just defensive programming to me, so it can be that all will work anyway without it).

However I am looking to how to implement the mount-trick used in WebMenu (see #5 ) that could fix the CIFS issue. It should also avoid the creation of strange looking dirs and files.

mrchrisster commented 3 years ago

That fixed it! CIFS shares are working fine now with char* rpath = path;, awesome! The mount-trick sounds like a big improvement. Not really loving all the " !!!MBC" subfolders, appreciate you are working this into the new version of mbc! Happy Easter :)

pocomane commented 3 years ago

I close this issue. For the mount/realpath/CIFS issue we can refer to this issue.