0

I am working on matlab R2013a on Ubuntu. I am referring this code:

sift_bin = fullfile('lib/sift/bin/siftfeat');   
[pf,nf,ef] = fileparts(filename);
desc_file = [fullfile(pf,nf) '.txt'];
im1=imread(filename);
if (size(im1,1)<=1000 && size(im1,2)<=1000)
    status1 = system([sift_bin ' -x -o ' desc_file ' ' filename]);
else
    status1 = system([sift_bin ' -d -x -o ' desc_file ' ' filename]);
end

But it gives an error:

lib/sift/bin/siftfeat cannot execute binary file

Is there anything wrong with system call?

lib/sift/bin/siftfeat is a path of sift library.

sam
  • 13
  • 5
  • Are you missing a forward slash before lib or is that supposed to be a relative path? – Martin Dinov Feb 08 '14 at 11:01
  • Did you download the binaries for the right architecture? Do you get the same error, if you run the command via linux terminal? I think it's an issue with the binaries, not with your matlab code. – Daniel Feb 08 '14 at 11:42
  • Giving same error while running on the command via terminal – sam Feb 08 '14 at 12:11

1 Answers1

1

Use file utility to make sure that file is an executable and see its architecture

system('file /bin/ls')
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked
(uses shared libs), for GNU/Linux 2.6.24,
BuildID[sha1]=0xf31e99218b4d7034cf8257055686bca22f5a3c01, stripped
ans = 0

Then uname -a shows architecture of your system

system('uname -a')
Linux optiPlex7010 3.8.0-35-generic #50-Ubuntu SMP Tue Dec 3 01:24:59 UTC 2013
x86_64   x86_64 x86_64 GNU/Linux
ans = 0

As one can see I have 64-bit Linux and executable is also 64-bit. However, when it comes to 32-bit systems and executable support is backward compatible. That means 64-bit system may execute both 32-bit and 64-bit executables, but 32-bit system can execute only 32-bit executables.

From your comments I see that you are trying to launch 64-bit executable in 32-bit system, which is not capable of doing that. You should find 32-bit version of siftfeat or change your OS to 64-bit, if that is possible.

divanov
  • 6,173
  • 3
  • 32
  • 51
  • all checked.but couldn't find where the problem is. – sam Feb 12 '14 at 06:23
  • I tried all these conditions,for dot calls it is same error, for system('file /bin/ls') output is - /bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x83531f308f1fa18221be53eaf399303400c14638, stripped status1 = 0 – sam Feb 12 '14 at 08:46
  • OUTPUT is: lib/sift/bin/siftfeat: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, BuildID[sha1]=0x34f774d3c6d2665c2b811bbd78ddf6a37d437b7f, not stripped status is 0 – sam Feb 12 '14 at 09:14
  • Linux ubuntu 3.2.0-58-generic-pae #88-Ubuntu SMP Tue Dec 3 18:00:02 UTC 2013 i686 i686 i386 GNU/Linux – sam Feb 12 '14 at 10:23
  • See an updated answer. Could you please also add `system('uname -a')` and `system('file lib/sift/bin/siftfeat')` to the question, so it would be easy for other people to see the full problem? – divanov Feb 12 '14 at 10:30
  • Thanks. Really appreciate your effort. Thank you for responding. – sam Feb 12 '14 at 10:35
  • definitely...Thank you.As soon as i get privileges i will vote up your answer.Thank you for your response – sam Feb 15 '14 at 13:47