LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-01-2013, 07:47 PM   #1
stateless
Member
 
Registered: Jan 2013
Distribution: Debian
Posts: 166
Blog Entries: 1

Rep: Reputation: 4
python setup: changing library path


Hi. I'm trying to install a python modules that is trying to build something using gcc, but it fails with:

Code:
/usr/bin/ld: cannot find -lpython2.7
libpython2.7.so happens to be in an unusually place on my system. I set LD_LIBRARY_PATH to exactly the correct place, but setup.py doesn't seem to care. How to I tell setup.py where it is supposed to find its shared libraries?
 
Old 02-10-2013, 04:02 PM   #2
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Go to where it normally looks and symlink from there to the actual library location.
 
Old 02-11-2013, 01:07 PM   #3
stateless
Member
 
Registered: Jan 2013
Distribution: Debian
Posts: 166

Original Poster
Blog Entries: 1

Rep: Reputation: 4
The problem is that I did a local Python installation on a system on which I don't have admin privileges, so I can't create symlinks in the normal spot. (They were using a really ancient version of Python, and I wanted the latest.) I used Nix to install Python locally, and I know exactly where it put the shared library, but I don't know how to get setup.py to use it.
 
Old 02-12-2013, 01:58 PM   #4
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
I think that creating a local ~/bin directory an putting the correct value in it might work. You should, of course, make sure that your PATH value starts with ~/bin

Here's the standard values on my (old) laptop, running Fedora 18.
Code:
~ $ type -p python
/usr/bin/python
~ $ file $(type -p python)
/usr/bin/python: symbolic link to `python2'
~ $ file $(type -p python2)
/usr/bin/python2: symbolic link to `python2.7'
~ $ file $(type -p python2.7)
/usr/bin/python2.7: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=0xf872fc2e1f49b9b747a4ebd45265dc72a707cb3e, stripped
 
Old 02-13-2013, 01:17 PM   #5
stateless
Member
 
Registered: Jan 2013
Distribution: Debian
Posts: 166

Original Poster
Blog Entries: 1

Rep: Reputation: 4
Quote:
Originally Posted by PTrenholme View Post
I think that creating a local ~/bin directory an putting the correct value in it might work. You should, of course, make sure that your PATH value starts with ~/bin

Here's the standard values on my (old) laptop, running Fedora 18.
Code:
~ $ type -p python
/usr/bin/python
~ $ file $(type -p python)
/usr/bin/python: symbolic link to `python2'
~ $ file $(type -p python2)
/usr/bin/python2: symbolic link to `python2.7'
~ $ file $(type -p python2.7)
/usr/bin/python2.7: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=0xf872fc2e1f49b9b747a4ebd45265dc72a707cb3e, stripped
Maybe I misunderstood your response, but I do not think it addresses my specific problem. I do not have any problems executing my custom version of Python. My PATH is already set correctly for that and the correct binary launches. The problem is that, when I try to build a module using "python setup.py", the setup.py program cannot find the custom version of the libpython2.7.so shared library. I know where it is, and I set LD_LIBRARY_PATH to make it available, but setup.py does not seem to be respecting this.
 
Old 02-13-2013, 02:10 PM   #6
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Based on Tweaking compiler/linker flags, I think if you add
Code:
-L/your/libpython/path/
to the Setup file it should work. Putting that in the CFLAGS environment variable should also work.

It seems like there could be a way to add this setting to some kind configuration file so it will be added automatically, but the docs are somewhat vague about the syntax.
 
  


Reply



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
how to include the path of exe in the ld library path? malli42108 Linux - Networking 10 09-17-2009 09:21 AM
LXer: Move to python 2.4 / Changing the packaging style for python packages LXer Syndicated Linux News 0 06-13-2006 07:54 PM
installing python library's (Python Numeric) Four Linux - Newbie 1 10-16-2005 02:31 PM
Changing gcc library path jon_k Linux - Software 1 08-22-2004 12:09 AM
How to Chnage Python's module search path (sys.path)? lramos85 Linux - Software 1 05-02-2004 06:10 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:02 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration