No such file or directory when running sublime text 3 - nixos

I need some help installing sublime text 3 in Nixos 17.03.
I have downloaded and unpacked the tar ball from sublime and this it was happens when I try to execute /opt/sublime_text/sublime_text:
/opt/sublime_text/sublime_text
sh: /opt/sublime_text/sublime_text: No such file or directory
The file exist in the correct location with run permissions.
sh-4.4$ cd /opt/sublime_text/
sh-4.4$ ls -la
totalt 15944
drwxr-xr-x 4 jan users 4096 23 sep 2016 .
drwxr-xr-x 7 jan users 4096 30 apr 23.28 ..
-rw-r--r-- 1 jan users 30118 23 sep 2016 changelog.txt
-rwxr-xr-x 1 jan users 488672 23 sep 2016 crash_reporter
drwxr-xr-x 7 jan users 4096 23 sep 2016 Icon
drwxr-xr-x 2 jan users 4096 23 sep 2016 Packages
-rwxr-xr-x 1 jan users 7883616 23 sep 2016 plugin_host
-rw-r--r-- 1 jan users 2624408 23 sep 2016 python3.3.zip
-rw-r--r-- 1 jan users 28578 23 sep 2016 sublime_plugin.py
-rw-r--r-- 1 jan users 37137 23 sep 2016 sublime.py
-rwxr-xr-x 1 jan users 5200392 23 sep 2016 sublime_text
-rw-r--r-- 1 jan users 532 23 sep 2016 sublime_text.desktop

Yes, the file does exist there and is executable! But, the error message is misleading.
Try to run file command on that ELF file:
$ file ./sublime_text
./sublime_text: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=e359d67c8f71f88174135aefc069239f64f26c42, stripped
You see, it refers to /lib/ld-linux.so.2 interpreter library, which doesn't exist on NixOS.
Though sublimetext3 is packaged in Nixpkgs, and we can see that it refers to another interpreter:
$ file /nix/store/bv5j4qiif1h9db6qcfl9axhv7rvza2b8-sublimetext3-3114-bin/.sublime_text-wrapped
/nix/store/bv5j4qiif1h9db6qcfl9axhv7rvza2b8-sublimetext3-3114-bin/.sublime_text-wrapped: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /nix/store/jm1n87rp8vr90j9ahcrfzr57nc2r8vgf-glibc-2.24/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=93b181f0f699bd88a052048070efe8ad6757a6fd, stripped
This is achieved by running patchelf on the binary, which is a common trick in Nixpkgs/NixOS to fix binaries.

Related

Why some binaries are duplicated in the Linux filesystem?

Good Morning,
There are some commands that are both in /bin and in /usr/bin in our Yocto filesystem.
Is that normal? I don't think it's a mistake we made in building our Yocto filesystem because I see the same thing in my regular Debian Buster distribution (see below). But what is the purpose of that duplication?
Here is an example of what I'm talking about:
root#debian:~# ls -l /bin/zip* /usr/bin/zip*
-rwxr-xr-x 1 root root 213136 Aug 16 2015 /bin/zip
-rwxr-xr-x 1 root root 90432 Aug 16 2015 /bin/zipcloak
-rwxr-xr-x 1 root root 48497 Jul 21 2020 /bin/zipdetails
-rwxr-xr-x 1 root root 2953 Jan 10 16:12 /bin/zipgrep
-rwxr-xr-x 2 root root 183136 Jan 10 16:12 /bin/zipinfo
-rwxr-xr-x 1 root root 86048 Aug 16 2015 /bin/zipnote
-rwxr-xr-x 1 root root 86048 Aug 16 2015 /bin/zipsplit
-rwxr-xr-x 1 root root 213136 Aug 16 2015 /usr/bin/zip
-rwxr-xr-x 1 root root 90432 Aug 16 2015 /usr/bin/zipcloak
-rwxr-xr-x 1 root root 48497 Jul 21 2020 /usr/bin/zipdetails
-rwxr-xr-x 1 root root 2953 Jan 10 16:12 /usr/bin/zipgrep
-rwxr-xr-x 2 root root 183136 Jan 10 16:12 /usr/bin/zipinfo
-rwxr-xr-x 1 root root 86048 Aug 16 2015 /usr/bin/zipnote
-rwxr-xr-x 1 root root 86048 Aug 16 2015 /usr/bin/zipsplit
Thanks for your reading.
some of those binary does some special functions and purpose other than the main program.
just take a look at the grep program
original 'grep'
extended ones are - egrep, bgrep, pgrep, fgrep.
they all do the same thing but gives the user more flexibility and ease of usage

configure: error: --with-ssl was given, but OpenSSL wasn't found on ubuntu 20.04?

I have try to compile and build libcurl inside my toolcahin folder by using cross compile but always I got same error...
1-First I build openssl by this steps
export TOOLCHAIN=/home/MY/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi
export CC=$TOOLCHAIN/bin/arm-linux-gnueabi-gcc-7.5.0
export RANLIB=$TOOLCHAIN/bin/arm-linux-gnueabi-ranlib
export PATH="$TOOLCHAIN/bin:$PATH"
./Configure linux-generic32 --prefix=$TOOLCHAIN/arm-linux-gnueabi/libc/usr no-async
make depends
make
make install
.
.
.
cp libcrypto.pc /home/MY/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/arm-linux-gnueabi/sysroot/usr/lib/pkgconfig
chmod 644 /home/MY/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/arm-linux-gnueabi/sysroot/usr/lib/pkgconfig/libcrypto.pc
cp libssl.pc /home/MY/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/arm-linux-gnueabi/sysroot/usr/lib/pkgconfig
chmod 644 /home/MY/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/arm-linux-gnueabi/sysroot/usr/lib/pkgconfig/libssl.pc
cp openssl.pc /home/MY/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/arm-linux-gnueabi/sysroot/usr/lib/pkgconfig
chmod 644 /home/MY/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/arm-linux-gnueabi/sysroot/usr/lib/pkgconfig/openssl.pc
.
.
.
~/$ ls -n from gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi
total 36
drwxr-xr-x 6 raed raed 4096 نوف 26 12:31 arm-linux-gnueabi
drwxr-xr-x 2 raed raed 4096 ديس 4 2019 bin
-rw-r--r-- 1 raed raed 11287 ديس 4 2019 gcc-linaro-7.5.0-2019.12-linux-manifest.txt
drwxr-xr-x 3 raed raed 4096 ديس 4 2019 include
drwxr-xr-x 3 raed raed 4096 ديس 4 2019 lib
drwxr-xr-x 3 raed raed 4096 ديس 4 2019 libexec
drwxr-xr-x 8 raed raed 4096 ديس 4 2019 share
~/$ ls -n from arm-linux-gnueabi/libc/usr
total 28
drwxr-xr-x 2 raed raed 4096 نوف 26 12:18 bin
drwxr-xr-x 34 raed raed 4096 نوف 26 12:18 include
drwxr-xr-x 6 raed raed 4096 نوف 26 12:18 lib
drwxr-xr-x 3 raed raed 4096 ديس 4 2019 libexec
drwxr-xr-x 2 raed raed 4096 ديس 4 2019 sbin
drwxr-xr-x 5 raed raed 4096 ديس 4 2019 share
drwxrwxr-x 6 raed raed 4096 نوف 26 12:18 ssl
2-Then I have try to build libcurl with--ssl but I have got error
cd curl-7.72.0
export TOOLCHAIN=/home/MY/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi
export CC=$TOOLCHAIN/bin/arm-linux-gnueabi-gcc-7.5.0
export RANLIB=$TOOLCHAIN/bin/arm-linux-gnueabi-ranlib
export PATH="$TOOLCHAIN/bin:$PATH"
./configure --with-ssl=/home/MY/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/arm-linux-gnueabi/libc/usr --host=arm-linux-gnueabi
.
.
.
configure: PKG_CONFIG_LIBDIR will be set to "/home/MY/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/arm-linux-gnueabi/libc/usr/lib/pkgconfig"
checking for arm-linux-gnueabi-pkg-config... /usr/bin/pkg-config
checking for openssl options with pkg-config... found
configure: pkg-config: SSL_LIBS: "-lssl -lcrypto"
configure: pkg-config: SSL_LDFLAGS: "-L/home/MY/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/arm-linux-gnueabi/libc/usr/lib"
configure: pkg-config: SSL_CPPFLAGS: "-I/home/MY/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/arm-linux-gnueabi/libc/usr/include"
checking for HMAC_Update in -lcrypto... no
checking for HMAC_Init_ex in -lcrypto... no
checking OpenSSL linking with -ldl... no
checking OpenSSL linking with -ldl and -lpthread... no
configure: OPT_SSL: /home/MY/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabi/arm-linux-gnueabi/libc/usr
configure: OPENSSL_ENABLED:
configure: error: --with-ssl was given but OpenSSL could not be detected
P.s: same steps work just fine on ubuntu 18.04
There are a lot of different ways to build libcurl with openssl support, and this may not be immediate to find out what is causing this issue.
But here is the procedure I am using on Ubuntu 20.04.1 - You may have to adjust the content of the CROSS_COMPILE variable, since you are using the arm-linux-gnueabi toolchain, and not the arm-none-linux-gnueabihf one: I am using the gcc toolchain for Cortex-A from ARM.
The versions of curl and openssl may have to be adjusted as well.
CROSS_COMPILE=/opt/arm/9/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-
PREFIX=$(pwd)/sysroot
wget https://www.openssl.org/source/openssl-1.1.1h.tar.gz
tar zxf openssl-1.1.1h.tar.gz
pushd openssl-1.1.1h
./Configure linux-generic32 shared -DL_ENDIAN --prefix=${PREFIX} --openssldir=${PREFIX} shared
make CROSS_COMPILE=/opt/arm/9/gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf- PROCESSOR=ARM install
popd
wget https://zlib.net/zlib-1.2.11.tar.gz
tar xvf zlib-1.2.11.tar.gz
pushd zlib-1.2.11
CC=${CROSS_COMPILE}gcc ./configure --prefix=${PREFIX}
make CC=${CROSS_COMPILE}gcc all install
popd
wget https://curl.haxx.se/download/curl-7.73.0.tar.gz
tar zxf curl-7.73.0.tar.gz
pushd curl-7.73.0
CC=${CROSS_COMPILE}gcc LD=${CROSS_COMPILE}ld AR=${CROSS_COMPILE}ar NM=${CROSS_COMPILE}nm AS=${CROSS_COMPILE}as ./configure --disable-static --enable-shared --with-ssl=${PREFIX} --prefix=${PREFIX} --host=arm-none-linux-gnueabihf --target=arm-none-linux-gnueabihf --without-libidn2
make CC=${CROSS_COMPILE}gcc LD=${CROSS_COMPILE}ld AR=${CROSS_COMPILE}ar NM=${CROSS_COMPILE}nm AS=${CROSS_COMPILE}as install
popd
ll -gG sysroot/lib/
total 6796
drwxrwxr-x 4 4096 Nov 16 08:10 ./
drwxrwxr-x 9 4096 Nov 16 07:53 ../
drwxrwxr-x 2 4096 Nov 16 07:53 engines-1.1/
-rw-r--r-- 1 3199974 Nov 16 07:53 libcrypto.a
lrwxrwxrwx 1 16 Nov 16 07:53 libcrypto.so -> libcrypto.so.1.1*
-rwxr-xr-x 1 2087864 Nov 26 07:53 libcrypto.so.1.1*
-rwxr-xr-x 1 1027 Nov 26 08:10 libcurl.la*
lrwxrwxrwx 1 16 Nov 26 08:10 libcurl.so -> libcurl.so.4.7.0*
lrwxrwxrwx 1 16 Nov 26 08:10 libcurl.so.4 -> libcurl.so.4.7.0*
-rwxr-xr-x 1 407748 Nov 26 08:10 libcurl.so.4.7.0*
-rw-r--r-- 1 578076 Nov 26 07:53 libssl.a
lrwxrwxrwx 1 13 Nov 26 07:53 libssl.so -> libssl.so.1.1*
-rwxr-xr-x 1 453684 Nov 26 07:53 libssl.so.1.1*
-rw-r--r-- 1 96210 Nov 26 07:51 libz.a
lrwxrwxrwx 1 14 Nov 26 07:51 libz.so -> libz.so.1.2.11*
lrwxrwxrwx 1 14 Nov 26 07:51 libz.so.1 -> libz.so.1.2.11*
-rwxr-xr-x 1 98708 Nov 26 07:51 libz.so.1.2.11*
drwxrwxr-x 2 4096 Nov 26 08:10 pkgconfig/
file sysroot/bin/curl
sysroot/bin/curl: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, with debug_info, not stripped
share edit delete flag
Thank you ..
I solve the issue ...
The problem is with zlib need to build it inside toolchain and add this in configure seetings
--with-zlib=$prefix/lib

Installation Of Cassandra

I have download cassandra via terminal but problem is where are the other folders like data, conf, lib, doc etc.
i can see only some files as shown in figure i.e Click here
where is the other folders ?
By "download cassandra via terminal" and your screenshot, I'll assume that you installed Cassandra via apt-get.
From the Apache Cassandra project Wiki, section on Installation from Debian packages:
The default location of configuration files is /etc/cassandra.
The default location of log and data directories is /var/log/cassandra/ and /var/lib/cassandra.
As for the lib directory, check how your $CASSANDRA_HOME is being set:
$ grep CASSANDRA_HOME /etc/init.d/cassandra
CASSANDRA_HOME=/usr/share/cassandra
$ ls -al /usr/share/cassandra/
total 8312
drwxr-xr-x 3 root root 4096 Dec 13 07:57 .
drwxr-xr-x 372 root root 12288 Nov 28 08:51 ..
-rw-r--r-- 1 root root 5962385 Jun 1 2016 apache-cassandra-3.6.jar
lrwxrwxrwx 1 root root 24 Jun 1 2016 apache-cassandra.jar -> apache-cassandra-3.6.jar
-rw-r--r-- 1 root root 1902216 Jun 1 2016 apache-cassandra-thrift-3.6.jar
-rw-r--r-- 1 root root 875 May 31 2016 cassandra.in.sh
drwxr-xr-x 3 root root 12288 Dec 13 07:57 lib
-rw-r----- 1 root root 82123 Oct 20 2015 metrics-core-2.2.0.jar
-rw-r----- 1 root root 9639 Oct 20 2015 metrics-graphite-2.2.0.jar
-rw-r--r-- 1 root root 509144 Jun 1 2016 stress.jar
Note that Cassandra's lib directory is shown in the middle of the directory listing above.

Apache Ant BINARY download is missing a BINARY file?

Failing to simply copy a binary to linux machine. Wow! I feel stupid today! Below is the list of files in the binary package's tar.gz, as downloaded from default mirror and utah.edu:
-rwxr-xr-x 1 ec2-user ec2-user 10321 Apr 9 2016 ant
-rw-r--r-- 1 ec2-user ec2-user 7472 Apr 9 2016 ant.bat
-rw-r--r-- 1 ec2-user ec2-user 2857 Apr 9 2016 ant.cmd
-rw-r--r-- 1 ec2-user ec2-user 3410 Apr 9 2016 antenv.cmd
-rwxr-xr-x 1 ec2-user ec2-user 861 Apr 9 2016 antRun
-rw-r--r-- 1 ec2-user ec2-user 1536 Apr 9 2016 antRun.bat
-rwxr-xr-x 1 ec2-user ec2-user 2116 Apr 9 2016 antRun.pl
-rwxr-xr-x 1 ec2-user ec2-user 3473 Apr 9 2016 complete-ant-cmd.pl
-rw-r--r-- 1 ec2-user ec2-user 4315 Apr 9 2016 envset.cmd
-rw-r--r-- 1 ec2-user ec2-user 1116 Apr 9 2016 lcp.bat
-rwxr-xr-x 1 ec2-user ec2-user 4333 Apr 9 2016 runant.pl
-rwxr-xr-x 1 ec2-user ec2-user 3385 Apr 9 2016 runant.py
-rw-r--r-- 1 ec2-user ec2-user 1817 Apr 9 2016 runrc.cmd
Am I missing something? All I see is a DIRECTORY named "ant". Obviously this won't run as expected by supremely simple "INSTALL" instructions (primarily written for benefit of Windows users, summarized):
"-Add the bin directory to your path.
-Set the ANT_HOME environment variable
-You can check the basic installation with opening a new shell and typing ant."
If I need to run one of these files to "Install" the binary maybe the instructions could mention it. As it is this looks to me like (again) like developers high on 'dozes forgetting about the other OS.
I see a shell script called ant not a directory. OK, less flippant. The binary distribution contains a the shell script and a bunch of binary jars. You actually do add the bin folder to your PATH and runant. "install" means, extract the tarball wherever you want and set up the environment.
– Stefan Bodewig

How can you determine installed versions of the glibc libraries?

I'm working with an embedded Linux deployment and am using a cross compiler tool chain that doesn't compile I2C library function calls.
How do I determine the precise versions of the libraries on the system so that I may rebuild the tool chain?
I don't intend to replace the libraries deployed, as I do know they work (including I2C), so I believe I need the following:
Binutils version
GCC version
GLIBC
Kernel (for the headers)
I think I can assume from the following that the binutils library is version 2.2.5. The kernel is modded for which I've the source.
root#dev-box />ls /lib/ -al
drwxrwxrwx 3 root root 1024 Apr 27 09:44 .
drwxrwxrwx 14 root root 1024 Jan 1 1970 ..
-rwxrwxrwx 1 root root 105379 Jan 1 1970 ld-2.2.5.so
lrwxrwxrwx 1 root root 16 Jan 1 1970 ld-linux.so.2 -> /lib/ld-2.2.5.so
lrwxrwxrwx 1 root root 16 Jan 1 1970 ld.so.1 -> /lib/ld-2.2.5.so
-rwxrwxrwx 1 root root 1288601 Jan 1 1970 libc.so.6
-rwxrwxrwx 1 root root 25441 Jan 1 1970 libcrypt.so.1
-rwxrwxrwx 1 root root 14303 Jan 1 1970 libdl.so.2
-rwxrwxrwx 1 root root 36800 Jan 1 1970 libgcc_s.so.1
-rwxrwxrwx 1 root root 530401 Jan 1 1970 libm.so.6
-rwxrwxrwx 1 root root 86626 Jan 1 1970 libnsl.so.1
-rwxrwxrwx 1 root root 17533 Jan 1 1970 libnss_dns.so.2
-rwxrwxrwx 1 root root 46324 Jan 1 1970 libnss_files.so.2
-rwxrwxrwx 1 root root 98633 Jan 1 1970 libpthread.so.0
-rwxrwxrwx 1 root root 69966 Jan 1 1970 libresolv.so.2
-rwxrwxrwx 1 root root 12897 Jan 1 1970 libutil.so.1
For glibc:
/lib/libc.so.6
Sounds maybe strange to run a so file but should print out version information in this case
For the kernel version use uname
For the binutils parsing the output of ld --versionmight yield what you expect, the same for gcc --version. This is a bit tedious but I do not know another way.
a more comprehensive answer can be found by running
find /lib -iname 'libc*.so'
On a recent system this will give you results like this that show i'm using glibc 2.28 here on ubuntu 18.10
/lib/x86_64-linux-gnu/libc-2.28.so
/lib/x86_64-linux-gnu/libcrypt-2.28.so
/lib/i386-linux-gnu/libc-2.28.so
/lib/i386-linux-gnu/libcrypt-2.28.so
For multiarch system you can have multiple copies for 386 and 64 modes , i think these should be the same .
i didn't have a /lib/libc.so.* on my system.
To know the current installed version of glibc, please compile and run the following C code.
#include <stdio.h>
#include <gnu/libc-version.h>
int main (void) { puts (gnu_get_libc_version ()); return 0; }
Cheers !!!

Resources