Thread: Troubling compiling with pthread

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    224

    Troubling compiling with pthread

    I am writing a program that uses threads. Everything compiles fine, but when I run the program, I get the following error:
    Shared object "libpthread.so.20" not found

    Here's what I have in my makefile:
    Code:
    files = thread thread.core temp output
    includes = -I/usr/pkg/include
    lib = -L/usr/pkg/lib
    library = -lpthread
    
    make:
    	gcc thread.c $(lib) $(includes) $(library) -o thread
    	./thread -p 23 -c 3 -n 10 -t 5 -s 6
    
    clean:
    	@for file in $(files); do \
    		if [ -f $$file ] ; then\
    			echo "rm $$file"; \
    			rm $$file; \
    		fi; \
    	done;
    I am doing my work on NetBSD 1.6.1. Can someone help me out?

  2. #2
    Registered User
    Join Date
    Aug 2002
    Posts
    351
    do you have libpthread.so.20 on your system (find/locate)?

    do your default library paths contain it's directory (/etc/ld.so.conf)?

  3. #3
    Registered User
    Join Date
    Sep 2003
    Posts
    224
    Yes I have all the threading libraries. I solved the problem by doing setting LD_RUN_PATH to /usr/pkg/lib. Is there another way to do it? Thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pthread question
    By quantt in forum Linux Programming
    Replies: 7
    Last Post: 04-07-2009, 01:21 AM
  2. Compiling Issues
    By pc_doctor in forum C Programming
    Replies: 3
    Last Post: 11-30-2007, 10:00 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Compiling
    By Dae in forum C++ Programming
    Replies: 7
    Last Post: 06-15-2005, 01:08 AM
  5. The Pthread Hell
    By matott in forum Linux Programming
    Replies: 1
    Last Post: 04-10-2005, 05:59 AM