GithubHelp home page GithubHelp logo

Comments (11)

dgramop avatar dgramop commented on May 27, 2024

Just checked out the 70bde63 commit, and I'm unable to run this either, after compiling. The "installed" version seems to run just fine. Here's how I'm invoking cmake:

cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_OPENMP=ON ..

from solvespace.

dgramop avatar dgramop commented on May 27, 2024

What's driving me crazy is that this did work earlier today, all until I re-ran cmake...

Edit: debug output has confusing results. glGetError() returns 0 (enum value corresponding to "no error") and the result from glCreateShader is 0, which represents there was an error

Process 9959 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step over
    frame #0: 0x000000010002aa70 SolveSpace`SolveSpace::CompileShader(res="shaders/edge.vert", type=35633) at gl3shader.cpp:106:5
   103
   104      GLuint shader = glCreateShader(type);
   105      int err = glGetError();
-> 106      glGetError();
   107      ssassert(shader != 0, "glCreateShader failed");
   108
   109      const GLint   glSize[]   = { (int)src.length() };
Target 0: (SolveSpace) stopped.
(lldb) p err
(int) 0
(lldb) p shader
(GLuint) 0
(lldb) n

from solvespace.

ruevs avatar ruevs commented on May 27, 2024

I've only tried to build the macOS version with a fairly old macOS and XCode.

Perhaps @vespakoen can help you - he works on a Mac.

from solvespace.

dgramop avatar dgramop commented on May 27, 2024

from solvespace.

dgramop avatar dgramop commented on May 27, 2024

Just tested with the latest macOS artifact and it works. Definitely something wrong with how I'm building this.

Also it seems that glCreateShader is just a constructor and doesn't actually take a particular shader file yet...

CMAKE: -- Found OpenGL: /opt/homebrew/lib/libGL.dylib
and
/opt/homebrew/lib/libGL.dylib -> ../Cellar/mesa/24.0.3/lib/libGL.dylib

Edit: tried uninstalling mesa and re-running cmake to get solvespace to link to the framwork, no change in behavior

Edit: Went ahead and checked glGetError() after the call to makeCurrentContext. I get back a value of 0. So it seems that there was no error when the context was originally created either.

from solvespace.

dgramop avatar dgramop commented on May 27, 2024

Wrote a dummy program and linked to the OpenGL framework:

clang -g -framework OpenGL test.c

Then ran otool -L to see what dynamic links it made:

./a.out:
	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1345.100.2

Looks like it's using openGL 1.0.0 from the system in the dummy program... which of course SIGSEGV's if I make any calls to functions in the gl3 headers, which happen to be provided in that same Frameworks folder (even though apparently version 3 is not available?)

Maybe somehow I lost openGL version 3... also interesting to see that came picks mesa libGL form home-brew when I had that installed. Maybe there's a difference between the version of libGL that gets headers compiled in and the one that gets dynamically loaded on my system....

from solvespace.

dgramop avatar dgramop commented on May 27, 2024

[ 82%] Copying resource locales/zh_CN.po
[ 83%] Copying resource shaders/edge.frag
[ 83%] Copying resource shaders/edge.vert
[ 83%] Copying resource shaders/imesh.frag
[ 83%] Copying resource shaders/imesh.vert
[ 83%] Copying resource shaders/imesh_point.frag
[ 84%] Copying resource shaders/imesh_point.vert
[ 84%] Copying resource shaders/imesh_tex.frag
[ 84%] Copying resource shaders/imesh_tex.vert
[ 84%] Copying resource shaders/imesh_texa.frag
[ 84%] Copying resource shaders/mesh.frag
[ 86%] Copying resource shaders/mesh.vert
[ 86%] Copying resource shaders/mesh_fill.frag
[ 86%] Copying resource shaders/mesh_fill.vert
[ 86%] Copying resource shaders/outline.vert
[ 86%] Copying resource threejs/SolveSpaceControls.js
[ 86%] Copying resource threejs/hammer-2.0.8.js.gz
[ 87%] Copying resource threejs/three-r111.min.js.gz
[ 87%] Built target resources

^ in case this is what you mean by shaders being linked

Also maybe we should bring CI from macOS 12 to macOS 14

Mesa bumped a major version around the time I went inactive... Will investigate this

from solvespace.

dgramop avatar dgramop commented on May 27, 2024

Ladies and Gentlemen, We Got Him

This bug has been driving me nuts every time I feel like working on solvespace.

Digging around with otool, I took the known good & working builds from CI and did a diff between the dylibs for working vs good.

This led me to uninstall libGL provided by Mesa from homebrew. After I did that, my build somehow tried linking to /opt/local/lib/libGL.1.dylib (which was not linked to by the known-good one). As a quick hack I edited build/src/CMakeFiles/solvespace.dir/link.txt (generated by cmake) and removed "/opt/local/lib/libGL.1.dylib". I ran make, opened it up, and my built Solvespace loaded up without crashing!

I owe this thread and future readers a more stable fix, so I'll do some further diagnosing, document the fix, and close the issue.

TL;DR: If this happens to you, consider comparing your build's dylib paths with the known good one. Make sure to not have Mesa installed (even though it may be used by solvespace on other platforms).

from solvespace.

dgramop avatar dgramop commented on May 27, 2024

When running cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_OPENMP=ON
The culprit is:

....
-- Found OpenGL: /opt/local/lib/libGL.dylib
....

find_package(OpenGL REQUIRED) in CMakeLists.txt is what locates this file. That file seems to just exist on my mac (and as far I know shipped with my mac). It doesn't symlink anywhere to homebrew and I didn't manually build & install any openGL. I think my install of openCV is what created this mess.

So TL;DR: All we need to do to link OpenGL is give Clang the -framework OpenGL file, and nothing else. The additional stuff that find_package gives back can result in weird conflicting/broken links to libGL. Maybe there's something to be fixed within Cmake's FindOpenGL module itself. Till then we should just use -framework OpenGL

from solvespace.

dgramop avatar dgramop commented on May 27, 2024

I got another apparent dynamic linker error when building on my mac (but not on prebuilt resources) for error dialogs. Will investigate this eventually

(edit: the "apparent" dl error was just that. Seems that this problem is localized to GL)

from solvespace.

vespakoen avatar vespakoen commented on May 27, 2024

Try compiling locally using the github scripts, it might help?

.github/scripts/install-macos.sh ci
.github/scripts/build-macos.sh release arm64

CI is up and running again for macOS so new pre-compiled binaries should be available soon...

from solvespace.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.