I am trying to run a compiled C++ program on my webserver (Debian), but the terminal is outputting the following error message:
-bash: ./program.bin: Permission denied
The rights on program.bin are set to -rwxr-xr-x, which means that it should have the permission to be executed. I already tried running /bin/bash program.bin, but this is giving me this error:
ovInterface.bin: ovInterface.bin: cannot execute binary file
The hosting provider of the webserver probably has forbidden this, since there are a lot of websites/accounts hosted on my webserver. If that's the case, is it possible to bypass this restriction? I was able to run .php files in the background of the webserver, which had an infinite for loop and handled socket connections etc.
Any help would be appreciated!
EDIT:
I found out that the cannot execute binary file error from /bin/bash program.bin means that the compiled program is not built for the system architecture. program.bin was compiled on another machine (however both are 64-bit).
If it is possible to run the .bin file using /bin/bash: How do I compile C++ code to executables without access to gcc, g++, make and apt-get? Can I upload a compiler executable to my webserver and compile the C++ source then?
Related
I'm trying to install a software in Ubuntu 20.04. When running the setup, an error occurs because it's trying to write a log file in root folder.
This error was not present when I installed the same program in Ubuntu 16.04. Even, without running it as root.
I suspect that the installation program is trying to read some enviroment variable that not longer exists in this version, and it's trying to locate the log files in root folder by default.
Is there any method to know which enviroment variables is trying to read a binary file?
Try strace, it will tell you all calls to OS.
I would like to compile some C++ code from source and then run a Python wrapper on my web hosting server as a cron job. I compiled it on my Mac, uploaded onto the server and, unsurprisingly, the server running Linux complained saying:
OSError: [Errno 8] Exec format error
I do not have the rights to run g++ sptree.cpp tsne.cpp -o bh_tsne -O2 on the server. Is there a way for me to obtain a compiled binary that would be compatible with whatever OS (Linux) the server is running on? Thanks!
This is essentially the reason people moved to java, which is platform independent.
For C++, you need the specific link libraries for the target machine. Some compilers have the option of choosing the linker objects by flag (or setting) and allowing someone to "script" the final executable output. I cant say if the Mac does...
I used a library (the library is called cublas) in my CUDA code which I 'm writing in linux, I can compile my code successfully using nvcc but when I run the code I get this error:
error while loading shared libraries: libcublas.so.7.5: cannot open shared object file: No such file or directory
I found This link as a solution which suggests to run some commands in order to solve the issue. one solution based on this link is running the following command:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib
The system which gpu locates in it and I am using to run my code on it is shared between me and other people, I am not a sudo user in that system. I am wondering if running this command is safe and does not affect other settings of the system
Can anyone please help me to know that>
Thank you so much
I am wondering if running this command is safe and does not affect other settings of the system
Yes, you'll be fine.
This command:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib
only affects the process you execute it in.
It will not affect any other user's process, or any other process of yours.
Furthermore, if you log out and log in again, you will have to execute that command again. It is not "sticky"
Operating System: Windows 8.1
Cygwin Version: Latest version, as of Sept. 9, 2014.
Guile Version: 1.8
Background:
My overall goal is to install a program called "MIT Photonics Band (MPB)" on Windows 8.1 using Cygwin. I am a new user, as I started using Cygwin a few days ago. I was able to install all required packages successfully after some troubleshooting. Eventually, I installed the MPB program using the generic ./configure, make, make install commands with slight modifications. All of this appeared to be successful.
The Problem:
When I try to run the executable program, I get the following error:
ERROR: In procedure primitive-load-path:
ERROR: Unable to find file "ice-9/boot-9.scm" in load path
Attempt At Solution:
The following is a page of the MPB installation manual:
MPB Installation Manual - Shared Libraries.
It appears to address my issue. Note that it mentions LIBDIR and foobar. For my operating system, foobar is PATH. The LIBDIR, however, I do not know explicitly because my "make install" output did not indicate it, as the manual suggests it should have. Anyhow, I found the location of ice-9/boot-9.scm through a computer search and its directory happens to be here:
C:\cygwin64\usr\share\guile\1.8\ice-9
Hence, I ran the following command (again, for a Windows 8.1 operating system) in bash:
$ export PATH="/usr/share/guile/1.8/ice-9:$PATH"
However, note that when I run $PATH, I get this message:
-bash: /usr/share/guile/1.8/ice-9:/usr/local/bin:/usr/bin:/cygdrive/c/Program: No such file or directory
I also tried:
$ export GUILE_LOAD_PATH="/usr/share/guile/1.8/ice-9:$GUILE_LOAD_PATH"
That yielded:
-bash: /usr/share/guile/1.8/ice-9:: No such file or directory
Furthermore, I tried to copy and paste the "ice-9" folder in various locations for a quick and sloppy solution, but it was to no avail. I searched online for answers as some users have had an issue with the program not finding the ice-9/boot-9.scm file in the past. I could not get my problem solved.
Please let me know if I need to provide more information. I appreciate the help!
EDIT: In response to the first user's post, I used the command echo $PATH and the following was the output:
/usr/share/guile/1.8:/usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/cygdrive/c/Program Files (x86)/AMD APP/bin/x86_64:/cygdrive/c/Program Files (x86)/AMD APP/bin/x86:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files (x86)/Windows Live/Shared:/cygdrive/c/Program Files (x86)/ATI Technologies/ATI.ACE/Core-Static:/cygdrive/c/Program Files/MATLAB/R2013a/runtime/win64:/cygdrive/c/Program Files/MATLAB/R2013a/bin:/cygdrive/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit:/cygdrive/c/Program Files/Microsoft SQL Server/110/Tools/Binn:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/MATLAB/MATLAB Compiler Runtime/v81/runtime/win64:/usr/lib/lapack
Note that the problem still persists.
EDIT 2:
So I opened the "load.scm" file for GUILE and I found this line:
(define load-path '("/usr/share/emacs/20.7/lisp/"
"/usr/share/emacs/20.7/lisp/emacs-lisp/"))
I tried to add /usr/share/guile/1.8/ to these directories, but that didn't do anything either. Can't tell what's wrong.
In Windows, using Cygwin: How can I get the shebang line in a shell file to load the PHP interpreter?
I am using the prggmr library.
By default, in the shell file this is what I have
#!/usr/bin/php
And it works if I type this into Cygwin:
php c:/path/to/file
I have PHP and this Library setup in my environment paths so I can just type prggmr. So by typing "prggmr" it should work, but i keep getting
/cygdrive/c/lib/prggmr/bin/prggmr: /cygdrive/c/wamp/bin/php/php5.4.3:
bad interpreter: Permission denied
I have tried these with no luck, the same error as above:
#!/c/wamp/bin/php/php5.4.3
#!/cygdrive/c/wamp/bin/php/php5.4.3
If I'm reading your Paths right you have a Win32 PHP installed that you want to use with PHP. Normally, I'd say don't do it this way as things are going to get confused. Better to install PHP in Cygwin directly imo. There are a few resources out there, check out
this one for a good starting point.