"ldconfig -i -m /path/to/dir" with rc.conf

I do not like to continously do ldconfig -i -m /path/to/dir or setenv LD_LIBRARY_PATH /path/to/dir.

How I do it modifying /etc/rc.conf?

In /etc/defaults/rc.conf I read:

Code:
ldconfig_insecure="NO"  # Set to YES to disable ldconfig security checks
ldconfig_paths="/usr/lib/compat /usr/local/lib /usr/local/lib/compat/pkg"
                        # shared library search paths

Should I add to rc.conf these lines, substituting "NO" with "YES" in the first and adding /path/to/dir to the second?

Thanks
Rodrigo
 
ShelLuser, in the man page of ldconfig is described, for what one needs this command or this environment variable.

For example, when you put in /path/to/dir the file libfoo.so generated with something like:

Code:
# gcc -c -fpic foo.c
# ld -shared -o libfoo.so foo.o
 
Last edited:
This sounds like an XY problem. You are trying to get help on how to do one small step. Which is very difficult to do, unless we understand what you are really trying to accomplish, the big picture, how that small step fits onto the overall flow.

So you have figured out how to make a shareable library, with the gcc and ld command above. You could use that for a specific executable that uses this particular library using the setenv... method you describe above. Why do you want to use this library for everything, for all executables on the system? Do you really want to modify the behavior of common programs like ls or cat? If you really want to use it for everything, then why don't you install it in /usr/local/lib, and then read the file /etc/rc.d/ldconfig to see how those are used by default? Please give us some background, then we can try to help.
 
Another example: to install well known shared libs programmed by ralphbsz in an unusual place and as a normal user, too put it for anyone in the system.

No, sure not difficult to do. I was just asking how something is usually done in FreeBSD what I continuously do in OpenBSD. It is a very concrete and simple question.
 
Back
Top