Created
August 13, 2012 01:27
-
-
Save jweinberg/3336233 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In file included from ruby/ruby.cpp:5: | |
In file included from ./ruby/ruby_impl.cpp:21: | |
In file included from /System/Library/Frameworks/Carbon.framework/Headers/Carbon.h:24: | |
In file included from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:28: | |
In file included from /System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATS.framework/Headers/ATS.h:28: | |
In file included from /System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATS.framework/Headers/ATSLayoutTypes.h:28: | |
In file included from /System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATS.framework/Headers/ATSTypes.h:24: | |
In file included from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGGeometry.h:8: | |
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:143:6: error: builtin feature check macro requires a parenthesized identifier | |
# if __CG_HAS_COMPILER_ATTRIBUTE(noinline) | |
^ | |
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:16:50: note: expanded from macro '__CG_HAS_COMPILER_ATTRIBUTE' | |
# define __CG_HAS_COMPILER_ATTRIBUTE(attribute) __has_attribute(attribute) | |
^ | |
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:143:34: error: token is not a valid binary operator in a preprocessor subexpression | |
# if __CG_HAS_COMPILER_ATTRIBUTE(noinline) | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~ | |
./nall/platform.hpp:73:33: note: expanded from macro 'noinline' | |
#define noinline __attribute__((noinline)) | |
^ | |
/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:16:66: note: expanded from macro '__CG_HAS_COMPILER_ATTRIBUTE' | |
# define __CG_HAS_COMPILER_ATTRIBUTE(attribute) __has_attribute(attribute) |
Same.
seems like a compiler bug
i changed /System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:16 from
# define __CG_HAS_COMPILER_ATTRIBUTE(attribute) __has_attribute(attribute)
to
# define __CG_HAS_COMPILER_ATTRIBUTE __has_attribute
and it worked for me
Tested on Yosemite
Rather than modify Apple's CoreGraphics framework, I instead was able to prepend ruby/ruby.cpp:
#define __has_attribute(x) 0 // Compatibility with non-clang compilers.
Furthermore, in my experience building higan v094 for OSX, other modifications were necessary. I am including a patch:
Patch Notes
- The Makefile changes are purely personal but remain included.
- The shader modification was made because higan would crash on startup. This fix seems to be doing alright, and shader presets do still load up on startup :) -- the problem stems from the call to glGenTextures ruby/video/opengel/main.hpp:54 which arises from lack of OpenGL context.
- The addition to carbon.cpp is completely necessary and it seems Byuu and company forgot about testing on Apple since this function's existence is basically crucial
- In my case, the makefile for shader installation on OSX is incorrect. they should be installed in
/Library/Application Support/higan/Video Shaders
but they are incorrectly installed into/usr/share/higan/Video Shaders
diff -rupN higan_v094-source/Makefile higan_v094-source-osx_mod/Makefile
--- higan_v094-source/Makefile 2013-10-20 08:39:14.000000000 -0400
+++ higan_v094-source-osx_mod/Makefile 2015-08-02 04:57:07.000000000 -0400
@@ -5,10 +5,10 @@ sfc := sfc
gb := gb
gba := gba
-profile := accuracy
+profile := balanced
target := ethos
-# options += debugger
+options += debugger
# arch := x86
# console := true
diff -rupN higan_v094-source/ruby/input/carbon.cpp higan_v094-source-osx_mod/ruby/input/carbon.cpp
--- higan_v094-source/ruby/input/carbon.cpp 2014-01-20 01:37:14.000000000 -0500
+++ higan_v094-source-osx_mod/ruby/input/carbon.cpp 2015-08-02 03:28:53.000000000 -0400
@@ -35,6 +35,12 @@ struct pInputCarbon {
group.input[inputID].value = value;
}
+ vector<HID::Device*> poll() {
+ vector<HID::Device*> devices;
+ poll(devices);
+ return devices;
+ }
+
void poll(vector<HID::Device*>& devices) {
KeyMap keymap;
GetKeys(keymap);
@@ -42,7 +48,7 @@ struct pInputCarbon {
unsigned inputID = 0;
for(auto& key : keys) {
- bool value = buffer[key.id >> 3] & (1 << (key.id & 7)));
+ bool value = buffer[key.id >> 3] & (1 << (key.id & 7));
assign(kb.hid, HID::Keyboard::GroupID::Button, inputID++, value);
}
diff -rupN higan_v094-source/ruby/ruby.cpp higan_v094-source-osx_mod/ruby/ruby.cpp
--- higan_v094-source/ruby/ruby.cpp 2014-01-20 01:37:14.000000000 -0500
+++ higan_v094-source-osx_mod/ruby/ruby.cpp 2015-08-02 03:22:53.000000000 -0400
@@ -1,5 +1,9 @@
#include <ruby/ruby.hpp>
+//#ifndef __has_attribute // Optional of course.
+ #define __has_attribute(x) 0 // Compatibility with non-clang compilers.
+//#endif
+
#undef mkdir
#undef usleep
#include <ruby/implementation.cpp>
diff -rupN higan_v094-source/ruby/video/opengl/main.hpp higan_v094-source-osx_mod/ruby/video/opengl/main.hpp
--- higan_v094-source/ruby/video/opengl/main.hpp 2014-01-20 01:37:14.000000000 -0500
+++ higan_v094-source-osx_mod/ruby/video/opengl/main.hpp 2015-08-02 05:04:18.000000000 -0400
@@ -1,4 +1,10 @@
void OpenGL::shader(const char* pathname) {
+ static bool firstRun=true;
+ if (firstRun)
+ {
+ firstRun = false;
+ return;
+ }
for(auto& program : programs) program.release();
programs.reset();
diff -rupN higan_v094-source/shaders/Makefile higan_v094-source-osx_mod/shaders/Makefile
--- higan_v094-source/shaders/Makefile 2013-08-16 19:46:20.000000000 -0400
+++ higan_v094-source-osx_mod/shaders/Makefile 2015-08-02 05:18:47.000000000 -0400
@@ -1,5 +1,20 @@
+include ../nall/Makefile
+
+install_dir := /usr/share/higan/Video\ Shaders
+sudo := sudo
+ifeq ($(platform),windows)
+ # ?
+else ifeq ($(platform),linux)
+ install_dir := /usr/share/higan/Video\ Shaders
+else ifeq ($(platform),bsd)
+ install_dir := /usr/share/higan/Video\ Shaders
+else ifeq ($(platform),macosx)
+ install_dir := /Library/Application\ Support/higan/Video\ Shaders
+ sudo := sudo
+endif
+
install:
- if [ -d /usr/share/higan/Video\ Shaders ]; then sudo rm -r /usr/share/higan/Video\ Shaders; fi
- sudo mkdir -p /usr/share/higan/Video\ Shaders
- sudo cp -r *.shader /usr/share/higan/Video\ Shaders
- sudo chmod -R 777 /usr/share/higan/Video\ Shaders
+ if [ -d $(install_dir) ]; then $(sudo) rm -r $(install_dir); fi
+ $(sudo) mkdir -p $(install_dir)
+ $(sudo) cp -r *.shader $(install_dir)
+ $(sudo) chmod -R 777 $(install_dir)
Installing Full package
Example from the higan source directory, with patch in parent folder
patch -p1 < ../higan_v094-source-osx_mod.patch.diff
make -C ananke
make -C ananke install
make
make install
make -C shaders # installs implicitly
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was trying to compile bsnes using clang and ran into this error as well. Any tips?