473,749 Members | 2,626 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

rpath in setup.py?

Hi,

On linux:

I'm a newbie and want to make build-versions of python 2.1.3 and
it's modules which link against different versions of a library
located in directories not mentioned in /etc/ld.so.conf, e.g.
versions of expat could be:

/opt/expatx
/opt/expaty
/opt/expatz

How do I make python use -rpath against such directories, for
example by changing setup.py? So far I've made setup.py detect
my expat.h in /opt/expat/include, but when I use ldd on
pyexpat.so, the libexpat located in /usr/lib is used instead of
/opt/expatx/lib.

I have tried to use flags like LDFLAGS="-Wl,--rpath
-Wl,/opt/expatx/lib" and similar things during ./configure and
make, but without luck. I am confused...

I use Debian "stable" with gcc/g++ 3.3 and GNU ld 2.11.90.0.8
from "testing".

Any help/links will be greatly appreciated!!

Regards, Tore

Jul 18 '05 #1
4 4136
Tore Ferner wrote:
[...] How do I make python use -rpath against such directories, for
example by changing setup.py? [...]


Here's a snippet of a setup.py from a project I'm involved in:

ext_modules = [Extension(
...
runtime_library _dirs = pypgsql_rt_dirs ,
...
)],

runtime_library _dirs is a list of directories, just like library_dirs.
And I'd think it makes sense that both refer to the same list ;)

In other words, library_dirs ends up as -L option, whereas
runtime_library _dirs ends up as -rpath option.

HTH,

-- Gerhard

Jul 18 '05 #2
Gerhard Häring wrote:
Tore Ferner wrote:
[...] How do I make python use -rpath against such directories, for
example by changing setup.py? [...]

Here's a snippet of a setup.py from a project I'm involved in:

ext_modules = [Extension(
...
runtime_library _dirs = pypgsql_rt_dirs ,
...
)],

runtime_library _dirs is a list of directories, just like library_dirs.
And I'd think it makes sense that both refer to the same list ;)

In other words, library_dirs ends up as -L option, whereas
runtime_library _dirs ends up as -rpath option.

HTH,


Thanks! But I got errors. I am not sure how to implement your suggestion.
Is there documentation about this?

In the examples below I place both expat and python under
/opt/python/python2.1.3 (and with lib and include below that level).
I changed setup.py to:

ext_modules=[Extension('stru ct', ['structmodule.c '],
runtime_library _dirs = ['/opt/python/python2.1.3/lib'] <= added
)],
This change generated the following error:

$ (various flags) ./configure --prefix=/opt/python/python2.1.3
----[snip]
running build_ext
building 'struct' extension

gcc -g -O2 -Wall -Wstrict-prototypes -fPIC -I.
-I/usr/local/src/python/Python-2.1.3/./Include
-I/opt/python/python2.1.3/include -I/usr/local/include -IInclude/ -c
/usr/local/src/python/Python-2.1.3/Modules/structmodule.c -o
build/temp.linux-i686-2.1/structmodule.o -g -O2 -Wall -Wstrict-prototypes
-I. -I./Include -DHAVE_CONFIG_H

gcc -shared build/temp.linux-i686-2.1/structmodule.o
-L/opt/python/python2.1.3/lib -L/usr/local/lib
-R/opt/python/python2.1.3/lib -o build/lib.linux-i686-2.1/struct.so

gcc: unrecognized option `-R/opt/python/python2.1.3/lib
----[snip]
Other than that no rpath related stuff appears during compilation (as far
as I know). Should I add pyexpat or pyexpat.c to ext_modules line somehow?

Could it be that -R was meant for ld on the command line and not as a
parameter for gcc to pass along to ld? (As if I were on a sun machine?)
This is the only place where -R appears during the whole compilation.
Should not "-Wl,--rpath -Wl,/opt/python/python2.1.3/lib" be used instead
of "-R" for gcc on linux?
If I add flags like:

LIBS="-lgdbm_compat -lgdbm" LDFLAGS="-L/opt/python/python2.1.3/lib \
-Wl,--rpath -Wl,/opt/python/python2.1.3/lib" \
CFLAGS="-I/opt/python/python2.1.3/include \
-L/opt/python/python2.1.3/lib \
-Wl,--rpath -Wl,/opt/python/python2.1.3/lib \
-D_LARGEFILE64_S OURCE -D_FILE_OFFSET_B ITS=64" CPPFLAGS="$CFLA GS" \
./configure --prefix=/opt/python/python2.1.3

The option "-Wl,--rpath -Wl,/opt/python/python2.1.3/lib" appears only
once during the whole compilation at this point:
----[snip]
gcc -L/opt/python/python2.1.3/lib -Wl,--rpath
-Wl,/opt/python/python2.1.3/lib -Xlinker -export-dynamic -o python \
Modules/python.o \
libpython2.1.a -lpthread -ldl -lgdbm_compat -lgdbm
-lutil -lcrypt -lm
libpython2.1.a( posixmodule.o)( .text+0x2caa): In function `posix_tmpnam':
Modules/posixmodule.c:4 218: the use of `tmpnam_r' is dangerous, better
use `mkstemp'
libpython2.1.a( posixmodule.o)( .text+0x2be0): In function `posix_tempnam' :
Modules/posixmodule.c:4 174: the use of `tempnam' is dangerous, better use
`mkstemp'
PYTHONPATH= ./python ./setup.py build
----[snip]
The building of the rest of the modules looks typically like this:
----[snip]
building 'regex' extension
gcc -g -O2 -Wall -Wstrict-prototypes -fPIC -I.
-I/usr/local/src/python/Python-2.1.3/./Include
-I/opt/python/python2.1.3/include -I/usr/local/include -IInclude/ -c
/usr/local/src/python/Python-2.1.3/Modules/regexmodule.c -o
build/temp.linux-i686-2.1/regexmodule.o -
g -O2 -Wall -Wstrict-prototypes -I. -I./Include -DHAVE_CONFIG_H
gcc -g -O2 -Wall -Wstrict-prototypes -fPIC -I.
-I/usr/local/src/python/Python-2.1.3/./Include
-I/opt/python/python2.1.3/include -I/usr/local/include -IInclude/ -c
/usr/local/src/python/Python-2.1.3/Modules/regexpr.c -o
build/temp.linux-i686-2.1/regexpr.o -g -O2 -W
all -Wstrict-prototypes -I. -I./Include -DHAVE_CONFIG_H
gcc -shared build/temp.linux-i686-2.1/regexmodule.o
build/temp.linux-i686-2.1/regexpr.o -L/opt/python/python2.1.3/lib
-L/usr/local/lib -o build/lib.linux-i686-2.1/regex.so
----[snip]

I have also tried to edit the file Modules/Setup, uncommenting pyexpat
and adding -Xlinker options:

pyexpat pyexpat.c -I/opt/python/python2.1.3/include \
-L/opt/python/python2.1.3/lib -lexpat -Xlinker --rpath -Xlinker \
/opt/python/python2.1.3/lib

(The line is not diveded up in the source.)

That resulted in errors because the header file xmlparse.h couldn't be
found. I do not know if this file is supposed to come from expat, libxml
or what. I have expat version 1.95.6 (with added definition for
XML_Status) and there I have found I file called xmlparse.c but not
xmlparse.h - yet.

Any ideas?

Regards, Tore

Jul 18 '05 #3
> ext_modules=[Extension('stru ct', ['structmodule.c '],
runtime_library _dirs = ['/opt/python/python2.1.3/lib'] <= added
)],


Did you try the following already?
....
extra_link_args = ['-Wl,-R/opt/python/python2.1.3/lib']
....

Marc

Jul 18 '05 #4
Marc Recht wrote:
ext_modules=[Extension('stru ct', ['structmodule.c '],
runtime_library _dirs = ['/opt/python/python2.1.3/lib'] <= added
)],

Did you try the following already?
...
extra_link_args = ['-Wl,-R/opt/python/python2.1.3/lib']
...


Yes, that solved the problem. I found the documentation and when I use
this and add an Extension for pyexpat in exts.append, it works. Similar
changes in other 3. party modules also work as it should.

Happy me, Tore

Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5305
by: pbj | last post by:
my application was created in vb.net, vs 2003. the setup project was also created in vs 2003. one of my application reviewers reported this: The .Net link that is included in the setup is not the correct link, it's outdated. The link should be changed from this http://msdn.microsoft.com/library/default.asp?url=/downloads/list/netdevframework.asp to the new link, which is this:...
5
3576
by: paul kölle | last post by:
hi all, I noticed that setUp() and tearDown() is run before and after *earch* test* method in my TestCase subclasses. I'd like to run them *once* for each TestCase subclass. How do I do that. thanks paul
0
1941
by: Adam Clauss | last post by:
I have a C++ COM Addin I wrote for Outlook (2002) using VS.Net 2002. Having completed it, I am now looking to create a setup project and install it on another machine. I created a setup project and added it to my solution (selecting the "Primary Output" as the files to include from my project). However, when I attempt to build the setup project (assuming a clean output directory), I get "Unrecoverable build error" - and NO other...
4
2312
by: Howard Kaikow | last post by:
When I build a setup project, the dependency in the setup project is tied to the version in which it was built. Is there a way to build a setup project that can be used in both versions of the Framework? There is provision to build the app's .exe so that the .exe can be used in either version of the framework, is there not a way to do this for the setup project? I looked at the options, did not find any. Did I miss something? --
2
2013
by: A.Carter | last post by:
I am developing a windows application with Visual Studio 2003 using C#. The application is complete so naturally I went to create a setup package. I added a setup project to the solution and I went through the appropriate steps in attaching the solution dependencies. After completing the setup package, I attempted to install the application on a co-worker's computer. Usually, the installation consist of several screens which directs the...
2
2789
by: Mark Harrison | last post by:
I've built a python with --enable-shared in order to support mod_python, but now I have to set LD_LIBRARY_PATH to $prefix/lib. Worse, it seems mod_python will die on some import statements, I'm suspecting ones that need to pull in .so's. Any clues appreciated... Mark. --
1
3601
by: rohan_from_mars | last post by:
I have a windows service and am also using Enterprise Library June 2005 version. Now i have created Setup and Deployment Project which installs the service. but how do i add EL dlls- Common.dll, Logging.dll, Configuration.dll, Data.dll into setup project so that it is also installed automatically. It should perform what the 'Install Services.bat ' performs. I have created ProjectInstaller.cs file also
6
4069
by: andrewbb | last post by:
I want to deploy a service with a windows app and the setup program must conform to the Vista certification requirements. Can that be done with the standard .net setup project? Assuming cost is an issue, what else is available?
6
5214
by: Srini | last post by:
Hi, I am facing a problem in localizing the setup file and .NET framework redistributable. I am trying to deploy c# winform application. I have created a setup project. I need to redistribute .NET framework 2.0 along with the setup. I need to localize the setup project(strings appearing in the
0
8997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9568
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6801
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3320
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2794
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2218
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.