Open cyberarm opened 10 years ago
I can confirm this issue.
Let me know if you find a resolution to this issue.
The sync issue was easy to resolve (renamed to sync_) as was another to do with macros. There is a last error still, which I'm not sure how to resolve though:
compiling ../../../../ext/texplay/bindings.c
In file included from /home/spooner/.rbenv/versions/2.1.0/include/ruby-2.1.0/ruby.h:33:0,
from ../../../../ext/texplay/bindings.c:1:
../../../../ext/texplay/bindings.c: In function ‘m_clone_image’:
/home/spooner/.rbenv/versions/2.1.0/include/ruby-2.1.0/ruby/ruby.h:1116:30: error: assignment of read-only member ‘klass’
#define RBASIC(obj) (R_CAST(RBasic)(obj))
^
/home/spooner/.rbenv/versions/2.1.0/include/ruby-2.1.0/ruby/ruby.h:1115:30: note: in definition of macro ‘R_CAST’
#define R_CAST(st) (struct st*)
^
../../../../ext/texplay/compat.h:22:22: note: in expansion of macro ‘RBASIC’
#define KLASS_OF(c) (RBASIC(c)->klass)
^
../../../../ext/texplay/bindings.c:306:5: note: in expansion of macro ‘KLASS_OF’
KLASS_OF(cloned_image) = rb_singleton_class_clone(self);
^
Where KLASS_OF is defined:
#define KLASS_OF(c) (RBASIC(c)->klass)
Didn't look too hard for a solution though. Thought it might be related to: https://github.com/antw/ruby-deepclone/commit/2f056906dc86e5f79ae74eee707d6aff3c203604
I just received an email from someone trying to run on of my projects that depends on texplay and he got the error because he his using 2.1.2. I might try to look into it.
@Spooner I see you have also submitted a partial fix in an unmerged PR.
@banister If someone would submit a fix for 2.1 would it get merged in?
@gilles-leblanc sure, i'll merge it. If you want, i can give you a commit bit and you could even merge it yourself ;)
@banister Sure that would be great!
Thanks for the fix in pre.
@burtlo I would love some help getting this to compile on windows (if possible)
@shawn42 I can definitely run it on there and post a stacktrace. After that I will do my best to assist.
Great! Thanks @burtlo
Same error with texplay 0.4.4-pre on OSX 10.9
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling actions.c
compiling bindings.c
bindings.c:315:9: warning: implicit declaration of function 'KLASS_OF' is invalid in C99 [-Wimplicit-function-declaration]
KLASS_OF(cloned_image) = rb_singleton_class_clone(self);
^
bindings.c:315:32: error: expression is not assignable
KLASS_OF(cloned_image) = rb_singleton_class_clone(self);
~~~~~~~~~~~~~~~~~~~~~~ ^
1 warning and 1 error generated.
make: *** [bindings.o] Error 1
make failed, exit code 2
@byterussian what version of Ruby were you installing this into? Were you using any ruby switcher like rvm or rbenv?
Ruby 2.1.2p96 with rbenv. This happens only if I have in Gemfile:
gem 'texplay', git: 'https://github.com/banister/texplay'
If in Gemfile write only gem 'texplay'
instead I have this error:
make "DESTDIR=" clean
make "DESTDIR="
compiling actions.c
In file included from actions.c:1:
./texplay.h:41:3: error: redefinition of 'sync' as different kind of symbol
} sync;
^
/usr/include/unistd.h:596:7: note: previous definition is here
void sync(void);
^
In file included from actions.c:1:
./texplay.h:96:3: error: unknown type name 'sync'
sync sync_mode;
^
In file included from actions.c:3:
./graphics_utils.h:9:71: error: unknown type name 'sync'
sync sync_mode, bool primary, action_struct ** payload_ptr);
^
In file included from actions.c:4:
./actions.h:14:71: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
trace_match line_do_action(int, int, int, int, texture_info *, VALUE, sync, bool primary, action_struct * payload);
^~~~
./actions.h:17:61: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
void circle_do_action(int, int, int, texture_info *, VALUE, sync, bool primary, action_struct * payload);
^~~~
./actions.h:20:55: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
void pixel_do_action(int, int, texture_info *, VALUE, sync, bool primary, action_struct * payload);
^~~~
./actions.h:24:21: error: unknown type name 'sync'
sync sync_mode, bool primary, action_struct * payload);
^
./actions.h:27:77: error: unknown type name 'sync'
void flood_fill_do_action(int x, int y, texture_info * tex, VALUE hash_arg, sync sync_mode, bool primary,
^
./actions.h:31:76: error: unknown type name 'sync'
void glow_fill_do_action(int x, int y, texture_info * tex, VALUE hash_arg, sync sync_mode, bool primary,
^
./actions.h:36:26: error: unknown type name 'sync'
sync sync_mode, bool primary, action_struct * payload);
^
./actions.h:39:75: error: unknown type name 'sync'
void polyline_do_action(VALUE points, texture_info * tex, VALUE hash_arg, sync sync_mode, bool primary,
^
./actions.h:43:73: error: unknown type name 'sync'
void bezier_do_action(VALUE points, texture_info * tex, VALUE hash_arg, sync sync_mode, bool primary,
^
./actions.h:48:21: error: unknown type name 'sync'
sync sync_mode, bool primary, action_struct * payload);
^
./actions.h:53:59: error: unknown type name 'sync'
texture_info * tex, VALUE hash_arg, sync sync_mode,
^
./actions.h:58:27: error: unknown type name 'sync'
sync sync_mode, bool primary, action_struct * payload);
^
actions.c:41:16: error: unknown type name 'sync'
sync sync_mode, bool primary, action_struct * payload)
^
actions.c:208:20: error: unknown type name 'sync'
sync sync_mode, bool primary, action_struct * payload)
^
actions.c:285:16: error: unknown type name 'sync'
sync sync_mode, bool primary, action_struct * payload)
^
actions.c:334:16: error: unknown type name 'sync'
sync sync_mode, bool primary, action_struct * payload)
^
actions.c:387:18: error: unknown type name 'sync'
sync sync_mode, bool primary, action_struct * payload)
^
actions.c:461:17: error: unknown type name 'sync'
sync sync_mode, bool primary, action_struct * payload)
^
actions.c:487:22: error: unknown type name 'sync'
sync sync_mode, bool primary, action_struct * payload)
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
3 warnings and 20 errors generated.
make: *** [actions.o] Error 1
make failed, exit code 2
@byterussian I'm not sure why installing from the github repo is not building at the moment, but that is different than installing the pre gem from rubygems.
Have you tried: gem 'texplay', '0.4.4.pre' in you Gemfile?
I'm able to reproduce the error you're reporting when installing from the github repo, but it works fine with the version specified in the Gemfile as '0.4.4.pre'
@shawn42 Tried now, with 0.4.4.pre
works fine.
@byterussian glad to help.
@burtlo anything on the windows front so we can get this issue closed out?
I'll give it a shot on Windows 8.
Downloaded and install Ruby 2.1 x32 and the DevKit.
Issues running rake native gem
it seems like the problem exists with the freeglut static lib.
C:\source\texplay>rake native gem
Temporarily enhancing PATH to include DevKit...
cd tmp/i386-mingw32/texplay/2.1.3
C:/Ruby21/bin/ruby.exe -I. ../../../../ext/texplay/extconf.rb
checking for main() in -lfreeglut_static... *** ../../../../ext/texplay/extconf.
rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=../../../../ext/texplay
--curdir
--ruby=C:/Ruby21/bin/ruby
--with-texplay/texplay-dir
--without-texplay/texplay-dir
--with-texplay/texplay-include
--without-texplay/texplay-include=${texplay/texplay-dir}/include
--with-texplay/texplay-lib
--without-texplay/texplay-lib=${texplay/texplay-dir}/lib
--with-freeglut_staticlib
--without-freeglut_staticlib
C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generat
e an executable file. (RuntimeError)
You have to install development tools first.
from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:541:in `try_link0'
from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:556:in `try_link'
from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:742:in `try_func'
from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:999:in `block in find_library'
from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpo
ne'
from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
from C:/Ruby21/lib/ruby/2.1.0/mkmf.rb:995:in `find_library'
from ../../../../ext/texplay/extconf.rb:24:in `<main>'
rake aborted!
Command failed with status (1): [C:/Ruby21/bin/ruby.exe -I. ../../../../ext...]
Tasks: TOP => native => native:i386-mingw32 => native:texplay:i386-mingw32 => tm
p/i386-mingw32/stage/lib/texplay/2.1/texplay.so => copy:texplay:i386-mingw32:2.1
.3 => tmp/i386-mingw32/texplay/2.1.3/texplay.so => tmp/i386-mingw32/texplay/2.1.
3/Makefile
(See full trace by running task with --trace)
I'll play more with it tomorrow.
thanks @burtlo
On Ubuntu, I encounter the same problem trying to install the lasted version (ea3cd6c8c475dc65dfe7279a1875dfc4609f19fd) from github:
$ rake rake aborted! Don't know how to build task 'default' (See full trace by running task with --trace) tpasch2@muccpw-tp:~/ruby/texplay$ rake compile cd tmp/x86_64-linux-gnu/texplay/2.1.2 make compiling ../../../../ext/texplay/bindings.c ../../../../ext/texplay/bindings.c: In function ‘m_clone_image’: ../../../../ext/texplay/bindings.c:318:32: error: assignment of read-only member ‘klass’ KLASS_OF(cloned_image) = rb_singleton_class_clone(self); ^ Makefile:224: recipe for target 'bindings.o' failed make: *** [bindings.o] Error 1 rake aborted! Command failed with status (2): [make...] /var/lib/gems/2.1.0/gems/rake-compiler-0.9.3/lib/rake/extensiontask.rb:152:in `block (2 levels) in define_compile_tasks' /var/lib/gems/2.1.0/gems/rake-compiler-0.9.3/lib/rake/extensiontask.rb:151:in `block in define_compile_tasks' Tasks: TOP => compile => compile:x86_64-linux-gnu => compile:texplay:x86_64-linux-gnu => copy:texplay:x86_64-linux-gnu:2.1.2 => tmp/x86_64-linux-gnu/texplay/2.1.2/texplay.so (See full trace by running task with --trace)
I SOLVED the problem with the following patch:
$ git diff -u -w diff --git a/ext/texplay/bindings.c b/ext/texplay/bindings.c index e7c2937..9475f4f 100644 --- a/ext/texplay/bindings.c +++ b/ext/texplay/bindings.c @@ -308,7 +308,7 @@ m_clone_image(VALUE self) cloned_image = m_dup_image(self); replace: #if RUBY_API_VERSION_MAJOR <= 1 \|\| \(RUBY_API_VERSION_MAJOR == 2 \&\& RUBY_API_VERSION_MINOR == 0\) with: \#if RUBY_API_VERSION_MAJOR <= 1 \|\| \(RUBY_API_VERSION_MAJOR == 2 \&\& RUBY_API_VERSION_MINOR >= 0\)
Hm, diff is flacky/wrong here because of some obscure markdown problems. Hence create the pull request https://github.com/banister/texplay/pull/31/files
Getting this error on Ubuntu 15.04, Ruby 2.2.2p95 with rbenv:
$ gem install texplay
Building native extensions. This could take a while...
ERROR: Error installing texplay:
ERROR: Failed to build gem native extension.
/home/someone/.rbenv/versions/2.2.2/bin/ruby -r ./siteconf20150725-9310-fouvdd.rb extconf.rb
checking for main() in -lglut... yes
checking for main() in -lGL... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling cache.c
In file included from cache.c:12:0:
texplay.h:41:3: error: ‘sync’ redeclared as different kind of symbol
} sync;
^
In file included from /home/someone/.rbenv/versions/2.2.2/include/ruby-2.2.0/ruby/defines.h:57:0,
from /home/someone/.rbenv/versions/2.2.2/include/ruby-2.2.0/ruby/ruby.h:29,
from /home/someone/.rbenv/versions/2.2.2/include/ruby-2.2.0/ruby.h:33,
from cache.c:3:
/usr/include/unistd.h:972:13: note: previous declaration of ‘sync’ was here
extern void sync (void) __THROW;
^
Makefile:237: recipe for target 'cache.o' failed
make: *** [cache.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/someone/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/texplay-0.4.3 for inspection.
Results logged to /home/someone/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/extensions/x86_64-linux/2.2.0-static/texplay-0.4.3/gem_make.out
You should use the ruby -1.9.1 or -1.8.6!For that,please execute rvm default 1.9.1 or rvm default 1.8.6 in command line.After this,execute sudo gem install texplay.Hopefully,you will have already installed texplay! @lobo-tuerto
@dukuikui Thanks for the info, hope this gets migrated to Ruby 2.x+ !
Working with Ruby 1.8.6 (or Ruby < 2 for that matter) is a no-no for the moment.
Failed to build on ruby-2.2.3
[rtanque] gem install texplay -v 0.4.4.pre
Building native extensions. This could take a while...
ERROR: Error installing texplay:
ERROR: Failed to build gem native extension.
/Users/timnew/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20160422-84716-gh2jn2.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling actions.c
actions.c:12:11: fatal error: 'GL/glut.h' file not found
# include <GL/glut.h>
^
1 error generated.
make: *** [actions.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/timnew/.rvm/gems/ruby-2.2.3/gems/texplay-0.4.4.pre for inspection.
Results logged to /Users/timnew/.rvm/gems/ruby-2.2.3/extensions/x86_64-darwin-14/2.2.0-static/texplay-0.4.4.pre/gem_make.out
Is this because of gosu
? I'm using gosu (0.10.6)
Building native extensions. This could take a while... ERROR: Error installing texplay-0.4.3.gem: ERROR: Failed to build gem native extension.
checking for main() in -lglut... yes checking for main() in -lGL... yes creating Makefile
make "DESTDIR=" clean
make "DESTDIR=" compiling texplay.c In file included from texplay.c:9:0: texplay.h:41:3: error: ‘sync’ redeclared as different kind of symbol /usr/include/unistd.h:997:13: note: previous declaration of ‘sync’ was here make: *\ [texplay.o] Error 1
make failed, exit code 2