Author Topic: macOS  (Read 6556 times)

cassette

  • Full Member
  • ***
  • Posts: 170
  • Karma: +1/-0
    • View Profile
macOS
« on: May 18, 2020, 01:07:08 AM »
I'm trying to compile on macOS, without success. https://bitbucket.org/phulshof/retrofe/src/default/#markdown-header-mac-download-and-compile-retrofe-from-source-code

At

Code: [Select]
cd retrofe
cmake RetroFE/Source -BRetroFE/Build -DVERSION_MAJOR=0 -DVERSION_MINOR=0 -DVERSION_BUILD=0

I get

Code: [Select]
-- Checking for one of the modules 'sdl2'
CMake Error at /usr/local/Cellar/cmake/3.17.1/share/cmake/Modules/FindPkgConfig.cmake:711 (message):
  None of the required 'sdl2' found
Call Stack (most recent call first):
  CMakeLists.txt:50 (pkg_search_module)

-- Checking for one of the modules 'SDL2_image'
CMake Error at /usr/local/Cellar/cmake/3.17.1/share/cmake/Modules/FindPkgConfig.cmake:711 (message):
  None of the required 'SDL2_image' found
Call Stack (most recent call first):
  CMakeLists.txt:51 (pkg_search_module)

-- Checking for one of the modules 'SDL2_mixer'
CMake Error at /usr/local/Cellar/cmake/3.17.1/share/cmake/Modules/FindPkgConfig.cmake:711 (message):
  None of the required 'SDL2_mixer' found
Call Stack (most recent call first):
  CMakeLists.txt:52 (pkg_search_module)

-- Checking for one of the modules 'SDL2_ttf'
CMake Error at /usr/local/Cellar/cmake/3.17.1/share/cmake/Modules/FindPkgConfig.cmake:711 (message):
  None of the required 'SDL2_ttf' found
Call Stack (most recent call first):
  CMakeLists.txt:53 (pkg_search_module)

-- Checking for one of the modules 'zlib'
CMake Error at /usr/local/Cellar/cmake/3.17.1/share/cmake/Modules/FindPkgConfig.cmake:711 (message):
  None of the required 'zlib' found
Call Stack (most recent call first):
  CMakeLists.txt:54 (pkg_search_module)

CMake Error at /usr/local/Cellar/cmake/3.17.1/share/cmake/Modules/FindPkgConfig.cmake:515 (message):
  pkg-config tool not found
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.17.1/share/cmake/Modules/FindPkgConfig.cmake:647 (_pkg_check_modules_internal)
  CMakeLists.txt:55 (pkg_check_modules)

CMake Error at /usr/local/Cellar/cmake/3.17.1/share/cmake/Modules/FindPkgConfig.cmake:515 (message):
  pkg-config tool not found
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.17.1/share/cmake/Modules/FindPkgConfig.cmake:647 (_pkg_check_modules_internal)
  CMakeLists.txt:56 (pkg_check_modules)

I don't understand what this means, but looking at the steps before, these come to mind:

1. Not sure "export LIBRARY_PATH=/usr/local/opt/gst-plugins-base/lib:/usr/local/opt/gstreamer/lib:/usr/local/lib:/usr/local/opt/glib/lib:/usr/local/opt/gettext/lib" did anything, although it doesn't output any errors
2. "...install the same dependencies as given in the linux instuctions" are listed with apt-get. I could install some by replacing it with brew, but not the ones below:

Code: [Select]
brew install g++
brew install zlib1g-dev
brew install gstreamer1.0-libav
brew install libsdl2-2.0
brew install libglib2.0-0
brew install libglib2.0-dev
brew install libsdl2-dev
brew install libsdl2-mixer-2.0
brew install libsdl2-image-2.0
brew install libsdl2-ttf-2.0
brew install libsdl2-mixer-dev
brew install libsdl2-image-dev
brew install libsdl2-ttf-dev
brew install libgstreamer1.0-dev
brew install libgstreamer-plugins-base1.0-dev
brew install libgstreamer-plugins-good1.0-dev

I would also welcome any chance at a compiled RetroFE for macOS.

cassette

  • Full Member
  • ***
  • Posts: 170
  • Karma: +1/-0
    • View Profile
Re: macOS
« Reply #1 on: May 18, 2020, 06:16:24 AM »
Made some progress. Digging an old post I was linked to a page with better instructions for macOS https://bitbucket.org/RetroPrime/retrofe/src/default/ This led me to successfully install the required libraries via brew.

I'm now at an error when compiling

Code: [Select]
cmake --build RetroFE/Build
Scanning dependencies of target retrofe
[  2%] Building CXX object CMakeFiles/retrofe.dir/Collection/CollectionInfo.cpp.o
[  4%] Building CXX object CMakeFiles/retrofe.dir/Collection/CollectionInfoBuilder.cpp.o
[  6%] Building CXX object CMakeFiles/retrofe.dir/Collection/Item.cpp.o
[  8%] Building CXX object CMakeFiles/retrofe.dir/Collection/MenuParser.cpp.o
/Users/firewater/retrofe/RetroFE/Source/Collection/MenuParser.cpp:100:55: error: expected expression
        std::sort(menuItems.begin(), menuItems.end(), [](Item *a, Item *b) {return Utils::toLower(a->fullTitle) <= Utils::toLower(b->fullTitle);});
                                                      ^
1 error generated.
make[2]: *** [CMakeFiles/retrofe.dir/Collection/MenuParser.cpp.o] Error 1
make[1]: *** [CMakeFiles/retrofe.dir/all] Error 2
make: *** [all] Error 2

walknight

  • Newbie
  • *
  • Posts: 24
  • Karma: +4/-1
    • View Profile
Re: macOS
« Reply #2 on: May 18, 2020, 07:45:50 AM »
Looks like your compiler does not understand C++11 syntax.
What is your gcc version?

Try edit RetroFE/Source/CMakeLists.txt and change
Code: [Select]
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -ggdb")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
to
Code: [Select]
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -ggdb -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11")

cassette

  • Full Member
  • ***
  • Posts: 170
  • Karma: +1/-0
    • View Profile
Re: macOS
« Reply #3 on: May 19, 2020, 08:21:57 AM »
I've compiled it now! Thank you so much!!! It was either the code you wrote, or updating gcc with brew install gcc.
« Last Edit: May 19, 2020, 08:27:16 AM by firewater »

cassette

  • Full Member
  • ***
  • Posts: 170
  • Karma: +1/-0
    • View Profile
Re: macOS
« Reply #4 on: May 21, 2020, 10:36:57 PM »
Actually, it's not working ): RetroFE crashes when I reach inside a collection. I do have to change what you said, it doesn't compile otherwise.

Code: [Select]
  set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -ggdb")
  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -ggdb")
  set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")

to:

Code: [Select]
  set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -ggdb")
  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -ggdb -std=c++11")
  set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11")

produces:

https://pastebin.com/g24S8TZu

I then finish with:

Code: [Select]
python Scripts/Package.py --os=mac --build=full
When I enter, the opening video renders without image but with sound. When it finishes, I can move around the main collection, but entering one crashes RetroFE. That's with the built from the time I last posted, following what you saw in this post, I've compiled it from 0, and now crashes after the video ends. Any idea?

walknight

  • Newbie
  • *
  • Posts: 24
  • Karma: +4/-1
    • View Profile
Re: macOS
« Reply #5 on: May 21, 2020, 10:47:35 PM »
Maybe there's some clue in log.txt?

cassette

  • Full Member
  • ***
  • Posts: 170
  • Karma: +1/-0
    • View Profile
Re: macOS
« Reply #6 on: May 22, 2020, 12:41:27 AM »
Thanks for your response. I didn't post it because I'm fairly sure it isn't much help. Compared to a Windows install, it's just not working properly out of the box, and RetroFE doesn't log this type of thing on the file. Here is the log with the compiled version that gets me the furthest, using my settings from my old Windows build: https://pastebin.com/Eb8m8FEy

I'm hopeful it's something about the gcc c+11 compatibility that you've mentioned. There's some clue to it here https://bitbucket.org/phulshof/retrofe/issues/27/compilation-c-11-missing-error-on-ubuntu but the fix given fails on macOS at just about the last step when compiling:

Code: [Select]
[ 98%] Building C object CMakeFiles/retrofe.dir/Users/firewater/retrofe/RetroFE/ThirdParty/sqlite3/sqlite3.c.o
error: invalid argument '-std=c++0x' not allowed with 'C'

I'd like to compile it again without relying on these forceful fixes. I'm not a programmer, so when I look "gcc macos c+11 enable" up I get confused with all the terminology. brew tells me I'm running gcc 9.3.0_1, but obviously that's not enough to default since the syntax error mentioned above keeps happening. How do I properly enable c+11 for gcc?
« Last Edit: May 22, 2020, 01:28:46 AM by firewater »

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1534
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: macOS
« Reply #7 on: May 22, 2020, 06:47:20 AM »
Video playing without sound is generally because of missing gstreamer codecs: libgstreamer-plugins-good1.0-dev if I’m not mistaken.

cassette

  • Full Member
  • ***
  • Posts: 170
  • Karma: +1/-0
    • View Profile
Re: macOS
« Reply #8 on: May 23, 2020, 12:11:58 AM »
Thanks for the clue, it's probably that then since I've now compiled properly with c+11 syntax adding below to CMakeLists.txt
Code: [Select]
set (CMAKE_CXX_STANDARD 11)and it still doesn't work. But wouldn't the process fail and tell me it's missing when checking for dependencies before compiling? To be clear the video plays with sound, but without image.
Code: [Select]
brew install cmake mercurial gst-plugins-bad gst-plugins-good sdl2_mixer sdl2_image sdl2_ttf sqlite dos2unixIs the code given in one of the links, probably missing some then?

Crash log: https://pastebin.com/4ARPxUp8
« Last Edit: May 24, 2020, 03:52:41 AM by firewater »

walknight

  • Newbie
  • *
  • Posts: 24
  • Karma: +4/-1
    • View Profile
Re: macOS
« Reply #9 on: May 23, 2020, 04:17:21 AM »
There's some clue in the crash log.

Code: [Select]
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_pthread.dylib         0x00007fff748f434c pthread_mutex_lock + 0
1   libsystem_c.dylib               0x00007fff74652308 closedir + 25
2   com.retrofe.RetroFE             0x000000010aaba94c MenuParser::buildTextMenu(CollectionInfo*, bool) + 7852
3   com.retrofe.RetroFE             0x000000010aab8a5e MenuParser::buildMenuItems(CollectionInfo*, bool) + 62
4   com.retrofe.RetroFE             0x000000010abf4bff RetroFE::getCollection(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) + 5695
5   com.retrofe.RetroFE             0x000000010abe517c RetroFE::run() + 14380
6   com.retrofe.RetroFE             0x000000010abd9da0 main + 5120
7   libdyld.dylib                   0x00007fff745de015 start + 1

So it crashed when calling closedir(dp), where dp is most likely a null pointer.
It's possible that on MacOS closedir(NULL) causes a crash but on Linux it's fine.

A quick fix to try is to change
Code: [Select]
closedir(dp);
to
Code: [Select]
if _dp_ closedir(dp);
Note: replace the underscore with parenthesis around "dp". It seems there's an issue when I type that. Every time I type that my post will disappear.

If this is indeed the issue you need to change all occurrences of closedir(dp). Just do a grep or in the current source they are in the following files:
Code: [Select]
Collection/MenuParser.cpp
Collection/CollectionInfoBuilder.cpp
Database/MetadataDatabase.cpp
Main.cpp
RetroFE.cpp

Pieter Hulshoff

  • Administrator
  • Hero Member
  • *****
  • Posts: 1534
  • Karma: +46/-14
    • View Profile
    • Towel 42
Re: macOS
« Reply #10 on: May 23, 2020, 12:34:26 PM »
Sounds like something I could fix then. That's not a lot of changes to make. :)

walknight

  • Newbie
  • *
  • Posts: 24
  • Karma: +4/-1
    • View Profile
Re: macOS
« Reply #11 on: May 23, 2020, 04:15:10 PM »
Thanks Pieter! I guess it doesn't hurt to add those checks even it's not the real issue.
Pieter have you considered to use Boost? Boost is famed for its portability and high code quality. I see many utilities and file system operations in RetroFE can be done with Boost without worrying about different platforms.
Things like traversing a directory can be done with boost::filesystem. Actually that library is now in C++17 but some older compilers may not support C++17 yet.
The drawback is of course another dependency. Many Boost libs are header only but boost::filesystem does need linking.
« Last Edit: May 23, 2020, 04:20:06 PM by walknight »

cassette

  • Full Member
  • ***
  • Posts: 170
  • Karma: +1/-0
    • View Profile
Re: macOS
« Reply #12 on: May 24, 2020, 04:12:33 AM »
Thanks! I'd never sort that out by myself. Although, having now compiled the latest version, it still crashes the same way ): Here's the latest crash log: https://pastebin.com/mLi0GzW1

I would test a pre-compiled macOS release, if any of you are able able to provide it, perhaps I'm doing something wrong at that stage. The furthest I've managed was the aforementioned version where I got past the intro video crash into the main collection menu, until it then crashes upon entering any collection. I don't remember how that version was compiled. Here is the crash log of it: https://pastebin.com/nw6y8MQQ
« Last Edit: May 24, 2020, 04:24:49 AM by firewater »

walknight

  • Newbie
  • *
  • Posts: 24
  • Karma: +4/-1
    • View Profile
Re: macOS
« Reply #13 on: May 27, 2020, 04:28:09 PM »
The last crash log points to something related to font. But I have a feeling that something else might pop up if we try to fix this one.
I'm afraid this needs some involved debugging with a Mac. Sadly I don't have one.

cassette

  • Full Member
  • ***
  • Posts: 170
  • Karma: +1/-0
    • View Profile
Re: macOS
« Reply #14 on: June 02, 2020, 07:49:52 AM »
Thank you for the answer. I'm still very much interested on this... feels particularly frustrating when I can get inside and just about enter the menu to load games! If there's any chance someone will compile some version for me to try, I'll 100% be here to test it.