Ubuntu error: "filename" cannot execute binary file - matlab

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.

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.

Related

How to solve "no such file or directory" when trying to run aarch64-gnu-linux-g++ (64-bit version) on 64-bit Ubuntu Linux O/S?

The title I think says it all. Originally I though it might be a 64-bit program running on a 32-bit O/S - not the case as far as I can see.
yoctoadm#kickseed:/ntg6src/source/packages/sdk_armv8/sysroots/x86_64-oesdk-linux/usr/bin/aarch64-gnu-linux$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial
// uname -a output
yoctoadm#kickseed:/ntg6src/source/packages/sdk_armv8/sysroots/x86_64-oesdk-linux/usr/bin/aarch64-gnu-linux$ uname -a
Linux kickseed 4.4.0-165-generic #193-Ubuntu SMP Tue Sep 17 17:42:52 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
// file aarch64-gnu-linux-g++ output
yoctoadm#kickseed:/ntg6src/source/packages/sdk_armv8/sysroots/x86_64-oesdk-linux/usr/bin/aarch64-gnu-linux$ file aarch64-gnu-linux-g++
aarch64-gnu-linux-g++: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /ntg6sdk, for GNU/Linux 2.6.32, BuildID[sha1]=0bc9f03b2a2bee373f6ec3c85527230243579763, stripped
// no such file or directory error
yoctoadm#kickseed:/ntg6src/source/packages/sdk_armv8/sysroots/x86_64-oesdk-linux/usr/bin/aarch64-gnu-linux$ ls
aarch64-gnu-linux-addr2line aarch64-gnu-linux-dwp aarch64-gnu-linux-gcc-nm aarch64-gnu-linux-gdb aarch64-gnu-linux-nm aarch64-gnu-linux-size
aarch64-gnu-linux-ar aarch64-gnu-linux-elfedit aarch64-gnu-linux-gcc-ranlib aarch64-gnu-linux-gprof aarch64-gnu-linux-objcopy aarch64-gnu-linux-strings
aarch64-gnu-linux-as aarch64-gnu-linux-g++ aarch64-gnu-linux-gcov aarch64-gnu-linux-ld aarch64-gnu-linux-objdump aarch64-gnu-linux-strip
aarch64-gnu-linux-c++filt aarch64-gnu-linux-gcc aarch64-gnu-linux-gcov-dump aarch64-gnu-linux-ld.bfd aarch64-gnu-linux-ranlib
aarch64-gnu-linux-cpp aarch64-gnu-linux-gcc-ar aarch64-gnu-linux-gcov-tool aarch64-gnu-linux-ld.gold aarch64-gnu-linux-readelf
yoctoadm#kickseed:/ntg6src/source/packages/sdk_armv8/sysroots/x86_64-oesdk-linux/usr/bin/aarch64-gnu-linux$ ./aarch64-gnu-linux-g++
bash: ./aarch64-gnu-linux-g++: No such file or directory
The environment variables weren't setup correctly. It was necessary to "source" the environment file, which exports the correct environment variables.

nvcc compiler not found on $PATH

I am getting the following error with theano:
ERROR (theano.sandbox.cuda): nvcc compiler not found on $PATH. Check
your nvcc installation and try again.
I've tried every solution given by previous questions. Running nvcc -V returns the following:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85
And which nvcc returns the following:
/usr/local/cuda-9.1/bin//nvcc
I've also confirmed I have an nvcc file in /usr/local/cuda-9.1/bin.
I've ran the following commands to ensure nvcc can be found:
export PATH=/usr/local/cuda-9.1/bin/:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-9.1/lib64:$LD_LIBRARY_PATH
exec bash
I've confirmed the nvcc location is definitely in $PATH as running echo $PATH returns the following:
/home/paperspace/anaconda3/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/anaconda3/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/src/torch/install/bin:/usr/local/cuda-9.1/bin/:/usr/local/cuda-9.1/bin/:/home/paperspace/anaconda3/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/anaconda3/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/anaconda3/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/anaconda3/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/anaconda3/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/anaconda3/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/src/torch/install/bin:/usr/local/cuda/bin/:/home/paperspace/src/torch/install/bin:/home/paperspace/bin:/home/paperspace/anaconda3/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/src/torch/install/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-9-oracle/bin:/usr/lib/jvm/java-9-oracle/db/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/usr/local/cuda/bin
Also if I open a python console and run import os; print(os.environ["PATH"]) I get the following (same thing):
/home/paperspace/anaconda3/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/anaconda3/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/src/torch/install/bin:/usr/local/cuda-9.1/bin/:/usr/local/cuda-9.1/bin/:/home/paperspace/anaconda3/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/anaconda3/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/anaconda3/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/anaconda3/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/anaconda3/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/anaconda3/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/src/torch/install/bin:/usr/local/cuda/bin/:/home/paperspace/src/torch/install/bin:/home/paperspace/bin:/home/paperspace/anaconda3/bin:/home/paperspace/src/torch/install/bin:/home/paperspace/src/torch/install/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-9-oracle/bin:/usr/lib/jvm/java-9-oracle/db/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/usr/local/cuda/bin
My .theanorc file in /home/paperspace is as follows:
[global]
device = cuda
floatX = float32
[cuda]
root = /usr/local/cuda-9.1

Calling sem_open on Solaris as ordinary user

This call fails on Solaris with EACCES when ran as ordinary user:
sem_open(fileName.c_str(), O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO, 1);
When process is started as root, it runs fine. Is this expected behavior?
Environment:
$ uname -a
SunOS solaris 5.11 11.0 i86pc i386 i86pc
$ g++ --version
g++ (GCC) 4.5.2
At the command line try:
prctl $$
These are the system enforced resource limits your process has. Note there are
process.max-sem-ops
process.max-sem-nsems
project.max-sem-ids
These are limits that have a number, if you do not see them (or the limits are already reached) then you have to add them to your account's profile with projadd or projmod to increase them if your project already exists.
If you cannot do this (no root access) consult with your sysadmin, s/he probably has some reason for not allowing semapahore access.
Note carefully:
sempahores are kernel persistent. If you ran your code a bunch of times the sempahores you created are likely still out there.
To see existing semaphores try ipcs -as
To remove lingering sempahores that your code should have removed use ipcrm

Inline::C build failure

I am using active perl 5.14.2. Here I am trying to use a windows C library in my perl code using Inline::C
use strict;
use Inline C => DATA =>
CCFLAGS => '-std:C99 -Tx86-coff -Zi -Ob1 -fp:precise -W1 -Gd -Ze -Go -D_USER_SPACE_' =>
INC => '"-ID:\test\incl"' =>
LIBS => '"-LD:\test\lib" -llib1 -llib2 -llib3 -llib4';
test();
__END__
__C__
#include <incl/hd1.h>
#include <stdio.h>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
void test(void) {
.........
While I am trying to run the script its failing with below error
Warning. No Inline C functions bound to Perl in .\test.pl
Check your C function definition(s) for Inline compatibility
Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Perl5.14\bin\perl.exe C:\Perl5.14\lib\ExtUtils\xsubpp -typemap "C:\Perl5.14\lib\ExtUtils\typemap" test_pl_7fbb.xs > test_pl_7fbb.xsc && C:\Perl5.14\bin\perl.exe -M
ExtUtils::Command -e "mv" -- test_pl_7fbb.xsc test_pl_7fbb.c
cl -c -I"D:/test" "-ID:\test\incl" -std:C99 -Tx86-coff -Zi -Ob1 -fp:precise -W1 -Gd -Ze -Go -D_USER_SPACE_ -MD -Zi -DNDEBUG -O1 -DVERSIO
N=\"0.00\" -DXS_VERSION=\"0.00\" "-IC:\Perl5.14\lib\CORE" test_pl_7fbb.c
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\cl.EXE"' : return code '0xc0000135'
Stop.
A problem was encountered while attempting to compile and install your Inline
C code. The command that failed was:
C:\PROGRA~2\MICROS~1.0\VC\bin\nmake.exe > out.make 2>&1
The build directory was:
D:\test\_Inline\build\test_pl_7fbb
To debug the problem, cd to the build directory, and inspect the output files.
at .\test.pl line 0
...propagated at C:/Perl5.14/site/lib/Inline/C.pm line 772.
INIT failed--call queue aborted.
PS D:\cmapl_test> perl -v
This is perl 5, version 14, subversion 2 (v5.14.2) built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2011, Larry Wall
Binary build 1402 [295342] provided by ActiveState http://www.ActiveState.com
Built Oct 7 2011 15:49:44
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
I tried to build the test_pl_7fbb.c file using the command:
cl -c "-ID:\test" "-ID:\test\include" -std:C99 -Tx86-coff -Zi -Ob1 -fp:precise -W1 -
Gd -Ze -Go -D_USER_SPACE_ -MD -Zi -DNDEBUG -O1 "-DVERSION=0.00"
"-DXS_VERSION=0.00" "-IC:\Perl5.14\lib\CORE" test_pl_7fbb.c
It got completed without error.
My guess the option -I"D:/test" used by Inline while compiling is causing the issue.
Thanks in advance for any help on this.
You seem to have installed Visual C VC-9 (VS 2008), but last time I used Activeperl's Inline C it required VC-6.
If that's the reason, you could try to install VC 6 or switch to Strawberry Perl which has the gcc 4.6 tool chain included.
You could try installing MinGW from ActivePerl's PPM servers. It would probably need a recompile of many of your installed modules to work, but i'm sure it'll make things like Inline::C work properly.

Schrödinger's file

I am puzzled by the following sequence of commands.
sh-4.2$ pwd
/home/willard
sh-4.2$ ls -l f
-rwxr-xr-x 1 willard users 59116 Jan 23 14:54 f
sh-4.2$ file f
f: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, BuildID[sha1]=0xea0e08ff2b5a062698d45b78177acdd6bf140d1f, stripped
sh-4.2$ ./f
sh: ./f: No such file or directory
sh-4.2$ strace ./f
execve("./f", ["./f"], [/* 32 vars */]) = -1 ENOENT (No such file or directory)
write(2, "strace: exec: No such file or di"..., 40strace: exec: No such file or directory
) = 40
exit_group(1) = ?
+++ exited with 1 +++
sh-4.2$ ls -l f
-rwxr-xr-x 1 willard users 59116 Jan 23 14:54 f
sh-4.2$ uname -a
Linux xdat10 3.6.2-1-ARCH #1 SMP PREEMPT Fri Oct 12 23:58:58 CEST 2012 x86_64 GNU/Linux
How is this possible?
I found someone having the same problem (with relative explanation)
Running 32bit binary on a 64bit system
Quoting the most important sentences:
This situation often arises when you try to run a binary for the right
system (or family of systems) and superarchitecture but the wrong
subarchitecture. Here you have ELF binaries on a system that expects
ELF binaries, so the kernel loads them just fine. They are i386
binaries running on an x86_64 processor, so the instructions make
sense and get the program to the point where it can look for its
loader. But the program is a 32-bit program (as the file output
indicates), looking for the 32-bit loader /lib/ld-linux.so.2, and
you've presumably only installed the 64-bit loader
/lib64/ld-linux-x86-64.so.2 in the chroot.
You need to install the 32-bit runtime system in the chroot: the
loader, and all the libraries the programs need. On Debian amd64, the
32-bit loader is in the libc6-i386 package. You can install a bigger
set of 32-bit libraries by installing ia32-libs.
I bet there's a better way to verify this but i'd try to exec
ldd ./f
and search in the output which loader is needed to exec'it
man 2 execve:
ENOENT The file filename or a script or ELF interpreter does not
exist, or a shared library needed for file or interpreter can‐
not be found.
You could run ldd against this binary to look for libraries that could not be mapped and install them from multilib.