You need to link it statically. By default gcc will link dynamically. use g++ -static flag, and you should be good to go

On Mon, May 23, 2011 at 10:24 PM, Eric Lin <kingdavid1@w.cn> wrote:


Dear boost programers(especially on linux/g++) :
  I copied that book's C++ Cookbook example12-1, and download boost lib's 1.46.1
on my Ubuntu Linux/ gnu-g++ system, I am not sure I am configure/install
good enough or not.  Anyway, I get a.out
but when I run a.out
-----------
eric@eric-laptop:~/cppcookbook$ ./a.out
./a.out: error while loading shared libraries:
libboost_thread.so.1.46.1: cannot open shared object file: No such file
or directory
-------------
is this what you suppose to get?/* I email both first 2 authors: D. Ryan Stephens and Christopher Diggins, they not yet reply */
                                                      /* last 2 authors Jonathan Turkanis and Jeff Cogswell, I can not get their email address */
if not(I guess), where go wrong and how to fix it?
---------
I am pretty novice on g++ and linux.  Hope the following link help
you debug.

http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

I also tried
root@eric-laptop:/# ldconfig -p | grep -i boost
root@eric-laptop:/#
--------
I read that link, it seem link will go through my /etc/ld.so.conf.d
there are
atlas.conf GL.conf i486-linux-gnu.conf libasound2.conf libc.conf
Xen.conf

so I
cat /etc/ld.so.conf.d/libc.conf

which show
#libc default configuration
/usr/local/lib

and in my /usr/local/lib
I do have
libboost_thread.a
libboost_thread.so
libboost_thread.so.1.46.1

so I really have no idea how to debug/fix
plz help
Eric, in Los Angeles
----------------------------------------
Date: Sun, 22 May 2011 18:43:01 -0700
From: watanabesj@gmail.com
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] simple thread program hard to compile/link with 1.46.1


AMDG

On 05/22/2011 05:09 PM, Eric Lin wrote:
>
> Dear Steven or any boost programers/users:
>
> I tried
> ./bootstrap.sh
> ./bjam
> ./bjam install
>
> in my /boost_1_46_1/ directory which is auto extracted by my ubuntu linux after download
>
> but I got the following build/compile errors:(these are just small portion of all errors)(c++ compiler is g++ of gnu on intel)
> ------------------------------
>     cp "bin.v2/libs/math/build/gcc-4.4.3/release/link-static/threading-multi/libboost_math_c99f.a"  "/usr/local/lib/libboost_math_c99f.a"
>
> ...failed common.copy /usr/local/lib/libboost_math_c99f.a...
> common.copy /usr/local/lib/libboost_math_c99l.a
> cp: cannot create regular file `/usr/local/lib/libboost_math_c99l.a': Permission denied
>

sudo bjam install?
Alternately, just use -L/path/to/boost_1_46_1/stage/lib.

In Christ,
Steven Watanabe


_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users