Fedora Linux Support Community & Resources Center
  #1  
Old 2nd October 2012, 09:23 AM
beemar Offline
Registered User
 
Join Date: Oct 2012
Location: Croatia
Posts: 3
linuxfirefox
Replacing python or tweaking scons

Hi,

I've got FC15 here at work and I've ran into a problem - company has some binaries built against UCS2 Python and I'm supposed to link with those... And my python is UCS4, thus yielding:
Quote:
undefined reference to `PyUnicodeUCS2_DecodeUTF8'
I've set-up virtualenv with ucs2 python and whole env works fine, but scons (used for building in-house stuff) keeps linking against system python (/usr/lib64/python2.7).

I see two solutions to my problem - one, replacing system python with UCS2 python and second, making scons link against ucs2 python. First one would be best, but I think it is not doable? It would break a lot of stuff... Or?
And the second one - I don't know if that's even possible...

What do you suggest?
Reply With Quote
  #2  
Old 2nd October 2012, 10:59 AM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,090
linuxfirefox
Re: Replacing python or tweaking scons

Install UCS2 python on /usr/local, then use a wrapper around a /usr/local/bin/python to add "LD_PRELOAD=/usr/local..." (including the path to the UCS2 python libraries) before running the UCS2 python interpreter.

Should work.
Reply With Quote
  #3  
Old 2nd October 2012, 12:13 PM
beemar Offline
Registered User
 
Join Date: Oct 2012
Location: Croatia
Posts: 3
linuxfirefox
Re: Replacing python or tweaking scons

Quote:
Originally Posted by jpollard View Post
Install UCS2 python on /usr/local, then use a wrapper around a /usr/local/bin/python to add "LD_PRELOAD=/usr/local..." (including the path to the UCS2 python libraries) before running the UCS2 python interpreter.

Should work.
Thanks! I installed it there, but I don't understand the wrapper part you're talking about. Also, LD_PRELOAD expects exact libraries, should I put all .so-s into the path?
Reply With Quote
  #4  
Old 2nd October 2012, 01:15 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,090
linuxfirefox
Re: Replacing python or tweaking scons

The wrapper is just a short shell script, and isn't absolutely necessary UNLESS you also other python scripts that don't use the UCS2 python.

The wrapper is something like:
Code:
#!/bin/sh
export LD_PRELOAD=</usr/local/lib.. list of libraries>
exec </usr/local/bin/<progname>
The main advantage the "LD_PRELOAD" has is that it specifies a path to load libraries from before it uses the normal system provided libraries.

The advantage of using the wrapper is that you don't necessarily want LD_PRELOAD turned on everywhere as that can cause problems running python scripts that don't use those libraries...

The only reason the "exec" command is there is just to chain directly to the executable you want. When the command terminates the LD_PRELOAD is no longer defined.

You can look in the man page for ld.so for more details. You may even be able to use LD_LIBRARY_PATH (which only needs the directory name). The reason I'm not certain of that is that it will mix other library searches as well which may confuse things. LD_PRELOAD explicitly designates the libraries to be loaded before looking in the normal places.
Reply With Quote
  #5  
Old 3rd October 2012, 06:57 AM
beemar Offline
Registered User
 
Join Date: Oct 2012
Location: Croatia
Posts: 3
linuxfirefox
Re: Replacing python or tweaking scons

Quote:
Originally Posted by jpollard View Post
The wrapper is just a short shell script, and isn't absolutely necessary UNLESS you also other python scripts that don't use the UCS2 python.

The wrapper is something like:
Code:
#!/bin/sh
export LD_PRELOAD=</usr/local/lib.. list of libraries>
exec </usr/local/bin/<progname>
The main advantage the "LD_PRELOAD" has is that it specifies a path to load libraries from before it uses the normal system provided libraries.

The advantage of using the wrapper is that you don't necessarily want LD_PRELOAD turned on everywhere as that can cause problems running python scripts that don't use those libraries...

The only reason the "exec" command is there is just to chain directly to the executable you want. When the command terminates the LD_PRELOAD is no longer defined.

You can look in the man page for ld.so for more details. You may even be able to use LD_LIBRARY_PATH (which only needs the directory name). The reason I'm not certain of that is that it will mix other library searches as well which may confuse things. LD_PRELOAD explicitly designates the libraries to be loaded before looking in the normal places.

Thanks, I managed to get it all working... But now I need to rebuild things like numpy, gobject, yum... And I'm stuck at yum. I recompiled it from src.rpm and installed it but now I get "no module rpm". rpm-python is installed and reinstalling it says
Quote:
error: Failed dependencies:
libpython2.7.so.1.0()(64bit) is needed by rpm-python-4.9.0-9.fc15.x86_64
python(abi) = 2.7 is needed by rpm-python-4.9.0-9.fc15.x86_64
but python is working and is at /usr/local/lib which is in LD_LIBRARY_PATH.

How to make rpm "aware" of installed python manually?
Reply With Quote
Reply

Tags
python, replacing, scons, tweaking, unicode

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
tweaking MTU for NFS tomislavski Servers & Networking 0 4th December 2010 05:38 PM
scons wont recognise gtk+ 2.6 LaKing Using Fedora 3 26th August 2006 01:24 PM
Tweaking FC5 complete-noobie EOL (End Of Life) Versions 1 17th June 2006 06:22 PM
How do I use scons in RPM SPEC files? SHtRO Using Fedora 3 10th May 2006 07:27 PM
Processing Conflict: python-devel conflicts python< 2.3.4-13.1 guarriman Using Fedora 0 15th September 2005 05:53 PM


Current GMT-time: 13:33 (Saturday, 18-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat