SlideShare a Scribd company logo
Tribute to rvm




                               Introducing cvm
                 The best way to manage your C++ applications dependencies



                                                                 Offirmo, 18/01/2013
cvm
C++ Version Manager


  a tool
      to automatically manage
        your C++ application's dependencies
Once upon a time…

…there was a programmer…



…who was developping an honest C++
application…
His C++ app was not standalone…


His app was based on a C++ lib called :


He was using                          of course.


He was also unit-testing using : UnitTest++


…and using cmake to build. (and gcc of course)
One day, the app got (somewhat) ready to go in
production.


         The programmer set up a clean linux
box
          and began installing his app…
          (Note : it's a server app)




   Then the troubles arrived...
● Ubuntu 10.04 LTS (at that time, and make a better example ;)
● Clean, no packages installed

● Current situation :
● My app : git clone https://github.com/abcd/xyz
  ● So I need git : sudo apt-get install git

● Need gcc & co. : sudo apt-get install build-essentials

● Need wt : sudo apt-get install witty witty-dbg witty-

dev
● Need Boost : sudo apt-get install libboost-dev
● Nedd UnitTest++, which has no packet :

    wget …
    make     (yes, it's a very simple lib)
● Need cmake : sudo             apt-get install cmake
● Let's compile :

    cmake ../xyz
    make

                 Fail !!!
●First cmake can't find UnitTest++ that I installed
manually in a custom dir, so :
     export … (have fun with pathes)
●Then cmake of Ubuntu 10.04 is too old for my
app, I need to install latest from source :
     wget …
     ./bootstrap --prefix="…"
     make                                       Pain !!!
     make install
●   Default Wt is also too old :               Pain!!!
     git clone …
     cmake ../… -PREFIX … -DCONFIGDIR …
     make
                                               Fail !!!
     make install
     --> but FAIL because Boost is too old !
●   So for Boost :
      ...
            Well, you get it…
Pain ! Fail ! %$# !
 Completely value-less task !
Utter loss of time and energy !
Unworthy of us programmers !
proposed solution : the cvm tool
sudo apt-get install git
git clone git://github.com/Offirmo/cvm.git
                                   cvm
(add cvm/bin to the path)
     cvm
git clone git://github.com/abcd/myapp.git
                                myapp

cvm new myapp

cd myapp
cvm set_compfile   Installation of
cvm update
cvm upgrade
                   dependencies
                                            Done !
mkdir ../build
cd ../build
                                App build
cvm_exec cmake ../myapp
cvm_exec make
The magic…
●   The app provides a «component file» listing its
    dependencies :
    (simplified)
    # As far as I know, no particular gcc version is required
    require compiler.gcc
    require lib.std

    # need a recent version
    require lib.UnitTest++, version : 1.4+

    # need a recent version
    require lib.Boost,      version : 1.51+

    # need a recent version
    require lib.Wt,         version : 3.2.3
The magic…
●   Then cvm automatically setup the environment
    so that all dependencies are met !

    cvm set_compfile         Set the « component file »
    cvm update
                             compute dependencies
    cvm upgrade              (who needs what, which
                             version)

                            Install everything needed :
                             - use apt-get if possible
                             - download and build from
                            source else
The magic…
●   Of course, cvm must know about the
    components :
    ●   corresponding apt packets
    ●   download url
    ●   how to build them
    ●   ...
●   So cvm has a database of components
Does it ring a bell ?
●   Other languages have such a tool for a while
    ●   ex. ruby "bundler" http://gembundler.com/




●   It's a shame that C++ still didn't have it !
    ●   Fixed ;)
More awesomness...
●   cvm installs everything in user-land
    ●   No need to be admin (except for apt-get install)
●   cvm doesn't mess with the env vars
    ●   set them on demand, hence the cvm_exec wrapper
●   cvm can ensure exact components versions
    ●   Perfect for production environment
●   cvm can maintain separate sets of components
    ●   So you can have different versions of the
        components for different apps/versions
More awesomness...
●   cvm has more nice features
    ●   Not listed here for brievity, see «bonuses»
●   cvm is easy to install
    ●   Just bash scripts !
●   cvm is totally free
    ●   Copyfree license, do whatever you want with it !
Current status
● cvm works (at last for me on my machine ;)
● It is still rough :


  ● compfile syntax still in progress


  ● multi-users usage needs to be enhanced


  ● only 16 components at this time (jan-2013)


    ● But easy to add some !


  ● Code and architecture would benefit from a little

    cleanup to ease contributions
● Comments and suggestions are welcomed !


● Fork me on github ! (doc on internals coming soon)
One more thing...
●   Why c.v.m. ?
    ●   Because of rvm (ruby version manager) https://rvm.io/




●   Like rvm, cvm is meant to play with multiple
    compilers : gcc 4.7 (for C++11), clang...
    ●   This feature is not available yet (jan-2013)
Thank you !


https://github.com/Offirmo/cvm
Bonuses
Dependencies handling
Of course, cvm computes dependencies recursively and
resolves them.

Example 1 :
 My app --> Boost 1.49+
 My app --> Wt 3.2.3 --> Boost 1.41+
   --> Latest known Boost newer or equal to 1.49 will be
installed

Example 2 :
My app --> Boost 1.40      (exact version)
My app --> Wt 3.2.3 --> Boost 1.41+
  --> Error ! cvm can't resolve those conflicting requests
The real dependency graph of my app is :



                             The orange parts
                             are non-trivial to
                             install on my target
                             OS (no correct
                             packet)

                             While developping,
                             I installed
                             everything by hand
                             when needed. Then
                             I forgot about it...
The corresponding compfile is…
##   C++ VM component set definition
##   see https://github.com/Offirmo/cvm
##
##   Thanks to this file and the C++VM tool,
##   all exact dependencies are installed.

cvm_minimum_required_version 1.0

# As far as I know, no particular gcc version is required
require compiler.gcc
require lib.std

require lib.UnitTest++, version : 1.4+

# need a recent version
require lib.Boost,      version : 1.51+

# sqlite is an optional   dependency of Wt. We want a decent version
for some bugfixes
require lib.sqlite,       version : 3.7+
# exact version of Wt +   ensure that sqlite is built before
require lib.Wt,           version : 3.2.3, require : lib.sqlite
Additional features
● cvm automatically set env vars needed by
autotools and cmake, so they correctly find the
manually installed libs (over the system one)
● cvm can automatically detect headers for libs

that don't provide a «make install»
● cvm automatically creates a folder with all

headers so you can provide it to your IDE code
indexer (ex. Eclipse)
● cvm try to save resources by caching common

resources : downloaded archives and source
code (src not duplicated if out-of-src build is
available)
Links :
● https://rvm.io/

● http://gembundler.com/




S/O
● http://stackoverflow.com/q/14263324/587407

● http://stackoverflow.com/q/1827705/587407




Image credits :
● http://tecfa.unige.ch/tecfa/teaching/UVLibre/0001/bin17/troubles.html

● wikipedia

More Related Content

What's hot (20)

PPT
scaling compiled applications - highload 2013
ice799
 
PPTX
Rusty Python
RangHo Lee
 
PPT
Porting and Maintaining your C++ Game on Android without losing your mind
BeMyApp
 
PDF
Vagrant for Virtualized Development
Adam Culp
 
PPTX
Short intro to project butter
Yoshi Shih-Chieh Huang
 
PDF
Introduction to Vagrant
Marcelo Pinheiro
 
PDF
Panther loves Symfony apps
Simone D'Amico
 
PDF
Vagrant are you still develop in a non-virtual environment-
Anatoly Bubenkov
 
PPTX
Debugging Ruby (with Pry)
LukeBergen
 
ODP
Debugging Rails 3 Applications
Nathan Broadbent
 
PPTX
Vagrant
Akshay Siwal
 
PPT
Ruby application based on http
Richard Huang
 
PDF
Vagrant for real
Michele Orselli
 
PPT
Subversion @ JUG Milano 11 dic 2009
Andrea Francia
 
PDF
Gearman: A Job Server made for Scale
Mike Willbanks
 
PPTX
Vagrant
Evans Ye
 
PDF
Inner Symfony’s Daemons
Krzysztof (Chris) Ozog
 
PPTX
Performance tips for Symfony2 & PHP
Max Romanovsky
 
PDF
Cucumber.js: Cuke up your JavaScript!
Julien Biezemans
 
PDF
Learn Puppet : Quest Guide for the Learning VM
Kumaran Balachandran
 
scaling compiled applications - highload 2013
ice799
 
Rusty Python
RangHo Lee
 
Porting and Maintaining your C++ Game on Android without losing your mind
BeMyApp
 
Vagrant for Virtualized Development
Adam Culp
 
Short intro to project butter
Yoshi Shih-Chieh Huang
 
Introduction to Vagrant
Marcelo Pinheiro
 
Panther loves Symfony apps
Simone D'Amico
 
Vagrant are you still develop in a non-virtual environment-
Anatoly Bubenkov
 
Debugging Ruby (with Pry)
LukeBergen
 
Debugging Rails 3 Applications
Nathan Broadbent
 
Vagrant
Akshay Siwal
 
Ruby application based on http
Richard Huang
 
Vagrant for real
Michele Orselli
 
Subversion @ JUG Milano 11 dic 2009
Andrea Francia
 
Gearman: A Job Server made for Scale
Mike Willbanks
 
Vagrant
Evans Ye
 
Inner Symfony’s Daemons
Krzysztof (Chris) Ozog
 
Performance tips for Symfony2 & PHP
Max Romanovsky
 
Cucumber.js: Cuke up your JavaScript!
Julien Biezemans
 
Learn Puppet : Quest Guide for the Learning VM
Kumaran Balachandran
 

Similar to Introducing cvm... (20)

PDF
Gitlab - Creating C++ applications with Gitlab CI
Uilian Ries
 
PDF
PVS-Studio in the Clouds: CircleCI
Andrey Karpov
 
PDF
Cmake kitware
achintyalte
 
PDF
Dependencies Managers in C/C++. Using stdcpp 2014
biicode
 
PDF
Php on Windows
Elizabeth Smith
 
PDF
Tracing Software Build Processes to Uncover License Compliance Inconsistencies
Shane McIntosh
 
PDF
CMake: Improving Software Quality and Process
Marcus Hanwell
 
PDF
Kitware: Qt and Scientific Computing
account inactive
 
PDF
Ignite Devops Fast Moving Software
SpamapS
 
PDF
Packaging is the Worst Way to Distribute Software, Except for Everything Else
mckern
 
PPTX
Autotools pratical training
Thierry Gayet
 
PPTX
Getting started with open cv in raspberry pi
Jayaprakash Nagaruru
 
PPTX
Aleksandr Kutsan "Managing Dependencies in C++"
LogeekNightUkraine
 
PDF
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
Edge AI and Vision Alliance
 
PDF
Installing OpenCV 2.3.1 with Qt
Luigi De Russis
 
PPTX
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
Ciklum Ukraine
 
PDF
Installing OpenCV 2.4.x with Qt
Luigi De Russis
 
PDF
OpenCV Workshop
Lentin Joseph
 
PDF
cmake.pdf
Thejeswara Reddy
 
PDF
Gnubs pres-foss-cdac-sem
Sagun Baijal
 
Gitlab - Creating C++ applications with Gitlab CI
Uilian Ries
 
PVS-Studio in the Clouds: CircleCI
Andrey Karpov
 
Cmake kitware
achintyalte
 
Dependencies Managers in C/C++. Using stdcpp 2014
biicode
 
Php on Windows
Elizabeth Smith
 
Tracing Software Build Processes to Uncover License Compliance Inconsistencies
Shane McIntosh
 
CMake: Improving Software Quality and Process
Marcus Hanwell
 
Kitware: Qt and Scientific Computing
account inactive
 
Ignite Devops Fast Moving Software
SpamapS
 
Packaging is the Worst Way to Distribute Software, Except for Everything Else
mckern
 
Autotools pratical training
Thierry Gayet
 
Getting started with open cv in raspberry pi
Jayaprakash Nagaruru
 
Aleksandr Kutsan "Managing Dependencies in C++"
LogeekNightUkraine
 
"The OpenCV Open Source Computer Vision Library: Latest Developments," a Pres...
Edge AI and Vision Alliance
 
Installing OpenCV 2.3.1 with Qt
Luigi De Russis
 
CiklumCPPSat: Alexey Podoba "Automatic assembly. Cmake"
Ciklum Ukraine
 
Installing OpenCV 2.4.x with Qt
Luigi De Russis
 
OpenCV Workshop
Lentin Joseph
 
cmake.pdf
Thejeswara Reddy
 
Gnubs pres-foss-cdac-sem
Sagun Baijal
 
Ad

Recently uploaded (20)

PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Biography of Daniel Podor.pdf
Daniel Podor
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Ad

Introducing cvm...

  • 1. Tribute to rvm Introducing cvm The best way to manage your C++ applications dependencies Offirmo, 18/01/2013
  • 2. cvm C++ Version Manager a tool to automatically manage your C++ application's dependencies
  • 3. Once upon a time… …there was a programmer… …who was developping an honest C++ application…
  • 4. His C++ app was not standalone… His app was based on a C++ lib called : He was using of course. He was also unit-testing using : UnitTest++ …and using cmake to build. (and gcc of course)
  • 5. One day, the app got (somewhat) ready to go in production. The programmer set up a clean linux box and began installing his app… (Note : it's a server app) Then the troubles arrived...
  • 6. ● Ubuntu 10.04 LTS (at that time, and make a better example ;) ● Clean, no packages installed ● Current situation :
  • 7. ● My app : git clone https://github.com/abcd/xyz ● So I need git : sudo apt-get install git ● Need gcc & co. : sudo apt-get install build-essentials ● Need wt : sudo apt-get install witty witty-dbg witty- dev ● Need Boost : sudo apt-get install libboost-dev ● Nedd UnitTest++, which has no packet : wget … make (yes, it's a very simple lib) ● Need cmake : sudo apt-get install cmake ● Let's compile : cmake ../xyz make Fail !!!
  • 8. ●First cmake can't find UnitTest++ that I installed manually in a custom dir, so : export … (have fun with pathes) ●Then cmake of Ubuntu 10.04 is too old for my app, I need to install latest from source : wget … ./bootstrap --prefix="…" make Pain !!! make install ● Default Wt is also too old : Pain!!! git clone … cmake ../… -PREFIX … -DCONFIGDIR … make Fail !!! make install --> but FAIL because Boost is too old ! ● So for Boost : ... Well, you get it…
  • 9. Pain ! Fail ! %$# ! Completely value-less task ! Utter loss of time and energy ! Unworthy of us programmers !
  • 10. proposed solution : the cvm tool sudo apt-get install git git clone git://github.com/Offirmo/cvm.git cvm (add cvm/bin to the path) cvm git clone git://github.com/abcd/myapp.git myapp cvm new myapp cd myapp cvm set_compfile Installation of cvm update cvm upgrade dependencies Done ! mkdir ../build cd ../build App build cvm_exec cmake ../myapp cvm_exec make
  • 11. The magic… ● The app provides a «component file» listing its dependencies : (simplified) # As far as I know, no particular gcc version is required require compiler.gcc require lib.std # need a recent version require lib.UnitTest++, version : 1.4+ # need a recent version require lib.Boost, version : 1.51+ # need a recent version require lib.Wt, version : 3.2.3
  • 12. The magic… ● Then cvm automatically setup the environment so that all dependencies are met ! cvm set_compfile Set the « component file » cvm update compute dependencies cvm upgrade (who needs what, which version) Install everything needed : - use apt-get if possible - download and build from source else
  • 13. The magic… ● Of course, cvm must know about the components : ● corresponding apt packets ● download url ● how to build them ● ... ● So cvm has a database of components
  • 14. Does it ring a bell ? ● Other languages have such a tool for a while ● ex. ruby "bundler" http://gembundler.com/ ● It's a shame that C++ still didn't have it ! ● Fixed ;)
  • 15. More awesomness... ● cvm installs everything in user-land ● No need to be admin (except for apt-get install) ● cvm doesn't mess with the env vars ● set them on demand, hence the cvm_exec wrapper ● cvm can ensure exact components versions ● Perfect for production environment ● cvm can maintain separate sets of components ● So you can have different versions of the components for different apps/versions
  • 16. More awesomness... ● cvm has more nice features ● Not listed here for brievity, see «bonuses» ● cvm is easy to install ● Just bash scripts ! ● cvm is totally free ● Copyfree license, do whatever you want with it !
  • 17. Current status ● cvm works (at last for me on my machine ;) ● It is still rough : ● compfile syntax still in progress ● multi-users usage needs to be enhanced ● only 16 components at this time (jan-2013) ● But easy to add some ! ● Code and architecture would benefit from a little cleanup to ease contributions ● Comments and suggestions are welcomed ! ● Fork me on github ! (doc on internals coming soon)
  • 18. One more thing... ● Why c.v.m. ? ● Because of rvm (ruby version manager) https://rvm.io/ ● Like rvm, cvm is meant to play with multiple compilers : gcc 4.7 (for C++11), clang... ● This feature is not available yet (jan-2013)
  • 21. Dependencies handling Of course, cvm computes dependencies recursively and resolves them. Example 1 : My app --> Boost 1.49+ My app --> Wt 3.2.3 --> Boost 1.41+ --> Latest known Boost newer or equal to 1.49 will be installed Example 2 : My app --> Boost 1.40 (exact version) My app --> Wt 3.2.3 --> Boost 1.41+ --> Error ! cvm can't resolve those conflicting requests
  • 22. The real dependency graph of my app is : The orange parts are non-trivial to install on my target OS (no correct packet) While developping, I installed everything by hand when needed. Then I forgot about it...
  • 23. The corresponding compfile is… ## C++ VM component set definition ## see https://github.com/Offirmo/cvm ## ## Thanks to this file and the C++VM tool, ## all exact dependencies are installed. cvm_minimum_required_version 1.0 # As far as I know, no particular gcc version is required require compiler.gcc require lib.std require lib.UnitTest++, version : 1.4+ # need a recent version require lib.Boost, version : 1.51+ # sqlite is an optional dependency of Wt. We want a decent version for some bugfixes require lib.sqlite, version : 3.7+ # exact version of Wt + ensure that sqlite is built before require lib.Wt, version : 3.2.3, require : lib.sqlite
  • 24. Additional features ● cvm automatically set env vars needed by autotools and cmake, so they correctly find the manually installed libs (over the system one) ● cvm can automatically detect headers for libs that don't provide a «make install» ● cvm automatically creates a folder with all headers so you can provide it to your IDE code indexer (ex. Eclipse) ● cvm try to save resources by caching common resources : downloaded archives and source code (src not duplicated if out-of-src build is available)
  • 25. Links : ● https://rvm.io/ ● http://gembundler.com/ S/O ● http://stackoverflow.com/q/14263324/587407 ● http://stackoverflow.com/q/1827705/587407 Image credits : ● http://tecfa.unige.ch/tecfa/teaching/UVLibre/0001/bin17/troubles.html ● wikipedia