Ldconfig For Mac

Try it FREE for 30 days! LPub3D LDraw™ editor for LEGO® style digital building instructions. LPub3D is an Open Source WYSIWYG editing application for creating LEGO® style digital building instructions. LPub3D is developed and maintained by Trevor SANDY. How does Mac OS X deal with this issue? Linux uses the cache file '/etc/ld.so.cache' to avoid the redundant search of directories. Linux uses 'ldconfig' to update the cache. How does Mac OS X avoid the inefficient redundant search of directories?

I‘ve compile and installed a library at /usr/local/lib/libapp2.so -> libapp2.so.1.4.3. How do I set the Library path under Linux operating systems?
You need to use ldconfig config file and ldconfig command which creates the necessary links and cache 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 such as /lib64 or /usr/lib64 (/lib or /usr/lib on 32 bit systems). The /etc/ld.so.conf contains lib settings which can be used to add or delete paths. However, you need to simply drop your config file in /etc/ld.so.conf.d/ directory and it will be used by /sbin/ldconfig to configure dynamic linker run time bindings.
Advertisements

Add Your Path

Create a file called /etc/ld.so.conf.d/myapp.conf:
# vi /etc/ld.so.conf.d/myapp.conf
Add the following path:

Save and close the file.

Activate Your Library Path

You must run the following command to activate path:
# ldconfig

Verify Your New Library Path

# ldconfig -v less
OR
# ldconfig -v grep /usr/local/lib
Sample outputs:

How Do I Delete The Library Path?

Simply, delete the file:
# rm /etc/ld.so.conf.d/myapp.conf
# ldconfig

How Do I Edit The Library Path?

Simply edit the file and reload the changes:
# vi /etc/ld.so.conf.d/myapp.conf
# ldconfig

How Do I Compile Program With Shared Libs And GNU GCC?

You can use the following gcc
$ gcc -Wl,-R/path/to/lib -I/path/to/include -L/path/to/lib -o myAppName mycode.c -llibapp2
See gcc man page for further details.

Further readings:

Running coolprop with excel for mac pro. man ldconfig
man ld
man gcc

Datamax dmx 1 4208. ADVERTISEMENTS

Build Yourself

To make sure you have the latest version of OpenZWave we recommend you download and build the source yourself.

Note about -D_GLIBCXX_USE_CXX11_ABI

Starting in g++ 5.1, there has been a change with how some of the linkage symbols work. If you're using a newer compiler, you can use -D_GLIBCXX_USE_CXX11_ABI=0 to get the old behaviour. The addon-builder runs on Travis and uses version 4.8 of g++, so it builds libraries with the old symbols. In order to be compatible, you should build your copy of openzwave using this define as well. The instructions below show how to build with _GLIBCXX_USE_CXX11_ABI=0.

Linux

First you need to install pkg-config.

On Ubuntu:

Then download and build the OpenZWave source code:

I found that this installed libopenzwave.so.1.4 into /usr/local/lib64 which isn't in the default search location for shared libraries. The node-openzwave-shared page recommendation is to put a symlink into /usr/local/lib and that seems reasonable to me. I also had to run ldconfig in order to update the cache.

Mac OS X

Install pkg-config following the instructions here.

Then download and build the OpenZWave source code:

Download a Binary

Alternatively you can try installing a pre-built binary for your operating system.

Linux

The OpenZWave website hosts binaries for various Linux distributions (be sure to install both libopenzwave and libopenzwave-dev).

Mac OS X

On Mac OS X you can try installing OpenZWave using HomeBrew.

Note: Using the Mozilla IoT gateway didn't work with this method the last time we tried it.