Modern C/C++ for a DevOps Workflow

Speaker: Hamza Zaoui, Solutions Engineer @JFrog

March 26, 2019

< 1 min read

MODERN C/C++ FOR A DEVOPS WORKFLOW
Please register for this webinar below.
Webinar description:
This webinar will introduce the basic tools and a complete Devops workflow for C and C++ languages.
During this webinar we will cover:
– Using automatic tests. Installing testing frameworks from conan packages, injecting and using them to test your packages while building them.
– Reproducible and automatic build environments: Creating packages for developer tools.
– Creating package binaries in Continuous Integration. Public, cloud services: travis-ci and appveyor.
– Managing and creating multiple package configurations with conan-package-tools and CI.
– Jenkins integration and Artifactory plugin support for conan package manager.
– Generation and usage of build-information in Artifactory.Who should attend:
C/C++ developers and those who work with C/C++ packages.

Speakers

Hamza Zaoui

    Hamza Zaoui

    Solutions Engineer at JFrog

    Hamza Zaoui is a Solution Engineer at JFrog, the creator of Artifactory, which is used by millions of developers worldwide. His main focus is easing the life of developers through processes of automation using JFrog products. Hamza has a vast experience in the field of cloud-native applications and PaaS solutions.

    Video Transcript

    my name is AMSA I’m solution engineer
    from and I’m here today with you to to
    see exactly how we can make your C C++
    build process is going faster using : as
    a package manager for those libraries we
    also going to see some examples of cic
    modern C sed processes involving you
    know C C++ libraries but you know manage
    with Kona
    as a package at this package manager and
    then we also leave some we’ll leave some
    time at the end to answer your questions
    but let’s start from the beginning and
    see exactly what kind of problems C C++
    developers usually have and it’s quite a
    paradox because those libraries is you
    know those C C++ libraries our basil on
    one of the most major languages out
    there that you know gives very high
    machine performance and perform very
    fast calculation faster than any other
    languages on the industry and you know
    that’s one of the reasons to be
    involving a lot of high-tech devices
    related for example to voice recognition
    to self-driving cars to astronomical
    calculations so a lot of very modern and
    very cool stuff
    but you know in terms of build processes
    in terms of CIT
    when it comes to building those C C++
    libraries it how it has always been like
    this okay like you know a very archaic
    very old fashioned building approach it
    hasn’t changed you know for many years
    it has been a you know
    quite quite a pain in the ass you know
    you know for for C C++ developers with
    the long compilation time a nightmare to
    manage you know all those libraries to
    compile any different kind of platforms
    and so on okay and this is
    exactly for that reason that Conan was
    invented is to find is to provide you
    with the solution to go faster and like
    any other package managers it’s you know
    more more is the same logic okay so the
    idea is to build once your libraries and
    to use them many times to reuse them and
    for that okay you will you know speed up
    your build processes by having those
    libraries somewhere in some repositories
    and fetching them out whenever you need
    them
    it could also allow you to recompile the
    same libraries over and over again with
    you know very highly risk to compile
    firms discs on those components on the
    the wrong platform and that will in fact
    control compromised you know your
    projection environments at the end those
    occasions we know especially with kernel
    here we are talking about you know
    binaries and those binaries of course
    shouldn’t be stolen this was control so
    we need we need in fact to have some
    kind of local repositories and to host
    those packages and to manage their
    lifestyle the main challenges and you
    know every C C++ developers know about
    that is that and it’s about you know
    managing huge huge project involving
    million lines of code and we’re of
    course very slow bills at the end
    because you know everything is usually
    rebuilt from scratch from the entire
    source code of your application but here
    you know with in terms of package
    management we need in fact to manage you
    know all of those dependencies
    transitive dependencies to manage the
    compatibility across you know a
    different platform because you know
    those libraries are really tied to the
    platform to the US they were created for
    they also died
    to the build system depending if you are
    using see make visual studio so we need
    in fact to find a way to have across a
    true cross platform process that we’ll
    be able to walk with any built system
    okay so in terms of dependencies we have
    for example an application that has a
    library this library realize and request
    the cocoa library that in terms requires
    the OpenSSL library and this is exactly
    in that situation that things get a
    little bit complicated is that you know
    this OpenSSL library will depending on
    the platform where the computation would
    be done it will either depend on that
    lip on a linux machine or on some other
    libraries if we are compiling our
    software being a software in in a
    Windows environment so a few words about
    you know this
    Coenen package manager so first it’s
    fully portable it can run on any any
    kind of environment and architecture
    it’s full open-source to this written
    down under MIT license you can check out
    the source code if you want you can
    contribute and in terms of architecture
    it’s it has been designed around a
    client-server architecture concept
    meaning you that you can fetch packages
    from different remote servers exactly
    the way that you could do you know with
    your source code manage with get running
    the client itself the client is here in
    fact manager logic for package creation
    in consumption okay so in Conan we have
    this concept of package metadata manager
    you know through quite simple Python
    script and in those Python script you
    just describe what dependencies are
    linked to your binary based on the
    source code and define also the
    different stages because you know to
    bran and
    by your libraries instead of directly
    interacting with the build system Conan
    will be like not strictly on top of it
    and will you know get some information
    about those package metadata to see
    exactly what type of library should be
    fetch out of the of the binary
    personally manager and what open-source
    libraries are going to be in it to be
    used so and this so we have you know
    this client and then the server would be
    hosting the binaries and it can live
    under various forms so by default
    current will be with the connect
    server – who’s the can that can be used
    to host those binaries but you can also
    you know use adds fact we have we’ve got
    Community Edition for that to provide
    you with some C C++ and current ripple
    stories now you can also use beans wave
    the end goal for you is to make your
    packages available on the cloud for
    public or private distribution whatever
    you want ok so there are basically
    different options for that
    Coenen Santa so Conan Santa is the one
    of the major of C C++ public
    repositories that you can contribute to
    implement and it’s like basically it’s
    like the Center for you know useful for
    pencils made in life
    yes so now it’s time to jump into a demo
    okay so for that I’m going to use a very
    simple example to build you know some
    piece of code based on some existing
    precompiled libraries okay so for that
    I’m going to just fetch some source code
    from from this current community github
    repo okay and so first let me remove
    this okay add okay so we have this
    project sorry okay so let me describe
    what we have here once we have a very
    simple program okay
    and that relies on the PACU library for
    calculating the md5 of a string okay
    so but in order to build this conference
    I’m not going to you know compile you
    know everything from scratch I’m going
    to use an existing poco library that is
    going to be provided by Colonel Center
    in terms of in order you know now to
    define what dependencies I will need
    okay everything would have to be
    described here in this text file ok so
    this project requests this cocoa library
    and I’m going in fact to use my
    summation trick what else we have this
    image file list okay so here we are
    going as you can see we’re all going to
    have some specific include related to
    common between for Simek and that will
    be used and afterwards by my gmail
    generator
    so let’s try to build sorry trust me to
    create my okay now let’s try to first
    fetch out the library that I need to
    build my compound so here we can see
    that okay my component was not found in
    my local cache and here my current
    client connected to to my current server
    try to get my package from from from the
    official command center but what I see
    that we have also some other libraries
    so we have OpenSSL we have said that
    clip okay let’s let’s see what we’ve got
    okay yeah indeed we have now three
    libraries okay so it’s just now that I
    see that cannon automatically retrieve
    you know those those transitive
    dependencies and if I want I can
    eventually get some more information
    about my package so here for example let
    me see Conan Conan info and here I can
    see basically the whole Mack okay so my
    Paco library requires open the OpenSSL
    [Music]
    and
    my jet nib is required by OpenSSL okay
    Sam and my OpenSSL is required my my
    poco and my said okay so here we have
    you know three different libraries
    depending on each other but what if you
    know but we have you know hundreds of
    thousands of libraries in a project how
    could I get you know double-double man
    so there’s something you know very
    simple is to use basically the same
    command adds as previously current info
    okay and here very simply just to build
    an html5 little craft
    okay so let’s see what we will cut here
    okay so simple HTTP server let me know
    and now let’s go there okay so here
    basically you can see you know you can
    visually check this component graph so
    by seeing what are the libraries
    required by directly by your project and
    then twisting one by one all the
    transitive depends so quite useful
    indeed
    let’s quickly go back to our environment
    okay and now let’s try to build my
    project okay so here by the way you can
    also get some more information by
    searching one particle library if you
    want okay so I can you know select this
    one okay and get more information about
    all the settings like the compiler the
    build type the architecture and so on
    and see also by the way also all the
    required let’s try to build this
    application okay so here I’m going to
    run my Simic
    take this okay and now let’s finish that
    you
    and here I should be able to find
    basically my and default okay library so
    everything now is is okay but we I
    haven’t finished here because as we saw
    previously the deadly be opened up an
    assassin in the pooka libraries were
    retrieve from the Canon Santa which is
    you know a public crippled state but
    what if I mean in fact so that that’s
    not the best option if I want to speed
    up my bit processor because if I need to
    retrieve hundreds or thousands of
    libraries each time that I’m running a
    bit process so first I’m not going to
    consume you know all these men wave and
    also to depend on on the on the public
    good poster so I mean in fact to who’s
    my package is someone so here I am going
    simply to upload them into the quarry
    Foster and I’m going for that to use
    artifact oh okay so if you are
    interested you can you know download the
    community edition of it otherwise here
    this one is the is the the professional
    version which is you know Universal
    supporting you know not only Conan but
    you know various packages this is you
    know one of the main advantage of the
    advantages of the of the the pro edition
    but I’m going in fact you to publish
    those packages into this current will be
    now the poster but for that I need to
    configure my economic like so let’s see
    what are the end points okay connected
    to my current client okay so I have my
    Conan Center in order to push something
    to push my cash packages into artifact
    go into that local repository
    I first need in fact you added to my
    client configuration okay so for that
    you can simply use this set me up button
    oh okay sorry for that I need to reload
    myself okay it’s better now
    okay so set me a button again okay
    just need to basically run this command
    Conan remote ad then just give a label
    and then URL to this local poster okay
    so let’s do it this one I’m just going
    to copy this you are because this is you
    know the most important okay and here
    I’m just going back to to add my Conan
    remote I’m going to have to name it my
    unstruck doing okay and just give you so
    now if I just look at my remote this
    okay now I have my command center and my
    artifact or which is in fact is not the
    best situation because it means that if
    I need to get any any package when
    running you can install the package will
    be first release from command center and
    if it’s not in command center which will
    my cannon will then join check my local
    repository which is not exactly not the
    right logic because I always should
    always look first in my local
    environment my own ecosystem before
    getting the package from the outside if
    I don’t have it local
    okay so for I’m going to just correct
    that thing
    okay by removing
    this my artifact oh okay I need to add
    it remote and then to add it this time
    to the first position remote least now
    it’s it’s it’s much better because I
    have it in the first position it will be
    the first a resolution and now let’s try
    to upload my packages into into artifact
    oh okay so I’m just going to try to
    upload hey can I see oh and then I’m
    going just to specify the remote which
    is my
    yeah so here you have a confirmation if
    you don’t want to bother yourself you
    know with those confirmations especially
    if you have you know tons of packages to
    upload okay just can just confirm okay
    and those packages then will be sent to
    to ask fractal okay so the upload is in
    process
    sting going on okay and now if I quickly
    go back to its factory I should be able
    in fact to see those packages posted in
    this local repository okay so you have
    you know for any any type of packaging
    artifact to will there’s a default
    metadata calculation okay where you know
    you can see the name of the package the
    version use and so on and you can either
    if you want even if you want you know
    correct you can add some properties okay
    just to reflect the maturity you know
    even if you know the metric itself is
    usually a part of the the of the package
    description okay and the package
    terminology because a package a Content
    package is you know usually the library
    okay the name of the library the version
    then the owner and then the maturity so
    it could be testing it could be stable
    whatever you want is the channel okay if
    you if you okay so now that I have those
    libraries in inspector if I have any
    other processes consuming those
    libraries the easiest way is just to you
    know for that process to have its client
    configure not to be directly connected
    to command center but I yeah to be
    connected to command center but in the
    second position so the first provider
    the main source of truth should be my
    not my local cache because the cache is
    always a ephemeral but more attractive
    okay so yeah so now we are going in fact
    to have a look at a second example is
    how in fact to create a Content package
    so for all I’m going to create just a
    for dog say my package
    and to create to initialize a new
    version of my of my qualification I’m
    going to just run Canon new and I will
    name it
    for example yeah my package and just
    give it a virtual ok so this operation
    just created a current file for me that
    I have here ok so in this this is
    basically cannon recipe so this is
    exactly that file that determines you
    know all the all the parameters and all
    the metadata related to my to my package
    file the package name package version
    this is exactly where I would put the
    license the author the URL of my git
    repository the description the topic
    topics and the settings so here this
    those settings are really important
    because this is exactly what will
    determine the package binary that would
    be associated with the global package
    because you know the conan and i’m going
    to show you that a current package is I
    would say a wrapper okay and underneath
    within this content package I can have
    like different sub binaries and each
    binary will reflect the precompiled
    library of that package that was built
    on a specific platform for one OS for
    one compiler for one build type for
    specific architecture so any change of
    those settings will lead to a different
    binary okay then you will see you’re
    going in fact to have you know all the
    basically all the different steps okay
    from fetching out this source code okay
    to the build and then the
    gauging by copying all the headers of
    the other libraries into the right
    destination folders and then basically
    the the packaging for method so there
    will be different methods involved here
    in this in this big process okay so now
    it’s the right time to create basically
    my my package so for that I’m going to
    so I really had the version I run the
    current new my vacation my version but
    I’m here I’m going to associate this
    okay with package owner and I will also
    determine the channel okay so here for
    example you just say for example my I’m
    I’m the owner and it will be the channel
    will be tested okay I’m just going to do
    it like this okay I’m going
    oh yeah sorry for that testing okay so
    here
    I should have basically one package here
    so I have my package okay version 0.1
    can get more information about it okay
    even just run the search don’t want to
    get all the details okay so I can
    basically that according to to my own
    platform that package basically was
    built under 60 64-bit with GCC with a
    certain version of GCC of GCC and it was
    built on a Linux machine but now let’s
    try to do it differently okay because
    you know all those settings were
    automatically provided because here on
    mix machine and I have exactly those
    settings but what if I would need
    instead of using GCC to use ceiling for
    example or to build in in 32 and 64-bit
    okay so for right we have you know this
    concept of C of profile sorry
    profiles and we have so the default
    profile which is involved by default and
    you know we can see exactly the same
    settings okay
    but I can also create you know another
    profile if I want you know to compile
    with si lang well you know set the right
    version and the default architecture and
    so on and now what I can do eventually
    is you know so quickly go back to my
    package okay and now this time I’m going
    to create from the same recipe ok the
    exact same recipe the same source code
    and everything I’m gonna check to build
    this time another library okay for based
    on my ceiling profile profile
    and profile it me see
    okay okay let me put it a different way
    oh yeah it’s not a cannon sauce but it’s
    still kind of create sorry for that okay
    let’s create
    I’m so just kind of creates yeah si lang
    okay so now we have gone on search and
    let’s have a closer look at this library
    okay now we can see that for the same
    package depending and relying on the
    same recipe we have now two different
    package ID okay so basically two
    different package binaries one has been
    built with the GCC GCC compiler and the
    other one would say so this one is under
    64-bit architecture but what if now I
    need to use basically the same profile
    okay but I’m going to build it and for
    63 32-bit architecture
    okay so again now instead of two I have
    now three different package binaries
    let’s now let’s try to upload them into
    artifact doing
    yeah to approve this one specifically
    you want to approve everything that I
    have in my cache and I’m going in fact
    yeah to add all package boundaries and
    to select my local requested my artifact
    Oh
    let’s check now in our local repository
    refresh I have my package and I have met
    different set packages my different
    package binaries and for each one of
    them basically you can get the current
    package info and more okay if I
    basically drill down you know I can see
    basically everything that I have within
    those packages and I can see the
    compiler the architecture everything in
    fact all the settings that led to the
    creation of this subline of this package
    panel so tomorrow
    if I now have another process set up
    process consuming basically this custom
    package based on the settings that would
    be set on this environment the right sub
    package the right package binary would
    be fetched and introduced into the into
    the blue process okay so this is exactly
    in that case that Konami knew would be
    quite powerful is quite powerful to
    dynamically manage you know all those
    things based on the on the environment
    configuration on the profiles that you
    that you will differ let’s now go back
    to the to the gravitation okay and it’s
    now to some time to see you know some
    examples with nausea ICD processes
    running with Jenkins artifact doing okay
    so now that we have all those binary the
    nuts factory we can use it as a trusted
    source to provide all the bit processes
    we know with the right depends isn’t
    like the right boundaries Coenen here
    will be automatically you know get the
    right sub binary so here for example
    this one oh I would say yeah you know
    these are all the transitive
    and she’s but here for example this one
    is a package only the right sub package
    only the right binary package binary
    will be retrieved based on the
    environment based on what the client
    requested okay so all those packages
    will be sent to my bill system via a
    conan install that will be you know
    based on on my current fights okay
    and with the right configuration that I
    have in my client okay and then I will
    be walking either with seeming Visual
    Studio or some other built systems okay
    current is you know fully agnostic then
    I will be building my binary packages
    that will be at the end of the day
    pushed to add facto and then reuse by
    some other processes so let’s see in
    Jenkins so in Jenkins we have for
    example a demo okay so from you know
    getting the source code to including the
    packages into a de-facto so in terms of
    configuration you first need to install
    the Jenkins plugin I mean the artifact
    with plugin for Jenkins to define
    several objects like you know the
    artifact to be several name the artifact
    repo the repo URL and then just to
    define all the stages okay from pointing
    to the right
    repo to initiate your current client
    to define what remote repository should
    be used in all cases not
    directly Conant center it will be like
    exactly like a like I shown you before
    the : local repository and then I will
    be building my component
    and once my once my component my library
    is built it would be Jen’s just push to
    attract away via a canonical okay with
    the right tag but it’s not it’s not the
    end of the of the story because here
    I’m going in fact to upload it as with a
    bit of materials with the bar okay so
    the idea is not only to have two
    individual files into a local repository
    but it’s to collect any information
    related to that process and to have that
    information later on in in my artifact
    to itself
    okay so we have you know very strong
    bill management process here in it
    basically it’s a system of record for my
    bill processes okay so here I can simply
    if I want you know record the
    environment variables and I can see all
    the artifact that were push eventually
    all the dependencies proud to do to the
    build process okay so here I can seem to
    know that all those dependencies were
    used particular and if I want
    I can see you know that you know these
    kind of package was produced by these
    two different bills and at the same time
    they were yeah related to that to that
    bill process so there are different
    things in fact you yet to manage the
    build reproducibility okay so you can do
    it like this with profiles associated
    with your bill agent but you can also do
    it in a more dynamic way by pulling the
    right docker image that will basically
    host that will have you know the right a
    current version the right see make the
    right compiler with the right version
    and so on and basically where you will
    when you will let me know run your
    basically your current create to create
    your package everything would be
    basically this docker image will have
    the right profile and the right tools
    the lighter libraries to perform your
    build the right so for that you can you
    know rely eventually on this docker
    registry on docker hub so Louise Martin
    is the bath – Romi is one of the conan
    thunder and here basically you can see
    you can use you know all those docker
    images based on what version of compiler
    GCC compiler you want to use will it be
    same for C rank and so so this is you
    know one of the one of the approaches
    okayed for builder producing it and the
    rest will be exactly the same
    okay is always about you know creating
    your package and then uploading it into
    into X Factor again another example in
    TFS okay and how basically to build your
    component your components and your
    packages across different platforms so
    here basically you can have different
    bills okay that would be
    one by one building your component under
    a different architecture in release in
    debug mode and so on okay in other idea
    to have all the packaged binaries that I
    described previously so in terms of
    build F initial we have a plug-in okay
    current dragon that is a variable for
    CFS or you know you can simply
    [Music]
    initialize you know your current config
    login to a de facto so we just mean in
    fact to provide the user to add so here
    we can add the remote okay and can add
    the user you will creating you will be
    creating the content package this way
    specifying a profile then creating your
    package and this time by running right
    docker image okay so it’s mainly related
    to what we saw previously in Jenkins and
    then at the end basically uploading
    running canonical into a de-facto we
    have actually also the Billings that can
    be pushed
    okay so I think he does with Conan
    basically you know you can you can do
    all that stuff in different build
    systems with the the main thing in fact
    you to retain okay and to remember is
    that you know
    Conan again is build system agnostic
    it’s here in fact to manage and to
    handle all these dependency map to
    provide you with the right package on
    the right platform and if the package is
    not available so first of all you could
    have you know some some packages that
    wouldn’t be available on the on the on
    Conan Center so you know you can
    completely configure so at the time you
    run your build if the current connect
    package is not available eventually
    Conan will rebuild and will build not
    rebuild will build a package from source
    code so there’s also an option for that
    so you wouldn’t get stuck so yeah that’s
    pretty it so again don’t don’t forget to
    have a look at if you want for not an
    abstract or user to have a look at the
    community edition of Jeffro Community
    Edition for Conan very easy to to find
    the Frog artifact doing
    okay and you can find basically this
    quite useful blog post that will then
    redirect you to
    this open source this it so basically we
    have an open source version for for Java
    for maven but here we have this
    Community Edition also for con
    okay so don’t hesitate to to give it a
    try okay and if you have any question
    don’t hesitate to reach out to us and
    now it’s yeah so if you have a yeah we
    have we still have you know some minutes
    left