Sponsored Content
Operating Systems Solaris Teach me about dynamic libraries Post 302983383 by DerfMan on Monday 10th of October 2016 08:29:06 PM
Old 10-10-2016
Teach me about dynamic libraries

Hi all,
new guy here, first post, with a question.

My background : some linux experience, moved over to OmniOS with Napp-it front end for a home NAS server, but getting more familiar with CLU.

Situation : I built APCUPSD to interface with my UPS. During the configure I specified the following flags:
Code:
./configure \
  --prefix=/usr/local \
  --sbindir=/usr/local/sbin \
  --sysconfdir=/etc/apcupsd \
  --mandir=/usr/local/share/man \
  --with-log-dir=/var/log \
  --disable-cgi \
  --enable-usb

The make and install went fine, but on trying to load the daemon I get the following error.

Code:
#/etc/init.d/apcupsd start
Starting apcupsd power management ...ld.so.1: apcupsd: fatal: libusb.so.1: open failed: No such file or directory
/etc/init.d/apcupsd: line 24: 15893: Killed
        Failed.

The file does exist, but I guess it isn't where it is supposed to be.
Code:
# find / -name libusb.so.1
find: ‘/proc/16084/fd/5': No such file or directory
find: ‘/proc/16084/path/5': No such file or directory
/usr/sfw/lib/libusb.so.1

I was able to solve this by exporting the path
Code:
# export LD_LIBRARY_PATH=/usr/sfw/lib/

Then the daemon worked.

However, whenever the machine reboots, the daemon will fail to load since I need to manually first re-export the path. I feel like manually remembering to do this every reboot is not the correct solution, and just a work-around.

First steps to solution
I'm trying to follow Sun's documentation on "4.3 Setting Library Search Paths and Order" [ I cannot post a direct link yet but google search should point to the doc if you are interested ]

However, I'm not really understanding the differences between dynamic and static linking.

QUESTION

My main question is "how do I solve the problem of LDD finding libusb.so.1 in /usr/sfw/lib/ when a reboot occurs so the APCUPSD daemon auto-starts".

A follow up for my own edification would be to explain dynamic vs static library linking. Do I need to re-compile APCUPSD with flags that point to libusb.so.1? Should I make a sym link pointing to libusb.so.1 in the directory that ldd normally searches?

Thanks in advance for all the help!
 

6 More Discussions You Might Find Interesting

1. Programming

school or teach myself?

I want to learn c lenguage and am wonder if is better if i go to a school or teach myself, or there is no to much diference? Thank you (9 Replies)
Discussion started by: nobody
9 Replies

2. UNIX for Dummies Questions & Answers

libraries

I am slowly ploughing my way through the list of links to on-line tutorials you provided to newbies. I for one am grateful for such a comprehensive list, so first of all thank you for that. What i cannot seem to find, is information on C++ libraries: The two links on libraries in your list... (0 Replies)
Discussion started by: pil888
0 Replies

3. UNIX for Advanced & Expert Users

What to teach the new guy

so I have taken on the task of running a few workshops / teaching sessions. we have three new unix people, they have the basics sorted, CD, PWD, LS and such. we are looking at people who have been doing helpdesk untill two months ago. I have given them a few session: file systems, what... (2 Replies)
Discussion started by: robsonde
2 Replies

4. UNIX for Advanced & Expert Users

Sql dynamic table / dynamic inserts

I have a file that reads File (X.txt) Contents of record 1: rdrDESTINATION_ADDRESS (String) "91 971502573813" rdrDESTINATION_IMSI (String) "000000000000000" rdrORIGINATING_ADDRESS (String) "d0 movies" rdrORIGINATING_IMSI (String) "000000000000000" rdrTRAFFIC_EVENT_TIME... (0 Replies)
Discussion started by: magedfawzy
0 Replies

5. Programming

I want to know some c libraries

I'm a rookie to C and i'm looking for some libraries to learn,something likes the C++ STL or Boost ,does any1 can tell me some of them?Thanks a lot:) Eric (3 Replies)
Discussion started by: homeboy
3 Replies

6. Homework & Coursework Questions

I have here my assignment can any one teach me please

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Is to compute for the discount of the two variables of TODDLER and KID 2. Relevant commands, code, scripts,... (3 Replies)
Discussion started by: stephanielana1
3 Replies
libusb(3LIB)                                                    Interface Libraries                                                   libusb(3LIB)

NAME
libusb - user-space USB device management library SYNOPSIS
cc [ flag... ] -I/usr/sfw/include file... -L/usr/sfw/lib -R/usr/sfw/lib -lusb [ library... ] #include <usb.h> DESCRIPTION
The libusb library contains interfaces for managing USB devices without a kernel driver. It is an open-source API supported on Linux, Mac- OS X, and NetBSD. See http://libusb.sourceforge.net. The current implementation is version 0.1.8 of the libusb API. Complete documentation for this library can be found at /usr/sfw/share/doc/libusb/libusb.txt. INTERFACES
The shared object libusb.so.1 provides the following public interfaces. See intro(3) for additional information on shared object inter- faces. usb_bulk_read usb_bulk_write usb_claim_interface usb_clear_halt usb_close usb_control_msg usb_find_busses usb_find_devices usb_get_busses usb_get_descriptor_by_endpoint usb_get_descriptor usb_get_string usb_get_string_simple usb_init usb_interrupt_read usb_interrupt_write usb_open usb_release_interface usb_reset usb_resetep usb_set_altinterface usb_set_configuration usb_set_debug usb_strerror FILES
/usr/sfw/lib/libusb.so.1 shared object /usr/sfw/lib/libusb_plugins implementation-specific libusb modules /usr/sfw/bin/libusb-config script to determine linking environment ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWlibusb, SUNWlibusbut, | | |SUNWlibugenusb | +-----------------------------+-----------------------------+ |Interface Stability |External | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
intro(3), attributes(5) http://libusb.sourceforge.net SunOS 5.10 14 Oct 2004 libusb(3LIB)
All times are GMT -4. The time now is 02:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy