Tuesday, August 16, 2011

Making self-contained Unix programs with CDE



In the old days you could statically link your program and run it on another Unix station without worrying about dependencies. Unfortunately static linking no longer works, so you need to make sure that your target platform has the right libraries.

For instance, in order to get Matlab compiled code running on a server, you have to copy over libraries and set environment variables as specified in Matlab's guide, followed by some investigative work to take care of dependencies and version conflicts not covered by Mathworks documentation.

Another example is when if you want to create a self-contained Scipy/Python environment that you could just copy over and use without needing to run configure and make.

For both cases Philip Guo's CDE tool comes helpful. It analyzes your program to find dependencies and makes a package with all the dependencies included. Then it runs the program through a kind of lightweight virtualization, intercepting program calls to trick it into thinking it's running in the original environment.

For instance, here's how you could make a self-contained environment for Python and Scipy:


cd /temp
git clone git://github.com/pgbovine/CDE.git
cd CDE
make
cd ..
CDE/cde python -c "from scipy import *; print zeros(15)"
tar -cf package.tar cde-package


This makes a 26 MB file that includes that all files that were read during execution of that command.
Now you can move it to another machine that doesn't have scipy, prepare the environment and try it out as follows

tar -xf package.tar
cd cde-package/cde-root/temp
../../cde-exec python -c "from scipy import *; print ones(15)"


This will work even if machine doesn't have Python installed, or has the wrong version of shared libraries installed, because cde-exec is reproducing the environment of the original machine. It works for anything that doesn't need files other than the ones accessed during package creation.

For instance, you could start an interactive Python session and run some SciPy examples like this


cde cde-package/cde-root
../cde-exec python
>>> from scipy import *
>>> ....


You could give your containerized program access to host system by creating symlink to the outside in cde-root

9 comments:

Anonymous said...

nice blogs about financial accounting at The Basic Financial training in bangalore

katetech said...

Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site.
internship companies in kphb
apply for internship in kphb

Anonymous said...


Hello, o you know that the best way to boost your brain is
visiting or contacting us


https://weiiitrading.com/our-products/moonrock-carts/buy-empty-moonrock-clear-vape-cartridges-blue-carts-dr-zodiak-atomizers-with-flavor-box-packaging/

https://weiiitrading.com/our-products/heavy-hitters-carts/buy-wholesale-new-heavy-hitter-vape-cartridges-1-0ml-ceramic-coil-empty-tank-carts-510-thread-thick-oil-atomizer/

https://weiiitrading.com/our-products/juul-carts/buy-hot-empty-ceramic-pod-disassembled-cartridges-0-7ml-1-0ml-vape-pod-carts-for-vape-juul-vape-pen-start-kit-top-quality/

https://weiiitrading.com/our-products/mario-carts/buy-peaches-and-dream/

https://weiiitrading.com/our-products/heavy-hitters-carts/buy-bubba-kush-cartridge-2-2g/

https://weiiitrading.com/our-products/mario-carts/buy-thin-mint-cookies/



Pila Brass Knuckles Online for sale online,

where to buy Buy Pila Brass Knuckles Online

buy valley online cartridge

buy space candy online

buy cannabis syrup online

buy botox online

cannabis bread

uk chese

47 dank vapewhite fire og

buy moonrock



Email Us

Contact: +1 619-537-6734

Anonymous said...


Hello, o you know that the best way to boost your brain is
visiting or contacting us


https://weiiitrading.com/our-products/moonrock-carts/buy-empty-moonrock-clear-vape-cartridges-blue-carts-dr-zodiak-atomizers-with-flavor-box-packaging/

https://weiiitrading.com/our-products/heavy-hitters-carts/buy-wholesale-new-heavy-hitter-vape-cartridges-1-0ml-ceramic-coil-empty-tank-carts-510-thread-thick-oil-atomizer/

https://weiiitrading.com/our-products/juul-carts/buy-hot-empty-ceramic-pod-disassembled-cartridges-0-7ml-1-0ml-vape-pod-carts-for-vape-juul-vape-pen-start-kit-top-quality/

https://weiiitrading.com/our-products/mario-carts/buy-peaches-and-dream/

https://weiiitrading.com/our-products/heavy-hitters-carts/buy-bubba-kush-cartridge-2-2g/

https://weiiitrading.com/our-products/mario-carts/buy-thin-mint-cookies/



Pila Brass Knuckles Online for sale online,

where to buy Buy Pila Brass Knuckles Online

buy valley online cartridge

buy space candy online

buy cannabis syrup online

buy botox online

cannabis bread

uk chese

47 dank vapewhite fire og

buy moonrock



Email Us

Contact: +1 619-537-6734

Techno Globe said...


Really great info you provided here.
Thank You
Machine Learning Training in jaipur
Artificial Intelligence Training in Jaipur

Deekshitha said...

Informative blog

best digital marketing institute in hyderabad

traininginstitute said...

Your work is very good and I appreciate you and hopping for some more informative posts
data scientist training in malaysia

Jack Dowson said...

Bitcoin's notoriety is quickly developing. From a little more than 100 everyday exchanges during its most memorable year of activity, there are presently as of now around 300,000 day to day Bitcoin exchanges. What's significantly more breathtaking is that its market cost: from under a dollar for each bitcoin in 2010, a solitary bitcoin now costs north of 7,000 USD, and this sum keeps on becoming constantly. This shows exactly how enormous the interest for bitcoins is currently, and this request simply continues to develop.

In spite of negativity about the unpredictability of digital forms of money, bitcoins have kept on taking off over the rest. It is assessed that more than 17,670,750 bitcoins exist today. Notwithstanding, this number increments 10 minutes as a normal of 144 blocks are mined everyday and each block contains 12.5 Bitcoins. This brings the all out normal of 1,800 new bitcoins each day. Of late, excavators have moved forward the hash power. Accordingly, the completion time of finding new blocks has been diminished from 10 minutes to 9.5 which implies the typical number of new Bitcoins could be more than 1,800>> bitcoin developer

Uposing said...

My sister informed me about your post. when I saw it So I loved it. Let me also share with you that another great advantage of phrase checker is that it eliminates even those small mistakes which may be difficult to detect. It comprehensively checks for spelling mistakes and grammatical errors. This tool also fixes commonly confused words.