nmatrix icon indicating copy to clipboard operation
nmatrix copied to clipboard

Installation error: suffix or operands invalid for `movq'

Open dimidd opened this issue 9 years ago • 10 comments

I tried installing using gem install nmatrix on osx, using gcc 5.2.0.

In file included from nmatrix.cpp:283:0: ruby_nmatrix.c: In function 'VALUE nm_reshape_bang(VALUE, VALUE)': ruby_nmatrix.c:1117:11: warning: unused variable 'elem' [-Wunused-variable] void* elem = s->elements; ^ ruby_nmatrix.c: In function 'VALUE nm_complex_conjugate(VALUE)': ruby_nmatrix.c:1095:35: warning: 'copy' is used uninitialized in this function [-Wuninitialized] return nm_complex_conjugate_bang(nm_init_copy(copy,self)); ^ ruby_nmatrix.c: In function 'VALUE nm_init_new_version(int, VALUE_, VALUE)': ruby_nmatrix.c:1175:11: warning: 'init' may be used uninitialized in this function [-Wmaybe-uninitialized] void_ init; ^ /var/folders/sc/2zd_v0qn76gdq5sdg63_jx4r0000gn/T//cc1KmZTQ.s:13579:suffix or operands invalid for `movq' make: *** [nmatrix.o] Error 1

make failed, exit code 2

dimidd avatar Nov 10 '15 12:11 dimidd

I've never tried to install with GCC 5.2, and this is a new one. What happens if you use 4.9?

translunar avatar Nov 10 '15 17:11 translunar

same error, the warnings are slightly different: In file included from nmatrix.cpp:283:0: ruby_nmatrix.c: In function 'VALUE nm_reshape_bang(VALUE, VALUE)': ruby_nmatrix.c:1117:11: warning: unused variable 'elem' [-Wunused-variable] void* elem = s->elements; ^ ruby_nmatrix.c: In function 'VALUE nm_complex_conjugate(VALUE)': ruby_nmatrix.c:1095:59: warning: 'copy' is used uninitialized in this function [-Wuninitialized] return nm_complex_conjugate_bang(nm_init_copy(copy,self)); ^ ruby_nmatrix.c: In function 'VALUE nm_init_new_version(int, VALUE_, VALUE)': ruby_nmatrix.c:578:9: warning: 'init' may be used uninitialized in this function [-Wmaybe-uninitialized] if (curr->val == values) { ^ ruby_nmatrix.c:1175:11: note: 'init' was declared here void_ init; ^ /var/folders/sc/2zd_v0qn76gdq5sdg63_jx4r0000gn/T//ccM1fWw3.s:13173:suffix or operands invalid for `movq' make: *** [nmatrix.o] Error 1

make failed, exit code 2

dimidd avatar Nov 12 '15 07:11 dimidd

Googling around for this error, it only seems to occur when a project has some inline assembly code, which nmatrix doesn't have, so that's a little puzzling.

It seems like this error sometimes comes from some sort of 32- vs 64-bit incompatibility, but these days I think OS X is always purely 64-bit, so that also doesn't really make sense.

@dimidd, does the .s file in /var/folders still exist after you finish building? You could try to look at it, or upload (a snippet of) it for us to look. Hopefully it will provide some clue as to where this is coming from.

wlevine avatar Nov 12 '15 14:11 wlevine

@wlevine, unfortunately no. Perhaps I should put a breakpoint in ruby_nmatrix.c and inspect the assembly.

dimidd avatar Nov 12 '15 15:11 dimidd

There should be an option to get gcc to output the assembly. gcc -S, not quite sure if it would be trivial to get that working in the nmatrix build. This also looks like it might be useful, to get an annotated version of the assembly:http://stackoverflow.com/a/19083877/4992690

On Thu, Nov 12, 2015 at 10:23 AM, dimidd [email protected] wrote:

@wlevine https://github.com/wlevine, unfortunately no. Perhaps I should put a breakpoint in ruby_nmatrix.c and inspect the assembly.

— Reply to this email directly or view it on GitHub https://github.com/SciRuby/nmatrix/issues/406#issuecomment-156136799.

wlevine avatar Nov 12 '15 15:11 wlevine

The makefile has a lots of flags variables, where should I add -S?

dimidd avatar Nov 12 '15 16:11 dimidd

Sorry for the slow response. You can add it to CFLAGS and CPPFLAGS. Then when you run make you should end up with some ".o" files that are actually not object files, but assembly files in disguise. You can run as on them to isolate where the error is.

wlevine avatar Nov 16 '15 15:11 wlevine

@dimidd Have you had any luck? I can try this week if you're still struggling.

translunar avatar Dec 21 '15 14:12 translunar

Sorry for the late response, I had a problem installing ATLAS. I've finally managed to install using macports, and added -L/opt/local/lib in LDFLAGS. Now when running bundle exec rake spec I have a different issue:

list {
    can be duplicated OK (0.00s)
    enforces shape boundaries OK (0.00s)
    sets and gets OK (0.00s)
    sets and gets references OK (0.00s)
    Ruby object {
      allows iteration of matrices dyld: lazy symbol binding failed: Symbol not found: __ZNSt8__detail15_List_node_base7_M_hookEPS0_
  Referenced from: /Users/dimidd/nmatrix/lib/nmatrix.bundle
  Expected in: flat namespace

dyld: Symbol not found: __ZNSt8__detail15_List_node_base7_M_hookEPS0_
  Referenced from: /Users/dimidd/nmatrix/lib/nmatrix.bundle
  Expected in: flat namespace

This may be relevant: https://groups.google.com/forum/#!topic/sciruby-dev/M2MOsmNH8Oo

dimidd avatar Jan 06 '16 09:01 dimidd

This kind of stuff seems to happen when linking between things compiled by different compilers. I'm not sure why I didn't mention that before. I may have only just recognized the error.

translunar avatar Jan 26 '16 14:01 translunar