somaticio / tensorflow.rb

tensorflow for ruby
BSD 3-Clause "New" or "Revised" License
829 stars 63 forks source link

Unable to install with ruby 2.2.5 #94

Closed aishmita-aggarwal closed 6 years ago

aishmita-aggarwal commented 7 years ago

I am getting the following output on running 'make'

compiling Tensorflow_wrap.cxx In file included from Tensorflow_wrap.cxx:2733: ././files/tf_tensor_helper.cc:43:46: error: arithmetic on a pointer to void (char )(buffer_data_pointer+i) = file_string[i];


././files/tf_tensor_helper.cc:52:56: error: arithmetic on a pointer to void
                buffer += *(char *)(buffer_data_pointer+i);
                                    ~~~~~~~~~~~~~~~~~~~^
././files/tf_tensor_helper.cc:264:39: error: arithmetic on a pointer to void
        auto dst_str = (char *)(cbytes+8);
                                ~~~~~~^
././files/tf_tensor_helper.cc:274:36: error: arithmetic on a pointer to void
        auto src = (char *)(cbytes + 8);
                            ~~~~~~ ^
4 errors generated.
make: *** [Tensorflow_wrap.o] Error 1
arafatkatze commented 7 years ago

Hi Aishmita, This may be an issue with your c++ compiler.

Can you please tell me which version you are using? Also, can you please try using the install.sh script present in tools folder of the respository. Thanks

On Jul 4, 2017 4:47 AM, "Aishmita Aggarwal" notifications@github.com wrote:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/somaticio/tensorflow.rb/issues/94, or mute the thread https://github.com/notifications/unsubscribe-auth/AKo3B33UKSTvH27NIHCI7a2VVniGI-Asks5sKiXjgaJpZM4ONP8e .

hakanai commented 7 years ago

Getting the same compiler error here.

$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ clang --version
Apple LLVM version 8.1.0 (clang-802.0.42)
Target: x86_64-apple-darwin16.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

I'm not so sure this is an issue with the compiler, so much as it's just that a newer version of the compiler started banning some questionable pointer arithmetic which this code happens to be doing.

e.g., if you change this:

        auto dst_str = (char *)(cbytes+8);

To this:

        auto dst_str = (char *)cbytes + 8;

Now you get one less error. The other 3 look like more or less the same thing.

hakanai commented 7 years ago

Disclaimer: I don't know if that change I suggested means the same thing on all platforms, and also the library crashes for me after making this change, and I don't know whether that crash is due to this, or just because tensorflow itself is broken.

-- Control frame information -----------------------------------------------
c:0005 p:---- s:0044 e:000043 CFUNC  :TF_NewTensor_wrapper
c:0004 p:0280 s:0035 e:000032 METHOD /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/tensorflow-0.0.1/lib/tensorflow/tensor.rb:59 [FINISH]
c:0003 p:---- s:0027 e:000026 CFUNC  :new
c:0002 p:0629 s:0021 E:002698 EVAL   classify_image.rb:71 [FINISH]
c:0001 p:0000 s:0003 E:0006e0 (none) [FINISH]
hakanai commented 7 years ago

Ah, this issue is a duplicate of #84.

arafatkatze commented 6 years ago

@aishmita-aggarwal @trejkaz @chrhansen I am incredibly sorry for the delayed response for this.
I couldn't replicate this issue on my machine before and therefore, I couldn't help you out.
I have updated the code to solve this issue and therefore I am closing this issue.
If the issue still persists feel free to reopen this and I will try my best to help you out.
Thanks