First, I will answer the second part of your question: why renaming libre2.so.0 did not fulfill what you expected.
The name of the file that you pass to the linker does not matter when you run the executable file (if you do not provide -soname when creating the library - see the second edit below). Dependence is taken from what is called a “sonaim." If you run the readelf command in your library, you can define its name, for example.
readelf -d libre2.so.0 | grep SONAME
It doesn't matter if you rename the file. The result of the above command will still give you the same name, so the reason the program still could not find "libre2.so.0".
As for the original part of your question, it all depends on whether the libraries for them are RPATH or RUNPATH and / or the contents of your environment variable LD_LIBRARY_PATH . This is what the runtime linker (ld.so) uses to search for shared libraries. Try
man ld.so
for more information.
Since you yourself created the libraries, you will find out if they used the -rpath or -runpath during the final -runpath phase. Alternatively, use readelf again, for example.
readelf -d libre2.so.0 | grep RPATH readelf -d libre2.so.0 | grep RUNPATH
I suspect that these two teams will not return anything.
I assume that you have the current directory in LD_LIBRARY_PATH , which will allow the linker to find lib / libjson_linux-gcc-4.4.6_libmt.so at run time, but not libre2.so.0. I notice that you answered my comment on your question to say that your LD_LIBRARY_PATH empty. This is strange.
Did you somehow get the prefix "lib /" in soname for libjson? i.e. readelf command to return soname
lib/libjson_linux-gcc-4.4.6_libmt.so
not just
libjson_linux-gcc-4.4.6_libmt.so
Also, check what the program requires in terms of soname by running
readelf -d my_progam | grep NEEDED
Perhaps the prefix "lib /" is there because you passed it to gcc. If so, then if you use the gcc command given by @enobayram, then it will align the playing field, that is, it will also not be able to find libjson.
The first thing to install is not why it does not find libre2.so.0, but how it can find libjson. If you try to run the executable from another directory, is it still working or is it now not working for libjson? Alternatively, if you copy libre2.so.0 while next to your executable, will this change anything?
Edit
A post on the Fedora forum suggests that the version of ld.so for Fedora has the current directory as its built-in search path. I could not verify this, but that would explain why you are building any libraries at all, given that all other things used by ld.so are missing in your case.
Edit 2
On the ld man page on my system
-soname = name
When creating a shared ELF object, set the internal field DT_SONAME to the specified name. When an executable file is associated with a shared object that has a DT_SONAME field, then when the executable file is executed, the dynamic linker will try to load the shared object specified in the DT_SONAME field, rather than using the file name specified in the linker.
Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009. Free Software Foundation, Inc.
You may copy, distribute, and / or modify this document in accordance with the terms of the GNU Free Documentation License, version 1.3 or any later version published by the Free Software Foundation; without Invariant sections, without front cover textures and without back cover Texts. A copy of the license is included in the "GNU Free Documentation License" section.
So the theory in your comment is correct. If -soname is not explicitly specified when creating the library, then -soname does not exist in the shared object, and the NEEDED field in the executable file simply has the file name provided to the linker, which in your case contains the leading "lib /",.