-
Notifications
You must be signed in to change notification settings - Fork 424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix cmake build issues and gcc hang #91
base: master
Are you sure you want to change the base?
Conversation
added #include <cstdlib> to glsl_optimizer_tests.cpp to fix: tests/glsl_optimizer_tests.cpp:324:180: error: ‘system’ was not declared in this scope int res = system("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/usr/bin/metal metalTemp.metal -o metalTemp.o -std=ios-metal1.0 -Wno-parentheses-equality"); This was happening with cmake on both Linux (gcc) and OSX (clang), so perhaps it is something that is taken care of by Xcode.
removed the empty definition in standalone_scaffolding.h (but kept the declaration) and added specific definitions to the executables that need it (glslopt and glsl_test) This multiple definition was occurring in Linux and OSX with cmake. The changes build properly on Linux-cmake, OSX-cmake, and OSX-xcode. The tests pass on both OSX-builds. The Linux-cmake tests fail, but they fail before this commit. I do not have access to MSVC.
For some reason gcc (versions 4.6 and 4.8) optimizes out the "Trim out variables" loop in `ir_array_reference_visitor::get_split_list`, even we don't want it too. If that loop disappears, then the variables are never considered split and not removed from the list, so the optimization continues indefinitely. Placing a memory fence in the loop prevents it from being optimized out; this is done just with gcc.
I also found the problem that was causing #44. All tests pass in release mode on Linux. All these changesets build and test on OSX, but I do get some test failures that I get without this changeset as well. |
Hangs and segfaults can happen all over the place (depending on compiler version and optimization options) because old C tricks in |
@tschw After one of my most epic debugging adventures in many years, I was just orbiting the solution. That change makes so much sense, thank you for it. I will test it out this week. |
Hahaha! Although the patch reads so nice and simple, I too had some fun debugging: When it comes to optimized executables, you have no choice but to strainfully trace the program at assembly level. In my case, the crash actually happened in the second iteration of a loop - one I could step through four times at source level. |
There were both compiler and linker errors using CMake on both Linux and OSX. This changeset fixes them. Compiles, builds, and tests successfully on OSX (cmake and Xcode). Compiles and builds on Linux.