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



## hruodr (Jan 20, 2019)

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:


```
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 (Jan 20, 2019)

Why do you think you need these modifications in the first place?


----------



## hruodr (Jan 20, 2019)

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:


```
# gcc -c -fpic foo.c
# ld -shared -o libfoo.so foo.o
```


----------



## ralphbsz (Jan 22, 2019)

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.


----------



## hruodr (Jan 22, 2019)

*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.


----------

