christopherpow / nesicide

Integrated Development Environment for the 8-bit Nintendo Entertainment System
318 stars 38 forks source link

MacOS fatal error: 'SDL.h' file not found #45

Open pedroafabri opened 5 years ago

pedroafabri commented 5 years ago

I'm using MacOs 10.14.5. Qt 5.6.2

Cloned the repo, fixed some minor stuff and got stuck at this error:

emulator/nesemulatorthread.cpp:24:10: fatal error: 'SDL.h' file not found
#include <SDL.h>
         ^~~~~~~
1 error generated.
make[1]: *** [release/nesemulatorthread.o] Error 1
make: *** [sub-------apps-nes-emulator-nesicide-emulator-pro-make_first] Error 2
Building FamiPlayer...
cd ../../deps/rtmidi/ && ( test -e Makefile || /Users/fabri/Qt5.6.2/5.6/clang_64/bin/qmake /Users/fabri/Desktop/nesicide/deps/rtmidi/rtmidi.pro -o Makefile ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile 
Cannot find file: /Users/fabri/Desktop/nesicide/deps/rtmidi/rtmidi.pro.
make: *** [sub-------deps-rtmidi-rtmidi-pro-make_first] Error 2
Building NES Emulator...
cd ../../deps/rtmidi/ && ( test -e Makefile || /Users/fabri/Qt5.6.2/5.6/clang_64/bin/qmake /Users/fabri/Desktop/nesicide/deps/rtmidi/rtmidi.pro -o Makefile ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile 
Cannot find file: /Users/fabri/Desktop/nesicide/deps/rtmidi/rtmidi.pro.
make: *** [sub-------deps-rtmidi-rtmidi-pro-make_first] Error 2

What I've changed in the project so far:

diff --git a/apps/ide/mainwindow.cpp b/apps/ide/mainwindow.cpp
index 73da9aee..54d68d38 100644
--- a/apps/ide/mainwindow.cpp
+++ b/apps/ide/mainwindow.cpp
@@ -371,7 +371,7 @@ MainWindow::MainWindow(CProjectModel *projectModel, QWidget* parent) :
    m_menuRecentFiles = new QMenu("Recent Projects/Files...",menuProject);
    for ( idx = 0; idx < MAX_RECENT_FILES; idx++ )
    {
-      QAction* action = new QAction("Recent File "+QString::number(idx+1));
+      QAction* action = new QAction("Recent File "+QString::number(idx+1), NULL);
       QObject::connect(action,SIGNAL(triggered(bool)),this,SLOT(openRecentFile()));
       m_menuRecentFiles->addAction(action);
    }
diff --git a/apps/nes-emulator/mainwindow.cpp b/apps/nes-emulator/mainwindow.cpp
index 9e219eab..b1ec0561 100644
--- a/apps/nes-emulator/mainwindow.cpp
+++ b/apps/nes-emulator/mainwindow.cpp
@@ -95,7 +95,7 @@ MainWindow::MainWindow(QWidget* parent) :
    ui->actionRecent_Files_STOP->setVisible(false);
    for ( idx = 0; idx < MAX_RECENT_FILES; idx++ )
    {
-      QAction* action = new QAction("Recent File "+QString::number(idx+1));
+      QAction* action = new QAction("Recent File "+QString::number(idx+1), NULL);
       QObject::connect(action,SIGNAL(triggered(bool)),this,SLOT(openRecentFile()));
       ui->menuFile->insertAction(ui->actionRecent_Files_START,action);
       m_recentFileActions.append(action);
diff --git a/build/osx-build.sh b/build/osx-build.sh
index 316d0529..e3325a59 100755
--- a/build/osx-build.sh
+++ b/build/osx-build.sh
@@ -14,10 +14,10 @@ fi

 # add CONFIG+=debug to qmake to build debug.
 echo Building NESICIDE...
-( cd build/ide; qmake; make )
+( cd ide; qmake; make )
 echo Building FamiTracker...
-( cd build/nes-emulator; qmake; make )
+( cd nes-emulator; qmake; make )
 echo Building FamiPlayer...
-( cd build/famiplayer; qmake; make )
+( cd famiplayer; qmake; make )
 echo Building NES Emulator...
-( cd build/famitracker; qmake; make )
+( cd famitracker; qmake; make )

I've updated the ./osx-build.sh to look for the files in the correct directory and added "NULL" at QAction constructor, although I know nothing about QT.

But, after all that, got stuck at this error.

bolinfest commented 4 years ago

Same issue on Catalina with qt 5.15.1 (though admittedly https://github.com/christopherpow/nesicide/ mandates Qt 5.12.6...)

christopherpow commented 4 years ago

I don't have the bandwidth to test moving to a new Qt version, but the SDL.h dependency should be located in the dependencies package that the build script downloads -- shouldn't be related to Qt version.

bolinfest commented 4 years ago

@christopherpow ah, I think I figured out my issue:

-   wget -q https://knob.phreneticappsllc.com/nesicide/nesicide-deps.tar.bz2
+   curl --silent https://knob.phreneticappsllc.com/nesicide/nesicide-deps.tar.bz2 --output nesicide-deps.tar.bz2

Prefer curl, since wget is not guaranteed to be available.

Also, adding set -e would have bubbled up that wget is not available.

bolinfest commented 4 years ago

Though now my build is failing with:

../../common/cqtmfc.cpp:3682:17: error: variable has incomplete type 'QPainterPath'
   QPainterPath path;

which I suspect is a genuine Qt version issue.

bolinfest commented 4 years ago

Hmm, though or that one, I found a similar bug report here:

https://github.com/qgis/QGIS/issues/37005

and as suggested, I added #include <QPainterPath> to cqtmfc.h, which seemed to fix that build issue.

christopherpow commented 4 years ago

Yes that must be a Qt version issue as it builds fine with the recommended version. wget is available in both Travis and AppVeyor environments so I used it.