Closed shengsword closed 5 years ago
My cmake config:
Yes, it will always crash on Mac until Mac supports QSurfaceFormat::CompatibilityProfile or until I can figure out how to get FragM to run under core profile.
The code of interest is DisplayWidget.h line 95
class DisplayWidget : public QOpenGLWidget, protected QOpenGLFunctions_4_1_Compatibility
and DisplayWidget.cpp line 32
fmt.setProfile(QSurfaceFormat::CompatibilityProfile);
I don't have a Mac so if you want to try playing with these lines I would be most interested in the results. If you change "Compatibility" to "Core" in the above mentioned lines I don't think it will compile?
The stacktrace is virtually useless in this case.
ohoh my mistake (after updates) it will compile and run using Core profile but I get a blank GL area ???
I changed it to
fmt.setProfile(QSurfaceFormat::CoreProfile);
It compiled ok but still crashed when it running
the stacktrace is almost the same...
wired
Did you change the line in DisplayWidget.h file as well ?
sorry, my mistake I lost it ... Yeh! the app could be launched normally but shader compiled fail: Could not create vertex shader: ERROR: 0:1: '' : #version required and missing. ERROR: 0:11: 'varying' : syntax error: syntax error We changed it to core profile(OpenGL4.1), but the shaders are only supported with OpenGL2.0 thanks @3Dickulus for the quick help
@3Dickulus thanks 👍 It works now! Let me summarize it:
fmt.setProfile(QSurfaceFormat::CoreProfile);
class DisplayWidget : public QOpenGLWidget, protected QOpenGLFunctions
Doing the 3 steps above makes the application runs normally except the retina display problem
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<string>True</string>
in the \<dict> sectionAnd then run Fragmentarium, it should have the retina display... have fun : )
Awesome!!!
It won't compile here (linux) unless DisplayWidget.h line 95 is ... class DisplayWidget : public QOpenGLWidget, protected QOpenGLFunctions_4_1_Core
fails on double types like glUniform1d etc...
I will add some #ifdefined Q_OS_MAC statements and see how it does on the travis build system, will also add notes about Info.plist file, where is that file? is it made by MacOS or by app deployment package?
If you can help with testing a Mac deployment package that would be great!
Info.plist file, where is that file? is it made by MacOS or by app deployment package?
Yes, inside Fragmentarium-2.5.0.app (the deployed package is actually a folder on MacOS) more info: https://doc.qt.io/qt-5/highdpi.html
Changing to QOpengGLFunctions_4_1_Core leads the shaders not compiled? (since the shaders are written in GLSL #130 syntax)
I'd like to do the test : )
So it would seem that for Mac Qt has "pseudo" compatibility profile ability? I didn't find in the docs?
I have a very tight schedule this weekend, Easter + visiting family etc... so I won't be able to do much with this, I will push Q_OS_MAC patch shortly that implements 1. and 2. above but in 3. I assume you have an absolute path? it would be better as a relative path, can you test these relative paths ? ./Examples/Include ../Examples/Include ../../Examples/Include if one of these doesn't work then I will add a request dialog to set the path if includes are not found... or something like that.
also you can find shell script and fqs script files here https://fractalforums.org/fragmentarium/17/fragm-2-5-0/1974/45#msg13687 that will automatically test all frags in examples folder by rendering a thumbnail of each and saving png files in ./test folder, you may have to make some adjustments to the shell script but the fqs script should be OS independant
Yep I make it an absolute path. The working path seems to be Framentarium-2.5.0.app/Contents/MacOS/ thus it depends where the Framentarium-2.5.0.app in... If I put the app inside the folder where the Examples Folder in, then the relative path should be ../../../Examples/Include
I went through this process, compiling on mac, with user bermarte some time ago, Qt now provides deployment tools for Lin Win and OSX so I'm going over the .travis.yml file and comparing with https://doc.qt.io/qt-5.9/osx-deployment.html#the-mac-deployment-tool . I would like to provide working binary packages for all
Currently the osx stuff is commented out and needs some updating to match changes at travis-ci.org
Managed to get a linux AppImage built, I thought it would be best to try linuxdeployqt before macdeployqt to figure out the process >:-P The only problem is the Examples/ folder is in the image, it loads ok but not sure about a few things like saving files and what happens when users want to edit raytracer or other support frags.
When running an app from a mac appimage (dmg file?) can the app save or change things in the image? or will there have to be a "userland" copy of the Examples/ folder ???
Could not create vertex shader: ERROR: 0:1: '' : #version required and missing. ERROR: 0:11: 'varying' : syntax error: syntax error
Some builtin frag compilers provided by the drivers require #version statements as the first line in the frag code, minimum for FragM is #version 110
sorry for the delay...
When running an app from a mac appimage (dmg file?) can the app save or change things in the image? or will there have to be a "userland" copy of the Examples/ folder ??? changing or saving things
.dmg file is the install-package, when it is installed, it should generate the .app (actually a folder which can open it normally) Actually, I dragged the Example folder inside the Fragmentarium-2.5.0.app, and then I can resolve the include path to be just: Examples/Include.
As u can see in the image, I can save files (sssssssss.frag) inside the app folder, when running Fragmentarium
Ok that works :) I had to do something similar for the linux appimage by making the install root appdir/usr/bin/ . This installs the executable and all support files in the bin folder :P
I'm following https://doc.qt.io/qt-5.9/osx-deployment.html
ok finally got an appdir bundle made ... check https://github.com/3Dickulus/FragM/releases
Operating System Details ProductName: Mac OS X ProductVersion: 10.13.3 BuildVersion: 17D102
Fragmentarium-2.5.0-190419-osx.zip contains
will this run on 10.14 ? I really don't want to have to make a package for every flavour of OSX
I tried the appimage on 10.14.3, it could be launched normally. however when building a shader, it reports the shader-version error:
try adding in the editor as the first line in the fragment source code... #version 120 and/or check Edit->Preferences->Include path as referenced above?
and/or check Edit->Preferences->Include path as referenced above?
The include path now is "/Include/Example. should be Include/Example instead to make it work.
changing to #version 120 still reports error: "version 120 is not supported" :(
ok, in core profile I think the minimum is GL 3.2 and GLSL 150 while GL core 4.1 requires GLSL 410 but it worked and rendered before (as above) ? with no #version statement ?
aha! found this https://github.com/arl/macdeployqtfix aparently there is one more step to finish the job >:-p it could be that the executable just can't find everything it needs ?
if you have Qt SDK installed on your system you should also have macdeployqt and could use macdeployqtfix
build as normal using cmake and make install... these are the commands I use on a clean mac environment... (one after another in a console starting in folder where FragM lives)
brew install qt5
brew install ilmbase openexr
brew unlink openexr
brew link --overwrite openexr
brew unlink ilmbase
brew link --overwrite ilmbase
brew unlink cmake
brew install cmake
make sure these paths are set
export QTDIR="/usr/local/opt/qt"
export PATH="/usr/local/opt/qt/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/qt/lib"
export CPPFLAGS="-I/usr/local/opt/qt/include"
export PKG_CONFIG_PATH="/usr/local/opt/qt/lib/pkgconfig"
cd FragM
mkdir Fragmentarium-Source/build
cd Fragmentarium-Source/build
cmake -DUSE_OPEN_EXR=ON -DCMAKE_INSTALL_PREFIX=../../ ..
make install
cd ../../Fragmentarium-2.5.0
^^^ this is where make install puts the appdir then I mv everything to where it needs to be although maybe should leave these where make install puts them ? I don't have a mac to play with so I can only speculate :-/
mv ./Examples ./Fragmentarium-2.5.0.app/Contents/MacOS/Examples
mv ./fqScript ./Fragmentarium-2.5.0.app/Contents/MacOS/fqScript
mv ./Misc ./Fragmentarium-2.5.0.app/Contents/MacOS/Misc
mv ./Languages ./Fragmentarium-2.5.0.app/Contents/MacOS/Languages
macdeployqt ./Fragmentarium-2.5.0.app
macdeployqtfix ./Fragmentarium-2.5.0.app/Contents/MacOS/Fragmentarium-2.5.0.app $QTDIR
^^^ this is where macdeployqtfix goes
have a look at the macdeployqtfix page for further insight, it's a python script. If you can do this and share your findings there are some other mac users will be greatful :) I won't be able to do much until this weekend so no rush, this is, after all, just a hobby ;)
The include path now is "/Include/Example. should be Include/Example instead to make it work.
unless I have misunderstood and it is working ???
I mean, changing the include path to "Include/Example" makes the shader header files to be found :)
hm, in MainWindow.cpp line 2479...
examplesDir << "Examples" << "../Examples" << "../../Examples" << "../../../Examples";
should maybe have ./ in front of the first "Examples" ?
ok, so it can find everything just won't compile and run fragments? but it did, so what's different now?
I did add...
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<string>True</string>
...to the file Fragmentarium-2.5.0.app/Contents/Info.plist
ok, so it can find everything just won't compile and run fragments?
yes , headers could be found, but just running shader error ("version problem above")
the only difference is just the shader error ....
it wired, the package I built from the source has no problem...
ok sounds like something in the Qt GL libs is not getting set properly, pure OSX core profile vs Qt special profile, in a couple of days I will have some time to poke at this, I will build another one using macdeployqtfix
I have set core profile with include deprecated functions, this is not the same as compatibility profile but if you compiled a working executable from the sources it must be possible on Travis build service too. I am using their defaults for OS image and environment, Xcode 9.4.1 | macOS 10.13 | JDK 10.0.1 For OS version compatibility I'm not sure if I should use the oldest version or newest ?
Right! found some time for a quick OSX build, check in releases :) macdeployqtfix ran successfully, there were a lot of warns during compile about deprecated GL functions but no errors.
@3Dickulus
the same shader version error : ( I tested the mac at my home and another mac at my work, the same shader error....
And the post can help something? glsl version error Maybe i will try another mac from my colleague tomorrow...
I don't think another mac will behave any differently than yours :(
re:And the post can help something? Not really, as I said I don't have a mac to play with. I think I've mentioned those facts about GL3.2 and no compatibility profile on mac and Qt's way of handing back a context.
Can you go back and replicate the steps you outlined above that worked?
Did you keep a copy of the working code and executable?
@3Dickulus sorry for the late response... I have rebuilt it on two macs, one of them is the brand new ... The two macs all succeeded with the outlined steps above...
I'm wondering if it needs a real mac to build on and the travis-ci emulation is not quite right... so
oops, will close after your response :)
the bundle at https://github.com/3Dickulus/FragM/releases was compiled with the above changes. can you, shengsword, verify that it is working? or anyone else ???
I have already checked the releases on different macs before, all have shader version error...
Ok, (and thank you very much for your time) this confirms..??
I'm wondering if it needs a real mac to build on and the travis-ci emulation is not quite right...
so not sure what to do other than compile on a real mac instead of travis-ci emulation/image I guess it might be that there is no gfx card or that it's simulation is close but not perfect?
in either case I won't be able to provide a working app bundle via travis-ci... edit:unless it can be made to work. any suggestions?
Closing this because it does compile and run on osx.
Process: Fragmentarium-2.5.0 [4672] Path: /Users/USER/*/Fragmentarium-2.5.0.app/Contents/MacOS/Fragmentarium-2.5.0 Identifier: ??? Version: ??? (???) Code Type: X86-64 (Native) Parent Process: ??? [1] Responsible: Fragmentarium-2.5.0 [4672] User ID: 501
Date/Time: 2019-04-15 22:29:09.969 +0800 OS Version: Mac OS X 10.14.3 (18D109) Report Version: 12 Anonymous UUID: E6764C73-510D-FD71-76CD-3F74154FAF56
Time Awake Since Boot: 2200 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGABRT) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000050 Exception Note: EXC_CORPSE_NOTIFY