LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 06-08-2009, 01:45 PM   #1
misungs
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Rep: Reputation: 0
error while loading shared libraries: libhid.so.0: cannot open shared object file: No


Hi
I'm trying to run a program to talk to a device.
When I do make, make install, and run in terminal using this Makefile, this program works.
The makefile is following:
# Current Version of the driver
VERSION=1.37

SRCS = pmd.c usb-1208FS.c
HEADERS = pmd.h usb-1208FS.h
OBJS = $(SRCS:.c=.o) # same list as SRCS with extension changed
CC=gcc
CFLAGS= -g -Wall -fPIC -O
TARGETS=libmcchid.so libmcchid.a tipsy_text
ID=MCCLIBHID
DIST_NAME=$(ID).$(VERSION).tgz
DIST_FILES={README,Makefile,usb-1208FS.h,usb-1208FS.c,pmd.h,pmd.c,tipsy_text.c}
###### RULES
all: $(TARGETS)

%.d: %.c
set -e; $(CC) -I. -M $(CPPFLAGS) $< \
| sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
[ -s $@ ] || rm -f $@
ifneq ($(MAKECMDGOALS),clean)
include $(SRCS:.c=.d)
endif

libmcchid.so: $(OBJS)
$(CC) -O -shared -Wall $(OBJS) -o $@

libmcchid.a: $(OBJS)
ar -r libmcchid.a $(OBJS)
ranlib libmcchid.a

tipsy_text: tipsy_text.c libmcchid.a
$(CC) -static -g -Wall -I. -o $@ $@.c -lmcchid -L. -lm -L/usr/local/lib -lhid -lusb

clean:
rm -rf *.d *.o *~ *.a *.so $(TARGETS)

dist:
make clean
cd ..; tar -zcvf $(DIST_NAME) libhid/$(DIST_FILES);

install:
-install -d /usr/local/lib
-install -c --mode=0755 ./libmcchid.a libmcchid.so /usr/local/lib
-/bin/ln -s /usr/local/lib/libmcchid.so /usr/lib/libmcchid.so
-/bin/ln -s /usr/local/lib/libmcchid.a /usr/lib/libmcchid.a
-install -d /usr/local/include/libhid
-install -c --mode=0644 ${HEADERS} /usr/local/include/libhid/

uninstall:
-rm -f /usr/local/lib/libmcchid*
-rm -f /usr/lib/libmcchid*
-rm -rf /usr/local/include/libhid


But if I build and run the same files in Fedora Eclipse, the error message appears: /home/misungs/workspace/tipsy_text/Debug/tipsy_text: error while loading shared libraries: libhid.so.0: cannot open shared object file: No such file or directory

In addition, because I don't want to install library all the time, I want to use the following makefile:

all: tipsy_text.exe
clean:
rm *.o tipsy_text.exe

tipsy_text.exe: tipsy_text.o usb-1208FS.o pmd.o
g++ -g -o tipsy_text.exe tipsy_text.o usb-1208FS.o pmd.o -L/usr/local/lib -lmcchid -lhid -lusb

tipsy_text.o: tipsy_text.c usb-1208FS.h pmd.h
g++ -c -g tipsy_text.c

usb-1208FS.o: usb-1208FS.c usb-1208FS.h pmd.h
g++ -c -g usb-1208FS.c

pmd.o: pmd.c pmd.h
g++ -c -g pmd.c

When I tried to run this, the same error appeared in Eclipse.

libhid.so.0 is located in /usr/local/lib, and I designated the library path in Eclipse. I can't understand why this error appears.
Thanks for reading this, and I'm looking forward to hearing from you.

Last edited by misungs; 06-08-2009 at 01:46 PM.
 
Old 06-08-2009, 01:55 PM   #2
david1941
Member
 
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS6
Posts: 267

Rep: Reputation: 57
See man ldconfig. It may help

Dave
 
Old 06-09-2009, 11:31 AM   #3
misungs
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Also when I use my makefile in terminal

Thanks for your advice.

I tried ldconfig -v, but it didn't worked; probably I didn't use "ldconfig" properly.

In addition, when I use my makefile in terminal,
this error follows:
[root@tipsy tipsy_text]# make
g++ -c -g tipsy_text.c
In file included from pmd.h:39,
from tipsy_text.c:17:
/usr/local/include/hid.h:76: error: typedef ‘_Bool’ is initialized (use __typeof__ instead)
/usr/local/include/hid.h:76: error: ‘matcher_fn_t’ was not declared in this scope
/usr/local/include/hid.h:83: error: ‘matcher_fn_t’ does not name a type
/usr/local/include/hid.h:128: error: ‘_Bool’ does not name a type
/usr/local/include/hid.h:137: error: ‘_Bool’ does not name a type
make: *** [tipsy_text.o] Error 1

How can I solve this?
 
Old 06-09-2009, 02:04 PM   #4
david1941
Member
 
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS6
Posts: 267

Rep: Reputation: 57
These are errors in the header file /usr/local/include/hid.h that was included from pmd.h line 39 that was called from tipsy_text.c (line 17). Since you couldn't find the shared lib file libhid.so.0 before, I'd say you found it now. :-(

I try locating the libhid.so.0 file using "locate libhid.so.0" at a command line, and, if found, creating a symlink in a standard lib location to it.
 
Old 06-10-2009, 12:05 PM   #5
misungs
LQ Newbie
 
Registered: Jun 2009
Posts: 3

Original Poster
Rep: Reputation: 0
partly solved :)

I'm a newbie and cannot handle linux easily, but the problem is partly solved

My program is built and runs in Eclipse after linking the program to .so file using more /etc/ld.so.conf/d, /sbin/ldconfig.

When I compile the program in terminal,however, following error still occurs:
[misungs@tipsy tipsy_text]$ make
g++ -c -g tipsy_text.c
In file included from pmd.h:40,
from tipsy_text.c:18:
/usr/local/include/hid.h:76: error: typedef ‘_Bool’ is initialized (use __typeof__ instead)
/usr/local/include/hid.h:76: error: ‘matcher_fn_t’ was not declared in this scope
/usr/local/include/hid.h:83: error: ‘matcher_fn_t’ does not name a type
/usr/local/include/hid.h:128: error: ‘_Bool’ does not name a type
/usr/local/include/hid.h:137: error: ‘_Bool’ does not name a type
make: *** [tipsy_text.o] Error 1
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error while loading shared libraries: libstdc++.so.5: cannot open shared object file: Franziss Linux - Newbie 10 06-28-2010 05:47 AM
gxine: error while loading shared libraries: libmozjs.so: cannot open shared object.. empcrono Slackware 10 11-10-2008 07:33 PM
error while loading shared libraries: libstdc++.so.5: cannot open shared object file PaulyWally Debian 2 10-18-2008 05:59 PM
error while loading shared libraries: libgvc.so.3: cannot open shared object file coolrock Slackware 6 01-17-2007 05:10 PM
error while loading shared libraries: libdb-4.1.so: cannot open shared object file putquery8581 Linux - Software 1 10-01-2004 07:03 AM


All times are GMT -5. The time now is 09:27 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration