gcc -pthread -shared build/temp.linux-i686-2.4/ow_wrap.o -L../../owlib/src/c/.libs -Wl,-R/opt/owfs/lib -low -lusb -o build/lib.linux- i686-2.4/ow/_OW.so
while on gentoo it looks like:
i386-pc-linux-gnu-gcc -pthread -shared build/temp.linux-i686-2.3/ow_wrap.o -L../../owlib/src/c/.libs -R/opt/owfs/lib -low -o build/lib.linux-i686-2.3/ow/_OW.so
It seems that the -Wl, is missing from the gentoo command. The -Wl causes gcc to pass the parameters after the , on to the linker. Since it's not there on gentoo and gcc doesn't know what -R means, it spits out a warning and finishes the build. But the resultant shared library is missing the references to the /opt/owfs/lib directory that allow the loader to find the libow.so.0 shared library.
Next course is to find out why the Python build on gentoo isn't behaving as expected...
- Peter
On 1/16/06,
George Bobeck <[EMAIL PROTECTED]> wrote:
Sorry for the second post...
I did a little googling on the '-R' flag for GCC
Of interest is http://www.usc.edu/isd/doc/programming/c.html
Which states:
"Unix has a lot of shared libraries (pre-compiled code that programs
can link into as if it were source code in the project). The standard
place to find libraries on a unix system is /usr/lib. At USC /lib and
/usr/lib are the same directory. However, there are additional
libraries spread throughout /usr/usc/, such as
/usr/usc/jpeg/default/lib.
To call a library, it must first be in your library path. Standard
libraries needed by the compiler and used commonly in programs, such
as the math libraries are already in the path. The library path is
built in three steps. First, the compiler reads your $LD_LIBRARY_PATH
shell variable. Then it adds its own libraries (for instance
/usr/usc/gnu/gcc/default/lib). Finally it adds paths specified by the
-L flag.
Once the library is in your library path, you call the library with
the -l flag. If you used math functions such as sin and cos in your
program, it may require the math library. You can include the math
library with -lm. If you wanted to include your own library called
myLib that you put in ~/lib, your command line might look something
like
gcc -o progWithLibs -L$HOME/lib -lmyLib progWithLibs.c
It may be necessary to use $HOME rather than ~ because the compiler
expects an absolute path (a path that starts with the system root /).
There must not be any space between -L or -l and its argument.
Adding a directory to your LD_LIBRARY_PATH has a similar effect for
compiling, but it also is included as a search path for every program
that is compiled or is executed, regardless of whether it needs that
library. Because of this, it is not a good idea to create a massive
LD_LIBRARY_PATH. Proper use of -L flags, and linking tools like ld and
libtool can make the use of LD_LIBRARY_PATH unnecessary.
It is suggested that for every -L flag you use, you use an identical
-R flag. the -R flag sets the RPATH, which is an LD_LIBRARY_PATH built
directly into the program itself. If you do not use -R flags, you may
need to set a permanent LD_LIBRARY_PATH. "
Hope that helps a bit.
George Bobeck
On 1/16/06, Peter Kropf <[EMAIL PROTECTED]> wrote:
> Hi George!
>
> I finally got a gentoo system built and ran into the same problem as you. I
> think it's because of an error that happened during the build step for the
> Python module.
>
> building '_OW' extension
> creating build/temp.linux- i686-2.3
> i386-pc-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -fPIC
> -I../../owlib/src/include -I../../../src/include -I/usr/include/python2.3 -c
> ow_wrap.c -o build/temp.linux-i686-2.3/ow_wrap.o
> i386-pc-linux-gnu-gcc -pthread -shared build/temp.linux- i686-2.3/ow_wrap.o
> -L../../owlib/src/c/.libs -R/opt/owfs/lib -low -o
> build/lib.linux-i686-2.3/ow/_OW.so
> i386-pc-linux-gnu-gcc: unrecognized option `-R/opt/owfs/lib'
>
> I'm not yet certain on the purpose of the -R option or why it's not
> recognized. The python module is built and when make install is run,
> everything is installed into the correct directories. But running Python
> gives:
>
> [EMAIL PROTECTED] ~/src/owfs $ python -c "import ow; print ow.__version__"
> Traceback (most recent call last):
> File "<string>", line 1, in ?
> File "/usr/lib/python2.3/site-packages/ow/__init__.py",
> line 31, in ?
> import _OW
> ImportError: libow.so.0: cannot open shared object file: No such file or
> directory
>
> For now, there's a quick workaround in defining LD_LIBRARY_PATH to include
> /opt/owfs/lib.
>
> [EMAIL PROTECTED] ~/src/owfs $ LD_LIBRARY_PATH=/opt/owfs/lib python -c "import ow;
> print ow.__version__"
> 2.2p0RC-1.7
>
> In the mean time, I'll try to figure out what's going on with building on
> gentoo. If anyone has any ideas as to the purpose of the -R option, where
> its coming from and why gcc on gentoo is rejecting it, please send along an
> email...
>
> - Peter