Missing source codes in kernel-devel on CentOS8 - linux

Installed kernel-devel with yum on CentOS, Why missing some source codes in some sub-directories (such as fs/fuse) ?
$ uname -r
4.18.0-348.el8.x86_64
$ ls /usr/src/kernels/4.18.0-348.2.1.el8_5.x86_64/fs/fuse/
Kconfig Makefile
$ uname -r
4.18.0-348.el8.x86_64
$ ls /usr/src/kernels/4.18.0-348.2.1.el8_5.x86_64/fs/fuse/
Kconfig Makefile
It is expected as here: https://github.com/torvalds/linux/tree/v4.18/fs/fuse
Kconfig
Makefile
acl.c
control.c
cuse.c
dev.c
dir.c
file.c
fuse_i.h
inode.c
xattr.c

Related

error while loading shared libraries: libPocoNet.so.60: cannot open shared object file: No such file or directory

The below command returns
sudo find / -name libPocoNet.so
/home/sandeep/server2/poco/cmake-build/lib/libPocoNet.so
/home/sandeep/server/cmake_build/lib/libPocoNet.so
/home/sandeep/server/poco/cmake_build/lib/libPocoNet.so
/home/sandeep/server/poco/lib/Linux/x86_64/libPocoNet.so
/usr/local/lib/libPocoNet.so
to compile code I am using
g++ poco.cpp -lPocoNet
while execution
I am getting the error
error while loading shared libraries: libPocoNet.so.60: cannot open shared object file: No such file or directory
how I built the source
$ git clone -b master https://github.com/pocoproject/poco.git
$ cd poco
$ mkdir cmake-build
$ cd cmake-build
$ cmake .. && cmake --build .
$ sudo cmake --build . --target install
$ cd ..
$ ./configure
$ make -s -j4
$ cd cmake-build
$ make -s -j4
$ cd ..
$ sudo make install
$ cd cmake-build
$ sudo make install
-----------solved using-------------------
sandeep#sandeep:~$ LD_LIBRARY_PATH=/usr/local/lib
sandeep#sandeep:~$ export LD_LIBRARY_PATH
sandeep#sandeep:~$ g++ poco.cpp -lPocoNet
sandeep#sandeep:~$ ./a.out
I moved all Poco libraries from /usr/local/lib to /usr/lib/, it worked for me.
if all necessary libs added to your CMakeList.txt just run the below line and run a.out app.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

I have gcc installed in /usr/local/bin why linux can't find it

I have gcc installed in /usr/local/bin
[root#iz2 usr]# ls /usr/local/bin | grep gcc
gcc
gcc-ar
gcc-nm
gcc-ranlib
x86_64-pc-linux-gnu-gcc
x86_64-pc-linux-gnu-gcc-7.3.0
x86_64-pc-linux-gnu-gcc-ar
x86_64-pc-linux-gnu-gcc-nm
x86_64-pc-linux-gnu-gcc-ranlib
And there is no gcc in /usr/bin
[root#iz2 usr]# ls /usr/bin | grep gcc
[root#iz2 usr]#
My $PATH like this
[root#iz2 usr]# $PATH
-bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin: No such file or directory
when I run commond gcc --version, my linux can't find it, why?
[root#iz2 usr]# gcc --version
-bash: /usr/bin/gcc: No such file or directory
why linux just search /usr/bin directory and ignore the /usr/local/bin directory which has gcc?
It looks like you have not restarted your bash shell since deinstalling /usr/bin/gcc and installing /usr/local/bin/gcc, so it still has an outdated command cache. You can flush the cache using hash -r, or you can just log out and log in again.

Unable to build openssl-1.0.2n on LinuxMint

I am trying to update my OpenVPN and OpenSSL.
While updating openvpn to openvpn-2.4.4, I was required to update my openssl first to the latest openssl-1.0.2n
$ cd~
$ wget https://openvpn.net/index.php/download/openvpn-2.4.4.tar.gz
$ sudo tar -zvxf openvpn--2.4.4.tar.gz
$ cd openvpn-2.4.4
$ sudo ./configure
$ sudo make
$ sudo make install
But when I reach ./configure above, I run into an issue with legacy openssl as I have mentioned earlier (i thought an update would fix that):
checking tap-windows.h presence... no
checking for tap-windows.h... no
checking whether TUNSETPERSIST is declared... yes
checking for setcon in -lselinux... no
checking for pam_start in -lpam... no
checking for PKCS11_HELPER... no
checking for OPENSSL... no
checking for SSL_CTX_new... no
configure: error: openssl check failed
So I tried the following commands to update to the latest openssl :
$ cd /usr/src
$ wget https://www.openssl.org/source/openssl-1.0.2n.tar.gz -O openssl-1.0.2n.tar.gz
$ tar -zxf openssl-1.0.2n.tar.gz
$ cd openssl-1.0.2n
$ ./config
$ sudo make
$ sudo make test
$ sudo make install
$ mv /usr/bin/openssl /root/
$ ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
$ openssl version
When I get to make test, I run into a compilation error. I have copy pasted my terminal output here because that output is HUGE, error is in the bottom : pastebin
Any suggestions how I can move past this issue?
RELEASE=18 sarah, EDITION=Cinnamon 32-bit, GRUB_TITLE=Linux Mint 18 Cinnamon 32-bit
Judging from your output, you need to run all three commands as sudo, and you missed the initial make.
elliot#warmachine /usr/src/openssl-1.0.2n $ sudo ./config
...
elliot#warmachine /usr/src/openssl-1.0.2n $ make
...
/bin/sh: 1: cannot create buildinf.h: Permission denied
Makefile:58: recipe for target 'buildinf.h' failed
which fails as it does not have permissions to write to the directory, which causes sudo make test to fail because openssl hasn't been built:
/usr/bin/ld: cannot find -lssl
collect2: error: ld returned 1 exit status
-l{library_name} is what ld uses to link in external libraries, meaning test cannot find the openssl .so that should have been built in previous steps
Lastly, it is bad practice to build software as root. My recommendation is to build it as an unprivileged user, then install as root.
$ cd ~
$ wget https://www.openssl.org/source/openssl-1.0.2n.tar.gz -O openssl-1.0.2n.tar.gz
$ tar -zxf openssl-1.0.2n.tar.gz
$ cd openssl-1.0.2n
$ ./config
$ make
$ make test
$ sudo make install

Bash: No such file or directory?

I try to use an executable script (wkhtmltopdf) on a Linux shared webserver (Debian, 64bit). I am pretty sure that I compiled everything correct, but whenever I want to execute the file I get as an response :
> ./wkhtmltopdf -H
-bash: ./wkhtmltopdf: No such file or directory
To be sure that the file is there, here the ls output :
> ls
wkhtmltoimage wkhtmltopdf
Furthermore I tested the file command on it, which outputs the following :
> file wkhtmltopdf
wkhtmltopdf: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
My question is now :
Why does bash tells me that there is no 'file or directory', when there obviously is one?
My first guess would be that the shared server does not allow to execute binary files? But shouldn't it then be a problem of permissions, with a different bash output?
Edit :
> id
uid=2725674(p8907906) gid=600(ftpusers) groups=600(ftpusers)
> ls -l wkhtmltopdf
-rwxrwxrwx 1 p8907906 ftpusers 39745960 Jan 20 09:33 wkhtmltopdf
> ls -ld
drwx---r-x 2 p8907906 ftpusers 44 Jan 28 21:02 .
I bet you miss dynamic linker. Just do a
readelf --all ./wkhtmltopdf | grep interpreter
You should get an output like this:
[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
There are high chances that you system lacks the interpreter (/lib64/ld-linux-x86-64.so.2 in the example). In this case bash would yell No such file or directory, just like when the binary itself is missing.
You can try to use a different linker. Sometime you can succeed. Just do a:
/path/to/the/linker /path/to/your/executable
This command:
find /lib* -name ld-linux\*
will help you find the linkers on your system. Or you can do the readelf command on some command that does run. It will show you correct, working linker.
OR, since you are running Debian system, just do a
sudo apt-get install wkhtmltopdf
to install native version of the tool :)
In my case
$ readelf --all ./wkhtmltopdf | grep interpreter # readelf: Displays information about ELF files.
[Requesting program interpreter: /lib/ld-linux.so.2]
On a machine where the executable was working:
$ ls -lah /lib/ld-linux.so.2
lrwxrwxrwx 1 root root 25 Apr 16 2018 /lib/ld-linux.so.2 -> i386-linux-gnu/ld-2.27.so
$ dpkg -S /lib/ld-linux.so.2 # -S, --search filename-search-pattern: Search for a filename from installed packages.
libc6:i386: /lib/ld-linux.so.2
So to fix the problem (reference)
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install libc6:i386 # GNU C Library: Shared libraries (from apt show)
Missing the linker was my case as well. I could fix it with the help of nsilent22 answer like this:
readelf --all /usr/local/myprogram | grep interpreter
[Requesting program interpreter: /lib64/ld-lsb-x86-64.so.3]
But that linker did not exist anymore.
The old situation in /lib64 was:
ld-linux-x86-64.so.2 -> /lib/x86_64-linux-gnu/ld-2.31.so
ld-linux-x86-64.so.3 -> ld-linux-x86-64.so.2
So it turned out this was just a symlink to the systems' linker.
Moving over to /lib64 , which itself is a symlink to usr/lib64 and creating a symlink over there did not work. I assume that there are to many symbolic link levels after Debian moved everything into /usr
However creating a 'direct' symlink
ln -s /usr/lib64/ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.3
did the job; /usr/lib64 now shows:
ld-linux-x86-64.so.2 -> /lib/x86_64-linux-gnu/ld-2.31.so
ld-lsb-x86-64.so.3 -> /usr/lib64/ld-linux-x86-64.so.2
I ran into this issue on my raspberry pi 4 running aarch64 alpine 3.13. Using the answer provided by #vkersten, I was able to determine that I was missing /lib/ld-linux-aarch64.so.1.
I resolved this by installing gcompat with apk add gcompat.

Where can I get the files to install f2c on redhat linux?

I am looking for an rpm or simple install instructions for getting f2c to work on my redhat linux os. I am new to linux and it is difficult finding something like this on google.
(The goal is to use f2c to convert a simple fortran77 file to c, then compile)
Does anybody have any suggestions?
Getting the source with rsync (recommended):
$ rsync -avz netlib.org::netlib/f2c/src f2c
Getting the sources via FTP:
$ mkdir -p f2c/src
$ cd f2c/src
$ ftp ftp.netlib.org
ftp> cd f2c
ftp> prompt
ftp> mget *
To build the sources, in the f2c/src directory do:
$ make -f makefile.u
To install the binary, copy it to a directory in your $PATH:
$ mkdir -p /usr/local/bin /usr/local/man/man1
$ cp f2c /usr/local/bin
$ cp f2c.1t /usr/local/man/man1
To compile Fortran programs you will also need libf2c:
$ mkdir libf2c
$ cd libf2c
$ unzip ../libf2c.zip
$ make -f makefile.u
$ make -f makefile.u install LIBDIR=/usr/local/lib
libf2c is a combination of the libF77 and libI77 libraries. You can install these libraries separately and then link with "-lF77 -lI77". Assuming f2c/src is available from the current directory, save libF77 and libI77 and do the following (not necessary if you have already installed libf2c above):
$ sh libf77
$ sh libi77
$ cd libF77
$ make CFLAGS=-I../f2c/src
$ make install LIBDIR=/usr/local/lib
$ cd ../libI77
$ make CFLAGS=-I../f2c/src
$ make install LIBDIR=/usr/local/lib
The fc shell script is a nice frontend to use with f2c. Save it somewhere and do:
$ cp fc /usr/local/bin/f77
$ chmod 755 /usr/local/bin/f77
I renamed it to f77 to avoid conflicts, since fc is a bash builtin. The fc script expects libf2c rather than libF77 and libI77, so you have to edit it and replace "-lf2c" with "-lF77 -lI77" if you have installed these libraries instead of libf2c above.
Finally, to compile your program you can do:
$ f77 source.f -o binary
Also check out the f2c parent directory. It contains getopt.c, f2c.pdf and some other stuff that may be useful.
For more further information about f2c consult the readme (less f2c/src/readme) and the manpage (man f2c). For further information about the fc script look at the comments at the beginning of the file.
You can get a precompiled f2c package from ATrpms: http://atrpms.net/name/f2c/
It does include both the headers (such as f2c.h) and the library (libf2c) in standard directories, so you shouldn't have any trouble compiling after that.
Otherwise, you could try to compile directly with a free Fortran compiler; try gfortran. If not installed, it's in package gcc-gfortran, so you can install it with the command: yum install gcc-gfortran.

Resources