When running ldd command when the path doesnt exist I'm getting 'file not found' instead of path.
bash-3.2$ ldd curl
libcurl.so.4 => /usr/local/lib/libcurl.so.4
libldap.so.5 => /usr/lib/libldap.so.5
librt.so.1 => /lib/librt.so.1
libssl.so.1.0.0 => (file not found)
libcrypto.so.1.0.0 => (file not found)
Is there an option to see which file not found? the full path?
ldd is searching in the library search paths mentioned in /etc/ld.so.conf. Or it might use the environment variable LD_LIBRARY_PATH. As far as I can see, it looks at least in /usr/local/lib, /usr/lib and /lib which is the default on most systems. It fails to find libssl.so.1.0.0 in these three locations. That's why you get the 'file not found' message.
One reason might be you don't have libssl.so.1.0.0 installed. Maybe some other version.
Another reason might be it is installed somewhere else. The application which needs to load the shared library either has that path hardcoded or is using LD_LIBRARY_PATH.
anyways, to answer your question: the full path of libssl.so.1.0.0 cannot be found by ldd, thats why you get the error.
to find it, you have to manually search for it. one simple way would be
find / -ls | grep libssl.so
or better (if you only want your system disk to be searched)
find / -mount -ls | grep libssl.so
which might result in a lot of versions installed in several locations.
Related
Hi all I am trying to install a bash program called objconv which converts object files between different architectures on my macbook air. I have so far followed the instructions but when I successfully install the script file and attempt to the command for the program terminal gives me the error -bash: objconv: command not found I have tried everything I know to fix it but nothing has worked. I also installed homebrew using instructions on a thread on this website. I currently have version 4.3.___ installed. I have my bash directory set to this /usr/local/bin/bash
as per the homebrew instructions stated and I have stated in the top of the build.sh file like: #!/usr/local/bin/bash.
This is the download to the objconv file which as the instructions:
http://www.agner.org/optimize/objconv.zip
Here is the pdf file with the instructions please refer to page 4:
http://www.agner.org/optimize/objconv-instructions.pdf
I don't know the objconv tool, but it seems as though bash simply cannot find it wherever you have installed it. That means your PATH is probably wrong because that tells bash where programs are to be found.
So, first, you need to find objconv, and I am guessing you are unsure where it is. Let's try looking in /usr/local like this
find /usr/local -name objconv -type f
and if that doesn't work, broaden your search to the whole of /usr like this
find /usr -name objconv -type f
and if that doesn't work, try searching your entire Mac, like this, which will be slower
sudo find / -name objconv -type f 2> /dev/null
The outpt of the above search(es) will be like
/usr/local/bin/bash/objconv
which would mean that the objconv program is in the directory /usr/local/bin/bash.
If you now want to run it, you can either type
/usr/local/bin/bash/objconv [something] ... <something>
or, if that is too long-winded, edit your bash profile in $HOME/.profile and change the line that sets the PATH so it looks like:
export PATH=WhereverObjconvLives:$PATH
Then activate the new PATH using:
source $HOME/.profile
I am pretty new in Linux and I have some doubt related to this operation that I have found into a bash script on which I am working:
ldconfig -v >> /dev/null 2>&1
Reading on the man page of the ldconfig command I can read:
ldconfig creates, updates, and removes the necessary links and
cache
(for use by the run-time linker, ld.so) to the most recent shared
libraries found in the directories specified on the command line, in
the file /etc/ld.so.conf, and in the trusted directories (/usr/lib and
/lib).
What exactly mean? I am using Ubuntu system and in /etc/ld.so.conf I found:
include /etc/ld.so.conf.d/*.conf
So I think that this line redirect me to all the .conf files into /etc/ld.so.conf.d/ directory
But I have some confusion...and many doubts:
1) What are contains into the .conf file?
2) what exactly do the command that is in my bash script?
Tnx
Andrea
ldconfig -v >> /dev/null 2>&1 means redirect stdout (standard output) and stderr (standard error) to a special device /dev/null which means no-where (to discard it).
> /dev/null - is redirecting stdout
2 > &1 is redirecting stderr to wherever stdout is redirected at since 1 is file descriptor of stdout and 2 is file descriptor of stderr
About ldconfig: ldconfig man page
As per manual:
ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line
1) What are contains into the .conf file?
ldconfig uses configuration scripts (which can be stacked using the include directive) to know which directories it should search for libraries.
from man ldconfig:
/etc/ld.so.conf File containing a list of colon, space, tab, newline, or
comma-separated directories in which to search for libraries.
2) what exactly do the command that is in my bash script?
it updates the dynamic linker cache. that is: if you are installing shared libraries it will make the newly installed libraries availabled to your system.
(e.g. when installing libfoo.so.2.1 it will create the necessary symlinks to libfoo.so.2)
I wonder if it's possible to find out in some way what was installed after I ran a .run file under Linux? Or maybe there is a tool that scans a .run in order to find out whats inside it?
I need this because I'd like to install the software bundled in this .run with aptitude in order to keep it up to date. But the bundle is just available as a .run file.
Does anyone now how to do the trick?
Well you can do something like
setting up a secure chroot (or virtualmachine) environment (Google for that), and install in that.
do something like
find / > ORIGINAL_STATE -exec ls -lc \{\} \;
./INSTALLER.RUN
find / > AFTER_INSTALL -exec ls -lc \{\} \;
diff ORIGINAL_STATE AFTER_INSTALL
A lot of .run files (or other binary installation files) I have seen are regular scripts with a binary part in them. This means you can open them with a text editor and inspect the first few lines (open with less rather than a gui editor so it doesn't get stuck on the binary part).
There was a situation when somebody moved the whole rootdir into a subdir on a remote system, thus all the system tools like cp, mv, etc didn't work anymore. We had an active session though but couldn't find a way to copy/move the files back using only bash built-ins.
Do somebody know of a way to achieve this?
I even thought about copy the cp or mv binary in the currentdir with
while read -r; do echo $LINE; done
and then redirect this to a file, but it didn't work. Guess because of all the special non printable chars in a binary file that can't be copied/displayed using echo.
thanks.
/newroot/lib/ld-linux.so.2 --library-path /newroot/lib \
/newroot/bin/mv /newroot/* /
(Similar for Solaris, but I think the dynamic linker is named ld.so.1 or something along those lines.)
Or, if your shell is sh-like (not csh-like),
LD_LIBRARY_PATH=/newroot/lib /newroot/bin/mv /newroot/* /
If you have prepared with sash pre-installed, then that is static and has a copy built-in (-cp).
Otherwise LD_LIBRARY_PATH=/copied/to/path/lib /copied/to/path/bin/cp might work?
I think it might have a problem with not having ld-so in the expected place.
Here's a reasonable ghetto replacement for cp. You'll want echo -E if the file ends with a new line (like most text files), echo -nE if it doesn't (like most binaries).
echo -nE "`< in.file`" > out.file
Old thread, but got exactly the same stupid mistake. /lib64 was moved to /lib64.bak remotely and everything stopped working.
This was a x86_64 install, so ephemient's solution was not working:
# /lib64.bak/ld-linux.so.2 --library-path /lib64.bak/ /bin/mv /lib64.bak/ /lib64
/bin/mv: error while loading shared libraries: /bin/mv: wrong ELF class: ELFCLASS64
In that case, a different ld-linux had to be used:
# /lib64.bak/ld-linux-x86-64.so.2 --library-path /lib64.bak/ /bin/mv /lib64.bak/ /lib64
Now the system is salvaged. Thanks ephemient!
/subdir/bin/mv /subdir /
or am I missing something in your explanation?
If you have access to another machine, one solution is to download and compile a Busybox binary. It will be a single binary contains most of the common tools you need to restore your system. This might not work if your system is remote though.
How does one find out what is the lib that the above flag is referring to?
How would I do it for some other one?
The -l option takes the name of the library as the argument so in this case the library would be named libXi.a (or libXi.so or something similar). To find the library look in the standard library locations (/usr/lib, /lib, /usr/local/lib, etc.) available in your distribution. There may also be additional library directories specified using the -L option to the linker.
If your program compiled successfully, or if you have another program which uses -lXi, then you can do:
ldd /path/to/that/program | grep libXi
For example:
$ ldd /usr/X11R6/bin/audacity | grep libXi
libXinerama.so.1 => /usr/lib/libXinerama.so.1 (0x00007f53faaba000)
libXi.so.6 => /usr/lib/libXi.so.6 (0x00007f53f8e2c000)
And that will most likely tell you where that library is. (It's not 100% because the build process could alter the search path but that's usually not likely for standard libraries like X11.)
From there, you can ask your distro which package has that file, if you care. For example on Ubuntu or a .deb-base distro:
$ dpkg --search /usr/lib/libXi.so.6
libxi6: /usr/lib/libXi.so.6
If you can't use LDD, then check your system's /etc/ld.so.conf which will indicate the search path for runtime shared library linking. (/lib/ and /usr/lib are included by default.)
Worst case, you could just find for it:
find / -regex '.*libXi\.\(a\|so\).*' 2> /dev/null
strace -f -e open gcc ... -lXi
Look for libXi in the output.