josephwilk / tlearn-rb

Recurrent Neural Network library for Ruby
96 stars 15 forks source link

make tlearn fails #13

Open ghost opened 10 years ago

ghost commented 10 years ago
$ gem install tlearn
# Building native extensions.  This could take a while...
# ERROR:  Error installing tlearn:
#   ERROR: Failed to build gem native extension.

#     ~/.rbenv/versions/2.1.2/bin/ruby extconf.rb
# creating Makefile

# make "DESTDIR=" clean

# make "DESTDIR="
# compiling activate.c
# activate.c:10:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
# #endif  EXP_TABLE
#         ^
#         //
# activate.c:19:1: warning: 'extern' ignored on this declaration [-Wmissing-declarations]
# extern  struct  cf {
# ^
# activate.c:28:1: warning: 'extern' ignored on this declaration [-Wmissing-declarations]
# extern  struct  nf {
# ^
# activate.c:42:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
# act_nds(aold,amem,anew,awt,local,atarget)
# ^~~~~~~
# activate.c:119:9: warning: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))'
#                                                                 exit(1);
#                                                                 ^
# activate.c:119:9: note: please include the header <stdlib.h> or explicitly provide a declaration for 'exit'
# activate.c:220:1: warning: control may reach end of non-void function [-Wreturn-type]
# }
# ^
#6 warnings generated.
# compiling arrays.c
# arrays.c:49:5: warning: implicit declaration of function 'free' is invalid in C99 [-Wimplicit-function-declaration]
#     free(error_values);
#     ^
# arrays.c:72:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
# make_arrays()
# ^~~~~~~~~~~
# arrays.c:84:3: warning: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))'
#                 exit(1);
#                 ^
# arrays.c:84:3: note: please include the header <stdlib.h> or explicitly provide a declaration for 'exit'
# arrays.c:124:60: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
#                 printf("wt malloc failed--needed %d bytes for pointers", nn*sizeof(float *));
#                                                  ~~                      ^~~~~~~~~~~~~~~~~~
#                                                  %lu
# arrays.c:197:1: warning: control may reach end of non-void function [-Wreturn-type]
# }
# ^
# arrays.c:199:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
# free_parrays(){
# ^~~~~~~~~~~~
# arrays.c:213:1: warning: control reaches end of non-void function [-Wreturn-type]
# }
# ^
# arrays.c:215:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
# make_parrays()
# ^~~~~~~~~~~~
# arrays.c:261:1: warning: control may reach end of non-void function [-Wreturn-type]
# }
# ^
#9 warnings generated.
# compiling compute.c
# compute.c:27:1: warning: 'extern' ignored on this declaration [-Wmissing-declarations]
# extern  struct  nf {
# ^
# compute.c:40:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
# comp_errors(aold,atarget,aerror,e,ce_e)
# ^~~~~~~~~~~
# compute.c:65:4: warning: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))'
#                         exit(1);
#                         ^
# compute.c:65:4: note: please include the header <stdlib.h> or explicitly provide a declaration for 'exit'
# compute.c:110:1: warning: control may reach end of non-void function [-Wreturn-type]
# }
# ^
# compute.c:113:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
# comp_deltas(apold,apnew,awt,adwt,aold,anew,aerror)
# ^~~~~~~~~~~
# compute.c:215:2: error: non-void function 'comp_deltas' should return a value [-Wreturn-type]
#         return;
#         ^
# compute.c:218:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
# comp_backprop(awt,adwt,aold,amem,atarget,aerror,local)
# ^~~~~~~~~~~~~
# compute.c:401:2: error: non-void function 'comp_backprop' should return a value [-Wreturn-type]
#         return;
#         ^
#6 warnings and 2 errors generated.
# make: *** [compute.o] Error 1

# make failed, exit code 2

# Gem files will remain installed in ~/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/tlearn-0.0.8 for inspection.
# Results logged to ~/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0-static/tlearn-0.0.8/gem_make.out
damienstanton commented 10 years ago

I can confirm this error. Make fails on 1.9.3 as well. I'm going to see if I can work through some of these warnings.

Danieth commented 10 years ago

I ran into the same problem on Ruby 2.1.2, followed by 1.9.3-p385. It would be great if this library was working, considering it is the only recurrent neural network gem.

josephwilk commented 10 years ago

I'm not actively working on support for new ruby versions but I welcome all contributions.

damienstanton commented 10 years ago

Make is failing for me using 1.9.3-p547. That said I will be glad to contribute to getting this working in 2.1.2. You've done some fantastic work with this library, @josephwilk

ghost commented 10 years ago

This issues does not seem to be specific to the ruby version. The error is thrown by gcc. Below is the output for ruby-1.8.7-p375. Unfortunately, I am not a pro in all things C. Any ideas?

$ git clone http://github.com/josephwilk/tlearn-rb.git && cd tlearn-rb
$ rbenv local 1.8.7-p375
$ gem build ./tlearn.gems
$ gem install --local ./tlearn-0.0.8.gem 
Building native extensions.  This could take a while...
ERROR:  Error installing ./tlearn-0.0.8.gem:
  ERROR: Failed to build gem native extension.

        ~/.rbenv/versions/1.8.7-p375/bin/ruby extconf.rb
creating Makefile

make
gcc -I. -I~/.rbenv/versions/1.8.7-p375/lib/ruby/1.8/i686-darwin14.0.0 -I~/.rbenv/versions/1.8.7-p375/lib/ruby/1.8/i686-darwin14.0.0 -I. -I/opt/X11/include -I~/.rbenv/versions/1.8.7-p375/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -O  -c activate.c
activate.c:10:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
#endif  EXP_TABLE
        ^
        //
activate.c:19:1: warning: 'extern' ignored on this declaration [-Wmissing-declarations]
extern  struct  cf {
^
activate.c:28:1: warning: 'extern' ignored on this declaration [-Wmissing-declarations]
extern  struct  nf {
^
activate.c:42:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
act_nds(aold,amem,anew,awt,local,atarget)
^~~~~~~
activate.c:119:9: warning: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))'
                                                                exit(1);
                                                                ^
activate.c:119:9: note: please include the header <stdlib.h> or explicitly provide a declaration for 'exit'
activate.c:220:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
6 warnings generated.
gcc -I. -I~/.rbenv/versions/1.8.7-p375/lib/ruby/1.8/i686-darwin14.0.0 -I~/.rbenv/versions/1.8.7-p375/lib/ruby/1.8/i686-darwin14.0.0 -I. -I/opt/X11/include -I~/.rbenv/versions/1.8.7-p375/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -O  -c arrays.c
arrays.c:49:5: warning: implicit declaration of function 'free' is invalid in C99 [-Wimplicit-function-declaration]
    free(error_values);
    ^
arrays.c:72:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
make_arrays()
^~~~~~~~~~~
arrays.c:84:3: warning: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))'
                exit(1);
                ^
arrays.c:84:3: note: please include the header <stdlib.h> or explicitly provide a declaration for 'exit'
arrays.c:124:60: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
                printf("wt malloc failed--needed %d bytes for pointers", nn*sizeof(float *));
                                                 ~~                      ^~~~~~~~~~~~~~~~~~
                                                 %lu
arrays.c:197:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
arrays.c:199:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
free_parrays(){
^~~~~~~~~~~~
arrays.c:213:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
arrays.c:215:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
make_parrays()
^~~~~~~~~~~~
arrays.c:261:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
9 warnings generated.
gcc -I. -I~/.rbenv/versions/1.8.7-p375/lib/ruby/1.8/i686-darwin14.0.0 -I~/.rbenv/versions/1.8.7-p375/lib/ruby/1.8/i686-darwin14.0.0 -I. -I/opt/X11/include -I~/.rbenv/versions/1.8.7-p375/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -O  -c compute.c
compute.c:27:1: warning: 'extern' ignored on this declaration [-Wmissing-declarations]
extern  struct  nf {
^
compute.c:40:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
comp_errors(aold,atarget,aerror,e,ce_e)
^~~~~~~~~~~
compute.c:65:4: warning: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))'
                        exit(1);
                        ^
compute.c:65:4: note: please include the header <stdlib.h> or explicitly provide a declaration for 'exit'
compute.c:110:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
compute.c:113:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
comp_deltas(apold,apnew,awt,adwt,aold,anew,aerror)
^~~~~~~~~~~
compute.c:215:2: error: non-void function 'comp_deltas' should return a value [-Wreturn-type]
        return;
        ^
compute.c:218:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
comp_backprop(awt,adwt,aold,amem,atarget,aerror,local)
^~~~~~~~~~~~~
compute.c:401:2: error: non-void function 'comp_backprop' should return a value [-Wreturn-type]
        return;
        ^
6 warnings and 2 errors generated.
make: *** [compute.o] Error 1

Gem files will remain installed in ~/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/tlearn-0.0.8 for inspection.
Results logged to ~/.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/tlearn-0.0.8/ext/tlearn/gem_make.out
damienstanton commented 10 years ago

I'm pretty comfortable in C. On a quick glance the errors are typical of a syntax error in the makefile or some other build problem. Nothing is jumping out at me though; I need to dig a bit.

I'm going to look at the called out files when I have some time later tonight / tomorrow.

lolgear commented 10 years ago

look at #14 pull request for this issue

ghost commented 10 years ago

Not having much luck. Would anyone look at this please? To me, it looks the same as before. (Same for ruby-2.1.2, cos)

$ tlearn-rb git:(master) git pull
Already up to date.
$ tlearn-rb git:(master) gem install tlearn -l .
Building native extensions.  This could take a while...
ERROR:  Error installing tlearn:
    ERROR: Failed to build gem native extension.

        ~.rbenv/versions/1.8.7-p375/bin/ruby extconf.rb
creating Makefile

make
gcc -I. -I~.rbenv/versions/1.8.7-p375/lib/ruby/1.8/i686-darwin14.0.0 -I~.rbenv/versions/1.8.7-p375/lib/ruby/1.8/i686-darwin14.0.0 -I. -I/opt/X11/include -I~.rbenv/versions/1.8.7-p375/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -O  -c activate.c
activate.c:10:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
#endif  EXP_TABLE
        ^
        //
activate.c:19:1: warning: 'extern' ignored on this declaration [-Wmissing-declarations]
extern  struct  cf {
^
activate.c:28:1: warning: 'extern' ignored on this declaration [-Wmissing-declarations]
extern  struct  nf {
^
activate.c:119:9: warning: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))'
                                                                exit(1);
                                                                ^
activate.c:119:9: note: please include the header <stdlib.h> or explicitly provide a declaration for 'exit'
4 warnings generated.
gcc -I. -I~.rbenv/versions/1.8.7-p375/lib/ruby/1.8/i686-darwin14.0.0 -I~.rbenv/versions/1.8.7-p375/lib/ruby/1.8/i686-darwin14.0.0 -I. -I/opt/X11/include -I~.rbenv/versions/1.8.7-p375/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -O  -c arrays.c
arrays.c:49:5: warning: implicit declaration of function 'free' is invalid in C99 [-Wimplicit-function-declaration]
    free(error_values);
    ^
arrays.c:84:3: warning: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))'
                exit(1);
                ^
arrays.c:84:3: note: please include the header <stdlib.h> or explicitly provide a declaration for 'exit'
arrays.c:124:60: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
                printf("wt malloc failed--needed %d bytes for pointers", nn*sizeof(float *));
                                                 ~~                      ^~~~~~~~~~~~~~~~~~
                                                 %lu
3 warnings generated.
gcc -I. -I~.rbenv/versions/1.8.7-p375/lib/ruby/1.8/i686-darwin14.0.0 -I~.rbenv/versions/1.8.7-p375/lib/ruby/1.8/i686-darwin14.0.0 -I. -I/opt/X11/include -I~.rbenv/versions/1.8.7-p375/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -O  -c compute.c
compute.c:27:1: warning: 'extern' ignored on this declaration [-Wmissing-declarations]
extern  struct  nf {
^
compute.c:40:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
comp_errors(aold,atarget,aerror,e,ce_e)
^~~~~~~~~~~
compute.c:65:4: warning: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))'
                        exit(1);
                        ^
compute.c:65:4: note: please include the header <stdlib.h> or explicitly provide a declaration for 'exit'
compute.c:110:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
compute.c:113:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
comp_deltas(apold,apnew,awt,adwt,aold,anew,aerror)
^~~~~~~~~~~
compute.c:215:2: error: non-void function 'comp_deltas' should return a value [-Wreturn-type]
        return;
        ^
compute.c:218:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
comp_backprop(awt,adwt,aold,amem,atarget,aerror,local)
^~~~~~~~~~~~~
compute.c:401:2: error: non-void function 'comp_backprop' should return a value [-Wreturn-type]
        return;
        ^
6 warnings and 2 errors generated.
make: *** [compute.o] Error 1

Gem files will remain installed in ~.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/tlearn-0.0.8 for inspection.
Results logged to ~.rbenv/versions/1.8.7-p375/lib/ruby/gems/1.8/gems/tlearn-0.0.8/ext/tlearn/gem_make.out
ERROR:  Could not find a valid gem '.' (>= 0) in any repository
lolgear commented 10 years ago

@joelmeyerhamme, I think that you did not pull new version of gem (please, pull latest commit and install gem manually from path, not from git via gemfile)

ghost commented 10 years ago

Yep, did that.

$  tlearn-rb git:(master) git log
commit 74dfe517c5d23b9a9747e7fff79e5a5f395b29d2
Merge: 1c247cc 98031b4
Author: Joseph Wilk <joe@josephwilk.net>
Date:   Sun Sep 21 18:05:27 2014 +0200

    Merge pull request #14 from lolgear/master

    c functions seems to be correct now

commit 98031b4dc1ca403e92e62276e5ca1a231924a474
Author: lolgear <gaussblurinc@gmail.com>
Date:   Sun Sep 21 19:48:30 2014 +0400

    c functions seems to be correct now
patrickjonesdotca commented 9 years ago

I can confirm that this still fails

compute.c:215:2: error: non-void function 'comp_deltas' should return a value [-Wreturn-type]
        return;
        ^
compute.c:218:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
comp_backprop(awt,adwt,aold,amem,atarget,aerror,local)
^~~~~~~~~~~~~
compute.c:401:2: error: non-void function 'comp_backprop' should return a value [-Wreturn-type]
        return;
        ^
lolgear commented 9 years ago

I need more information about your fail, please, post information about c-compiler that used for that library-compilation task

ghost commented 9 years ago

Not sure this helps, how is the compiler invoked?

~ » clang --version
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0
Thread model: posix
~ » gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0
Thread model: posix