lubuntu does not see executable file generated by ocamlopt on NixOS - ocaml

i created executable "standalone" file in NixOS (x86_64) using "ocamlopt" native compiler with option -linkall. and the generated program is executed in NixOS. so far so good
after that i tried to execute this file under Lubuntu
lubuntu#lubuntu:~/Documents$ uname -a
Linux lubuntu 4.18.0-10-generic #11-Ubuntu SMP Thu Oct 11 15:13:55 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
but recieved:
lubuntu#lubuntu:~/Documents$ ./a.out
bash: ./a.out: No such file or directory
i am quite sure that architecture is suitable:
lubuntu#lubuntu:~/Documents$ objdump -h a.out
a.out: file format elf64-x86-64
what i did wrong? on NixOS, on OCaml, on Lubuntu?
Tnx in advance
UDP: my NixOS distro:
$> uname -a
Linux cat 4.19.36 #1-NixOS SMP Sat Apr 20 07:16:05 UTC 2019 x86_64 GNU/Linux
ocaml:
$> ocamlopt -v
The OCaml native-code compiler, version 4.06.1
UDP2:
$> readelf -a a.out | grep ld-
[Requesting program interpreter: /nix/store/681354n3k44r8z90m35hm8945vsp95h1-glibc-2.27/lib/ld-linux-x86-64.so.2]

"No such file or directory" (ENOENT) when trying to execute a file that does exist usually means that its dynamic linker path (ELF interpreter) doesn't exist. It's exactly the same error for the same reason you'd get from executing a text file that started with #!/non-existant/path
Use strace ./a.out to see that the only system call is the execve which fails.
Most GNU/Linux distros use /lib64/ld-linux-x86-64.so.2. For example file /bin/ls on my Arch GNU/Linux desktop shows:
/bin/ls: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=4fef2dc9762eb7d4593f402a65cc02bb3d4c48de, for GNU/Linux
3.2.0, stripped
Presumably NixOS, or at least ocamlopt on NixOS, uses a different path. Use file to check. (Or readelf -a to show the ELF program headers will also dump the interpreter path.)
ldd can also show the interpreter path, but IIRC fails if the path isn't valid.

Related

configure: error: Fortran compiler cannot create executables

I'm trying to install Quantum ESPRESSO on my computer and have run into an issue when using the ./configure command in the unpacked directory.
$ ./configure
checking build system type... x86_64-apple-darwin21.2.0
checking ARCH... mac686
checking setting AR... ... ar
checking setting ARFLAGS... ... ruv
checking for gfortran... gfortran
checking whether the Fortran compiler works... no
configure: error: in `/Users/myname/winter/q-e-qe-6.8':
configure: error: Fortran compiler cannot create executables
See `config.log' for more details
I just updated to macOS Monterey and have GNU Fortran (Homebrew GCC 11.2.0_3) 11.2.0 installed.
When trying to debug this, I looked at the config.log file and looked at similar googled questions. They all point me to updating or reinstalling things, like gcc, which I subsequently did.
Does the problem have to do with this:
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin21.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I can see that the version is 4.2.1, but I'm unaware of what Apple clang is. Is it a PATH issue?
I'd appreciate any help.
P.S. Please choose to be kind in responses.
Here is part of the config.log:
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Homebrew GCC 11.2.0_3)
configure:2542: $? = 0
configure:2531: gfortran -V >&5
gfortran: error: unrecognized command-line option '-V'
gfortran: fatal error: no input files
compilation terminated.
configure:2542: $? = 1
configure:2531: gfortran -qversion >&5
gfortran: error: unrecognized command-line option '-qversion'; did you mean '--version'?
gfortran: fatal error: no input files
compilation terminated.
configure:2542: $? = 1
configure:2557: checking whether the Fortran compiler works
configure:2579: gfortran conftest.f >&5
clang: error: invalid version number in '-mmacosx-version-min=12.1'
configure:2583: $? = 1
configure:2621: result: no
configure: failed program was:
| program main
For reference:
$ gfortran --version
GNU Fortran (Homebrew GCC 11.2.0_3) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.```
I had the same issue and I solved by doing the following:
Removing the old tools
($ sudo rm -rf /Library/Developer/CommandLineTools).
Installing xcode command line tools again
($ xcode-select --install).
It was retrieved from:
How to update Xcode from command line

Why doesn't Codelite create a make file?

I'm using Solus Linux with G++ and whenever I build the default console project in CodeLite I get the following output
/bin/sh -c '/usr/bin/make -j4 -e -f Makefile'
/bin/sh: /usr/bin/make: No such file or directory
====0 errors, 0 warnings====
I checked and make does not exist in /usr/bin in-fact, the most promising thing I found in this directory was a file called codelite-make
Here are the options I selected at project creation
Category: Console
Type: Simple executable (g++)
Compiler: GCC
Debugger: GNU gdb debugger
Build System: CodeLite Make Generator
Any help is greatly appreciated
You need to use your package manager for your linux OS to install make and now glibc and possibly other parts of your toolchain. CodeLite does not provide these.

Running Eclipse-CDT on Ubuntu 18.04 causes java.lang.ClassNotFoundException

I am running a Virtual Machine of Ubuntu 18.04 via Oracle VirtualBox.
I need Eclipse (including cdt) for a c++ project. So I ran the following statement on the console:
sudo apt-get install eclipse eclipse-cdt g++
Then I waited until it finished installing. Afterwards, I tried to run Eclipse, which caused the following error:
An error has occurred. See the log file
/home/matthias/.eclipse/org.eclipse.platform_3.8_155965261/configuration/1540208856928.log
So, I checked the log file. It says the following:
!SESSION Mon Oct 22 13:38:43 CEST 2018
----------------------------------------- !ENTRY org.eclipse.equinox.launcher 4 0 2018-10-22 13:38:43.262 !MESSAGE
Exception launching the Eclipse Platform: !STACK
java.lang.ClassNotFoundException:
org.eclipse.core.runtime.adaptor.EclipseStarter at
java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:566)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:626)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584) at
org.eclipse.equinox.launcher.Main.run(Main.java:1438) at
org.eclipse.equinox.launcher.Main.main(Main.java:1414)
Unfortunately, I am an absolute beginner with Ubuntu, as well as c++. I have no idea what could cause this problem. Can anybody help me?
I found that on Ubuntu18.04 this is due to a packaging problem (debugged with the help of a talented coworker). The fix was to manually install files from the older libequinox-osgi-java_3.8.1-8 package, to keep packaging happy.
Locate and get the .deb file
Examine contents of package vs. the system for overlaps
Manually extract deb into '/'
Commands:
$ cd /tmp
$ wget http://archive.ubuntu.com/ubuntu/pool/universe/e/eclipse/libequinox-osgi-java_3.8.1-8_all.deb
$ dpkg -c /tmp/libequinox-osgi-java_3.8.1-8_all.deb
$ dpkg -L libequinox-osgi-java
$ cd /
$ sudo dpkg -x /tmp/libequinox-osgi-java_3.8.1-8_all.deb
Notes:
Here we see commands to show eclipse depends on eclipse-rcp, which depends on libequinox-osgi-java (>= 3.9.1), which are all installed:
$ lsb_release -rc
Release: 18.04
Codename: bionic
$ apt-rdepends eclipse 2>&1 | egrep '^eclipse-rcp|libequinox-osgi-java'
eclipse-rcp
Depends: libequinox-osgi-java (>= 3.9.1)
libequinox-osgi-java
$ dpkg-query -W eclipse eclipse-rcp libequinox-osgi-java
eclipse 3.8.1-11
eclipse-rcp 3.8.1-11
libequinox-osgi-java 3.9.1-1
These commands show that the out-of-the box eclipse stubbornly insists on loading the older osgi_3.8.1.dist.jar despite not being able to stat it or open it:
$ strace -f -e trace=file /usr/lib/eclipse/eclipse -debug -clean -initialize 2>&1 |
egrep '^Framework.located|file:.*osgi_3.*jar|stat.*osgi_3.*jar'
[pid 117096] stat("/usr/lib/eclipse/plugins/org.eclipse.osgi_3.8.1.dist.jar", 0x7f4f0ca95540) = -1 ENOENT (No such file or directory)
[pid 117096] stat("/usr/lib/eclipse/plugins/org.eclipse.osgi_3.8.1.dist.jar", 0x7f4f0ca954c0) = -1 ENOENT (No such file or directory)
[pid 117096] stat("/usr/lib/eclipse/plugins/org.eclipse.osgi_3.8.1.dist.jar", 0x7f4f0ca95550) = -1 ENOENT (No such file or directory)
[pid 117096] stat("/usr/lib/eclipse/plugins/org.eclipse.osgi_3.8.1.dist.jar", 0x7f4f0ca954d0) = -1 ENOENT (No such file or directory)
Framework located:
file:/usr/lib/eclipse/plugins/org.eclipse.osgi_3.8.1.dist.jar
...
The older package just happens to be the same package used in the Ubuntu16.04 eclipse packages. We tried a few different ways to force install both older and newer packages, etc. but this made packaging unhappy and the manual extract Just Worked(tm).

Remote debugging problems

I am trying to remote debug applications on a server in my local network.
Server:
$ uname -a
Linux broatyctl.localdomain 3.6.11.2-rt33.39.el6rt.x86_64 #1 SMP PREEMPT RT Thu Jul 4 06:46:48 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
$ gdbserver --version
GNU gdbserver (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 Free Software Foundation, Inc.
gdbserver is free software, covered by the GNU General Public License.
This gdbserver was configured as "x86_64-redhat-linux-gnu"
Workstation:
$ uname -a
Linux workstation.localdomain 3.12.7-300.fc20.x86_64 #1 SMP Fri Jan 10 15:35:31 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ gdb --version
GNU gdb (GDB) Fedora 7.6.50.20130731-16.fc20
I compiled a "Hello World" app on the workstation and it runs without errors on both workstation and server.
This works on both server and workstation
Shell 1:
$gdbserver localhost:2345 CrossTest
Shell 2:
$ gdb CrossTest
(gdb)target extended-remote localhost:2345
(gdb)run
This does not work
Server:
$ gdbserver workstation.ip.address:2345 CrossTest
Workstation:
$ gdb CrossTest
(gdb)target extended-remote server.ip.address:2345
(gdb)cont
GDB output
(gdb) cont
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0x00007f2a3b247d50 in ?? ()
(gdb)
gdbserver tells me that there is an incomming connection, but it doesn't write my hello world message.
Any ideas?
P.S. I allready posted this question on linuxquestions.org a while ago. I don't think that was the right forum, so I am trying my luck here.
Compiling with -ggdb instead of -g AND using target remote instead of extended-remote did it.

Building boost library

I'm trying to build boost library under Arch Linux
$ uname -a
Linux wincode 2.6.37-ARCH #1 SMP PREEMPT Fri Feb 25 07:53:43 CET 2011 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 5200+ AuthenticAMD GNU/Linux
$ python --version
Python 3.2
$ ls /usr/include/python
python2.7/ python3.2mu/
$ ls /usr/lib/python
python2.6/ python2.7/ python3.1/ python3.2/
I'm building it using aur-repo. The auto-compile script could be found here.
Now I get:
./boost/python/*:50:23: fatal error: pyconfig.h: No such file or directory
compilation terminated.
at almost any file from boost.python library. So something is wrong with python and boost can't find it. At the end of the compiling I got:
...failed updating 336 targets...
...skipped 48 targets...
...updated 13264 targets...
Any help?
Quick google search comes up with http://lists.boost.org/boost-build/2006/04/13457.php.
Basically, add your python include directory to the include search paths.