Using External Dependencies with Conan @ Bay Area C++ User Group Meetup

September 27, 2022

< 1 min read

Abstract: In the 2022 C++ survey results an overwhelming majority ~80% said managing libraries was painful, nearly 50% called it a major pain. Given this is not even a conversation in another ecosystem, it’s time we solve it once and for all.

This talk will give an introduction to Conan and focus on the latest features you can use today to overcome any challenges. You’ll learn how to work on a CMake project, use different generators, and take advantage of multi-config presets. The goal is you give you a clear picture of how Conan fits into your existing workflow.

  • What is Conan? Why do you need it? Alternatives?
  • Searching, Download, install or build from source any open-source project with Conan.
  • Settings, Profiles and Preset
  • Adding Dependencies, Testing Requirements
  • Teasing Conan 2.0 new model
  • Publishing your own projects to ConanCenter!

Few slides, lots of demos, lots of things covered – you will leave the talk able to leverage other projects much more quickly than you could do before.

Speakers

Christopher McArthur

Christopher McArthur, Conan Developer Advocate @ JFrog

Chris has been giving back to the open source community with exploit database containers, C++/ CMake build system maintenance, and other OSS projects for nearly ten years. He began his career as a C++ developer and has since then added other languages including Golang and Typescript to his skill set. Prior to joining the Conan team at JFrog, Chris previously worked in the video broadcast and mobile advertising industries on a variety of projects. His diverse experiences include Blockchain, low-level hardware networking, distributed systems security, and cloud-native DevOps. As a developer advocate for JFrog, Chris deals with Conan, Chris shares his deep to the knowledge of DevOps and Package Management to the C++ Community globally.

Video Transcript

00:01
Okay hey guys i’m Max and welcome to CPP Bay area ah oh raise your hand again if you previously said that this is your first time here alright cool.
00:17
Alright well the recording is all right so that’s good um So if you guys want to tweet about this or take pictures or anything like that you can tweet them to at CPP Bay area on Twitter.
00:30
we’ll we’ll use those for stuff, and this is going to go for about another hour and a half we’re going to end at 830.
00:36
And let’s see um.
00:40
So, in the last month we’ve had a couple of CPP related events, actually, I think, Richard you had something about CPP events.
01:07
i’ve heard that from multiple people actually.
01:24
well.
01:27
there’s also the LV m meetup earlier this week so that’s another cool thing you guys should check that out on meetup COM as well, and then also coming up this month and next month, we have some more CPP related events such as CPP con.
01:44
Alright, so how many of you have not heard of CP con all right great marketing all right, everybody knows about TV be gone alright so.
01:53
It will be in aurora which is right outside of Denver in second week of September so it’s coming right up and.
02:02
How many of you when when Richard was talking about people was North was saying, you should go there.
02:09
Well it’s too late, but she’s still got a CV calm and you should you should absolutely go to see me because you should talk to your boss about sending you the cpb gone.
02:17
And I always get this people say oh i’m pretty sure my boss wants send me it’s like Well, no, if you don’t ask.
02:23
The thing is, you ask this year and it says no she says no, then you ask again next year, you know eventually they’re going to say yes, you really, really want to go I guarantee you, you talk to how many of you’ve been to a CP, because how many of you here into CV recon.
02:39
Did it change your career.
02:41
I don’t mean lot but I mean did it change your career it it changed the WHO, you know and what you know about CPP c++ it does that that makes a difference.
02:51
You will meet very interesting people who are doing interesting stuff so you really, really want to go so check it out it’s the CPP Kon org and there’s still rooms available and so absolutely you want to go yeah.
03:04
Because of that Richard and I are going to be here next month, but Max will be.
03:10
There we might actually push this event one week so that so that we could be back, but.
03:18
We right now, this is still scheduled for the second week of September 14 that’s the plan currently if we change it, we will definitely let you.
03:27
All right, thank you so let’s see if anyone’s up here, looking at me.
03:32
now having to keep on checking my notes, you know not articulating well and you think you could do this better well, then please, we are looking for more volunteers to do this kind of stuff.
03:42
Or if you, you know, want to talk about something we are, we are definitely looking for speakers and I think even next month know there may be some opportunity for that so.
03:53
If there’s anything you want to talk about it’s certainly better than talking about nothing, which is what will happen if no one volunteers to talk about something so there’s that um let’s see so does anyone out in here have any announcements is anyone here hiring you are hiring hey.
04:51
Thank you let’s see what else we got oh so then after that Oh yes, something as well.
user avatar
Unknown Speaker
05:09
empty.
user avatar
US – Frog Field
05:34
Where do you work and how do they reach out to you.
05:38
He said to reach out to you, but you know.
05:49
Alright cool uh so yeah so we’re going to be going for about another hour and 20 minutes, and after that we’re going to be heading out to dinner, if you want to join us at fibber mcgee’s, which is in sunnyvale.
06:05
You can Google it if you want the record on Murphy street.
06:11
And thank you to J frog yet again for hosting us that is very gracious especially aria.
06:21
Oh.
06:27
Okay, so so welcome everybody.
06:30
I haven’t Stephen chin VP of developer relations at J frog So if you have any compliments about the food or the venue or any of that stuff please tell Ari.
06:42
Who helps organize and liaison if you have any complaints come to me, you can you can complain to me about stuff and.
06:51
Part of Part of the reason why we care a lot about the cnc plus community and CPP con and all the great stuff here is because.
06:58
We have a lot of investments in the sea community from the J frog standpoint conan is an open source.
07:05
package manager, which I think will hear a little bit about tonight, which it’s even though it’s a J frog project we run entirely as an open source.
07:14
Separate effort so it’s it’s separate from our product teams it’s run by Diego who’s awesome and we we keep it pure in the sense that it doesn’t have any influence from our product side.
07:28
So hopefully all, if you like, conan you’ll be interested in some of our devops solutions which integrate with it.
07:34
But we we just do that for supporting the cnc plus plus community and making it a great ecosystem so thanks a lot for coming out tonight now, I have a quick question for the audience before I turn over the MIC so Has anybody not well who signed up for the ECHO raise your hand.
07:52
Okay, so quite a lot of folks raise their hands, if you didn’t sign up for the ECHO, such as some folks in this row pass this around, and you can still scan.
08:03
Until 745 I believe is one will do the R is going to do the drawing and then we’ll decide who gets the ECHO, even if you don’t want the ECHO, maybe a loved one friends co workers, etc, will will appreciate it so thanks Max or you could just pawn it, you know it’s yours.
08:25
um let’s see well, the last thing I was supposed to say say introduce the speaker and conan, but I think Steve did a better job of that, then I will, I think i’m going to turn it over now to Chris.
08:47
Hello Hello.
08:50
I apologize if I stutter at the beginning i’m incredibly sensitive to audio like and because they play it through zoom it’s very difficult for me so bear with me, for the first five minutes, I promise we’ll get through this.
09:03
By share my screen.
09:25
So today i’m going to talk to you about conan and there is a very particular reason why I get to talk about conan.
09:31
So up four or five years ago, I was working as a c++ developer of a hardware company, and we need to use something called pls of security, who callie everybody hates lucky where don’t they.
09:43
And no one wants to write open ssl from scratch So what did we do we said oh we’ll use a package man that sounds like a fantastic idea doesn’t it.
09:52
And so we actually picked vc package and after about three days a business leaders came down and said Oh, by the way you have all these extra business legal requirements, you need to meet for our customers.
10:04
And then we switched to conan and that’s how I got to go down this road, so I actually was a very large member of the cloning Community before I even started working for J frog.
10:14
If you go on my github profile you’ll actually see years and years of contributions to conan and i’ve only recently started working here about nine months ago, so just to give you a little bit of background.
10:24
I do a ton of open source work as well, and one of the questions that I get a ton is how do I add this project my projects.
10:32
And I get a beautiful comments with code snippets about see make that I probably was written before I was born, we all know how great see make to us.
10:42
You know when they do find package open ssl target link libraries liberal, I saw and they have like different dependencies and targets um so what I want to do with you guys here today is to wake up from the nightmare of using external libraries with conan.
11:01
What I like to do for all my presentation is I like to pick a different Open Source library and this one is going to be drago it’s a header compiled library, that is a non blocking networking it’s actually really popular on github.
11:20
And they have some beautiful installation instructions, you know you can.
11:24
specify your bill types, you can install on windows look to actually support conan I didn’t even notice that they also support vc package.
11:34
And these instructions are hideous but it works apparently there’s a lot more instructions and then there’s some more instructions and oh look another package manager.
11:48
Who wants to try to build this themselves.
11:52
yeah oh one hand wow we got a brave soul back there guys.
11:58
But this is probably not what you want to do right and like, if you look at this list of dependencies you got tried for i’ve never heard of that one Jason CPP live you you ID I recognize that one that’s pretty pretty standard and most the astros.
12:14
And when you try to do some of these you know, like this is the build instructions, if you want to build this for your own system, and then you try to look at Jason CPP these guys have how many like they got like bazell see make whoo marathons.
12:32
Where would you even start you know that’s that’s the first reaction, I had when I looked at this.
12:39
And then, lastly, got open ssl which has a ton of different instructions were on the different platforms and it’s on the different variations and I see a bunch of smiling nodding faces at me because we’ve all been there.
12:51
So, today I want to try to make your life, a little bit easier.
12:56
And most of you are smiling and nodding, because this is a problem, like 80% of us have according to this year CPP like survey.
13:04
I don’t need to convince anybody of this problem we’re all living breathing it Dreading it every day if you didn’t sleep last night, probably this rights yeah.
13:16
So how do we address this.
13:19
package managers yeah I know you’re gonna hate me for saying it but they actually do a really good job so they’re worth looking into.
13:30
Why package founders, what do they provide a they’re quick and easy access to a pool of quality Open Source i’m an amazing developer, probably the best c++ developer in this room, according to nobody about myself because that’s the temperature there’s a plaque at my last job.
13:49
crediting me for the great deletion of 2017 you know that’s a title, you really want to leave a company with.
13:56
So you use package matters because you don’t want to worry about your dependency graph you don’t want to know how many other projects are underneath what you’re trying to use.
14:03
And you want it to integrate right you want to be able to use whatever technologies are you using and just get the dependencies you want.
14:10
And you want to have awareness of platform compatibility I didn’t show you a drago but they’re only supporting c++ 14.
14:18
Open ssl has a different department, depending on the version of boost you pick depending on which one they support which I didn’t even look into you’re going to get different compatibility in different support.
14:28
And there’s just a nightmare complexity right, so the reason you use a package managers, because it does this, for you and there’s a ton of options.
14:37
system does drills Apps we all love Apps on ubuntu you got brew for your MAC users there’s a number one combo which is cross platform works on everything.
14:47
And you can even install a web browser with them, which makes me super convenient just take advantage of it.
14:52
You can always build from source there’s some really good pack there’s a really good package manager, in the space.
14:58
hunter vc package see makes patch content, which was presented to us just a few months ago and there’s other ones like V2, which is a boost build system, you might not have heard of but they actually have a mechanism for downloading dependencies which I thought was cool.
15:12
But those all work from source and pretty painful to wait for boost to compile I actually tried doing it on my laptop without it plugged in, and I wonder why it died while I went to get a coffee, you know no surprises right, but sadly I made that mistake.
15:29
So binary management, the only one on this list is conan and that’s the one i’m going to talk to you about today.
15:35
My big takeaway for this presentation you don’t have to use conan you can use whichever one you like just pick one and don’t open an issue on my github repository complaining that you don’t know how to copy header files.
15:51
Though I will do my best to gracefully answer you I promised us.
15:56
conan is the c++ package better that’s how we like to sell it it’s supports all Python what forms it’s written in Python i’m cluster for you.
16:07
It supports a ton of different belief systems i’m going to focus on see make because that’s my bread and butter, but if you’re into bazell their support for that if you’re an auto tools GM new tool chain type of guy their support for that.
16:21
marathons I saw in the new 151 release that came out a few weeks ago, their support for you guys too so pretty much whatever you want there’s a build cool integration for you.
16:33
And what conan provides is absolute visibility, on your dependency graph.
16:38
And there’s some huge improvements in conan 2.0 so what I will be focusing on is conan 151 which was released a few weeks ago.
16:48
But conan two is just around the corner of general availability is going to be coming out in the next few months and the betas are already out so you’ll notice the bottom of my slides there will be some teasers.
16:57
Know unless some conan to version of the commands and the I encourage you to go home and try them.
17:03
You can create a reuse binary so kona knows how c++ is in those settings it knows environment variables in those all those nasty things we like to sneak into our binaries and it can track them for you, you can create profiles different configurations, and it makes it really easy.
17:20
Decentralized you can host your own packages your own recipes you’re not tied to the one central conan Center index, you can have your own.
17:32
server and you can host your own packages if they’re smaller scale they’re not made for distribution across public or if you don’t want to support all the workflows that one Center does, and it makes it really easy.
17:44
The best part about conan for me is it’s eXtensible and customizable.
17:49
I come from a devops background I had to deploy on Alpine I had to deal with different see runtime implementations I had to cross compile the code for.
17:59
g Lib C and as well as muscle see and being able to track that in conan and have pre compiled binaries for both of those see RON times, so I can deploy an alpine on the cloud and let my developers work on ubuntu godsend of saving time.
18:17
So if you want to find a package you have one in mind that you’re already using is 80% of you probably have this problem there’s two options for you, you can go online conan’s dot io slash Center and you can also search for the command line, which is quite convenient so.
18:34
We go to court and Center.
18:37
Like our nice drug on.
18:40
Well, I didn’t even spell it correctly and look at that it actually works for you.
18:46
You can see the latest version is one dot seven dot five that’s been made available.
18:52
The downloads are zero.
18:55
bane of my existence as the conan developer advocate I know how important is for everybody to see the download counter on your projects and the fact that this one’s broken drives me nuts.
19:05
And if we go here there’s tons of different things we can look at.
19:14
don’t do live demos.
19:27
that’s not the one I was looking for I apologize, this is why you do screenshots.
19:32
And we’ll give you a nice breakdown of all the different tools and integrations there’s a fancy little use it tab shows you how to work for see make all your different projects i’m going to take you through it here today.
19:44
So if you want us to install this on the system, a conan Center is the default remotes we call them in conan land and it’ll automatically be configured when you install conan So if you type conan install dragone one dot 75 act a little fancy way of saying it’s a reference.
20:05
You can change your settings so.
20:12
And you can specify your generator so the new way of working and conan some of you might be familiar with older integrations if you’re familiar with conan.
20:21
But the new ones are see make ups and see make tool chain so see make steps over here is going to generate the fine package modules that see make already uses as support for ages it’s very easy.
20:35
Now, sometimes you want to compile for a different file that’s not supported my MAC is running the latest xcode tool chain with apple client 13 which is not available yet so in my second snippet you can see, I specified these extra build missing and that’s a really convenient way.
20:55
So, if we take a look at these and break these down right, so you can do conan install the package name, you can also specify a path for installing from your local environment.
21:05
We can change your settings at the command line which is super convenient so compiler version equals 12.0.
21:13
that’s the version of X clan I wanted to develop mode and I specified the generator for see make cups.
21:19
Of build missing conan is very smart, it will be able to know what a header only dependency is and it knows that it doesn’t need to re compile anything for your local system.
21:30
So when you do build missing it’ll only re compile the dependencies that are not binary compatible, for your system.
21:36
So you can get as complicated as you want in conan 2.0 they’re going to be offering a compatibility.pi script where you can actually write your own compatibility for binary, which is a huge huge advantage.
21:51
conan two point O snippet you drop the APP sign terrible syntax and you just say reference, what is it remember.
22:02
When you run this command you’ll see all the different.
22:08
dependencies that are added there for you.
22:13
And you can notice there’s the drug on targets release thought see me that’s the one in generated, for us, specifically.
22:21
So what i’d like to do with you guys here today is i’d like to make a Hello world program because i’m a creative c++ developer and that’s what i’m getting.
22:31
So if you wanted to create a new content project really easy just conan new hello, and our template is going to be a see make executable.
22:43
You can see here, we got a few different files, we got to see make lists a conant file dot pie gives us an include dot H Hello source CPP and the main.
22:55
And this layout is very particular it actually is the default specified layouts for cma that conan provides you and with that information it’s.
23:06
Without information it’s able to do a really great things of putting you in edit mode and you can work on your packages locally, if you downloaded them off the conan Center or offer remote server.
23:19
So, if we take a look at some of these basic attributes that have a name version pretty easy a license goals are always important.
23:31
author, this is mostly written in the mindset for code and Center where you’re going to be publishing it public, so perhaps your licenses MIT or Apache.
23:40
URL description topics, this is actually how you can search on conan Center index So if you put really good tags and someone pipes http server encoding Center it’ll actually come up, which is really nice for promoting your project.
23:57
Not last one binary compatibility.
24:00
settings you got your operating system compiler build type and your architecture.
24:07
I saw just the other day, there was a pull request for the android SDK support.
24:12
So if you were to cross compile from Linux to your android you can actually specify which operating system which compiler to use specify your environment variables pointing the right compiler and conan will capture all that and keep that in its package ID so you.
24:34
gotta leave these microphones so you can actually keep track of which packages you’re looking for in which settings you need.
24:44
In the new.
24:55
Yes.
24:57
You can absolutely do that it’ll understand the different settings you can upload the binaries for both, and you can download them on the actual Target system you’re trying to run on.
25:05
i’m not going to talk about the dual profile build method, but that is exactly what you would look for if you want to search on your own afterwards.
25:17
The key heart of our code default by is going to be these four functions layout generate build and package.
25:25
layout is how your source files organized so typically i’ll have to include directory source directory of probably a build folder where you going to put your all the extra files that you’re going to put in your get ignore.
25:36
generate is probably the magic that’s going to be happening here and i’m going to go quite a bit into that afterwards, for you guys.
25:43
But build most of us are probably familiar with the see make built command that’s exactly what’s going to happen over here and see make install for package so assuming you set up your targets correctly to be installed, this should be pretty painless experience.
26:01
So if we wanted to build and run our template our Hello world example.
26:07
You would do conan install build default conan file so that little snippet here.
26:17
Is that is the.
26:22
workaround for 1.0 compatibility towards 2.0 so you can ignore that for now it’s going to go away, very soon and the shorthand is just your minus P, I put it over here when I ran the command for you.
26:34
And this will install all of our dependencies it’ll generate a conan tool chain see make file.
26:47
So I run on an all.
26:55
woman.
27:23
it’s not legible hopefully.
27:29
So if I run new conan install on my own file.
27:33
wow live demos.
27:50
whoo success teamwork pair programming i’m so happy.
28:01
that’s why take some jobs.
28:05
That would have generated a slew of files for us inside of our default see make layout where you would actually have access to inspect them look at this.
28:15
So when we configure see make locally or going to use see makes presets now who here is familiar with see make presets and is used them.
28:27
oh six hands.
28:31
So these came out in see make 1418 ish so quite a recent feature and steam a timeline and this allows your tool chains your build systems, your package managers to tell see make where all your files are what configurations, you want to run.
28:48
So conan integrates like this with see make it completely transparent so if you write good see make you can use conan or not use conan and it gives your consumers of your project, the flexibility as well.
29:02
So when you use and load the preset it’s going to automatically detect the see make tool chain file and it’s going to use the conan tool chain.ca.
29:13
And this is going to have all of your install prefixes module prefixes.
29:19
If your packages have custom build module scripts that they provided installation those will be packaged as well and loaded in for you and you’ll have access to everything is, if you called you did the see make install yourself and you called find package.
29:36
To build just see make build and build release that’s The sub folder from the conan layout and there is a Hello world executable default that it generates and it just Hello world release evening we’re so successful in life.
29:53
So if we want to add or dependencies have very, very easy if we just add three lines for the requirements we’re going to say drug on 175.
30:03
we’re going to say at our see make depths generator and inside of simic we call find package we set the compiler standard c++ 14 and we do target link libraries.
30:18
And in our main we just add and register the default APP handler that drug on provides.
30:26
that’s it you’re done.
30:28
You didn’t have to worry about booths you didn’t have to worry about open ssl or Z Lib and.
30:34
I don’t even know what others were on the list because I didn’t remember it because it was too long and that’s it you’re done so.
30:40
Congratulations, you just added a huge dependency that was sequel supposed supporting that had 18 different bajillion dependencies and you got it to compile right away.
30:53
So if we did conan install again after making those changes, we would see all those new see make that’s files and I believe I had a screenshot.
31:03
right here, so all of these are the see make fine modules that it’s actually looking for, and you can see them here on the screenshot on the right hand side.
31:18
and your workflow is the same right seem a preset released we’re going to reconfigure so you make build and then, if you run it you’ll have your drug on server up and running with all your dependencies directly linked into your executable super convenient was that easy, could you remember.
31:37
15 lines of if.
31:42
I convinced you all I sold it to you, I see those smiles.
31:47
So it’s great that you have your dependencies but that’s probably not the end of your job, you also have to put this in some ci CD system and there’s going to be some unit tests and whatnot running.
31:59
Or perhaps allison shoot.
32:21
So that’s an excellent question, so the way conan works is it has a local cache so by default in your conan user home directory is where that information will be saved.
32:34
And inside there you’ll see the reference literally of the name, the full name that conan will unravel for you, so in this case, it would be dragone slash one dot 75.
32:46
underscore underscore and then some more random shazia you’re not gonna understand.
32:52
And all the packages are gonna get the same treatment and all the files are going to be there and in the sea make files that generates.
32:59
When it does the Ad library important it’ll actually pass the files to your code in cash, so all the files that it will download unpack The pre compiled binaries it’ll save all of those in your cache and reference those at build time when you run your comment.
33:24
Yes, magic So the question was if you have.
33:30
Two projects with the same dependencies it will only download it once and cash it once.
33:37
which makes it really easy when you’re working with something like fmt and you know one projects it’s still seven and the other ones up they get it to eight, you can have both of those versions as well, so it makes it very easy and flexible and it saves you a ton of time.
33:53
So when I like to work locally, I always like Oh, we have another question shoot.
34:20
If you make any changes, you have to get this.
34:31
Like if you were to edit your local cache files.
34:52
So.
34:54
yeah so i’m conan tracks.
34:58
packages recipes at one level and binaries that another, and you can do some really fun fancy things, there is a setting called revisions enabled which is my favorite setting up all time.
35:12
And what it’ll actually do is track any changes, you make to the source code of the project, as well as the recipe.
35:19
So if you change anything, and you build it and you upload a new version of even if you didn’t change the semantic version and you didn’t bump the version, like you, a good developer should.
35:31
You can actually track those changes.
35:35
You know you’re gonna pull out the good stuff.
35:46
This is me this is my github I have a sample project called user management, then my showcase project helped me get my first job, my second job, my third job, and you can notice my last commit if you can read that as upgrade to conan one dot 58 days ago.
36:06
This is a restful web API and I have a cute little back end that’s written in c++ and I use something called a lock file, this is a really fun convenient way of really pinning down and locking your dependencies.
36:21
And you can notice here there’s this extra hash at the end.
36:32
And that is the recipe revision and with that, even if somebody in the public makes a change in the poor across gets approved according Center and there’s a new change published I won’t automatically download it.
36:46
And it actually saves me a lot of places, because some of the changes could be breaking so when they add new features, if I haven’t upgraded my Cone and clients and my belief system.
36:54
it’s this revisions feature that I rely on my favorite tidbit is it’s going to be default in 2.0 so you don’t have to worry about it in the near future.
37:09
So as a developer I almost never work and release and I always work from the bug and I never use make I always use ninja because i’m lazy and if I actually to wait for make to finish i’d probably go get a coffee and.
37:26
i’d probably go to the cafeteria too much to have snacks, as you probably discovered.
37:31
So what I like to do is I like to actually have configuration files and settings that are specified to my personal taste.
37:39
And you can see in this example i’m compiling with the bill type the bug so we have s build type the bug and we have this beautiful long line of tools, he makes he makes will change generator ninja.
37:54
And this will.
37:56
change our presets that conan generates for cma right so see make has this way of tools being able to integrate it and conan transparently goes through these process.
38:09
So you can change your runtime generator to ninja and you can use in called ninja you can see my little screenshot over here, I had kept my release.
38:20
And it has made there’s a nice little Hello executable, but I also have my debug folder with my build dot ninja script and that’s most of the time where i’m working where i’m testing i’m using it.
38:33
settings those are the general attributes of for all of the platform for your binary compatibility that you’re working with configurations are the properties, for your build systems that you’re working with So if you had a specific see make setting up in my case, the generator.
38:51
that’s where those will go.
38:53
And remembering these and specifying a command line is an absolute hell so i’m going to teach you making profiles, because I don’t want you to memorize the command line.
39:03
profiles, or something that you can specify and you can very easily write.
39:10
These two examples are for the ninja and above So you can see, I have include default by default conan will detect your environment and generate a profile.
39:21
And you saw that earlier with the sea make profile build the fault that i’m probably getting the command line wrong for so don’t quote me.
39:29
And I add my configuration and I have my same thing as the command line right see make tools change generator ninja.
39:37
And when I pass code install I just do PR ninja.
39:43
We can easily like that, and I could have made these just one profile, so I could have put my settings.
39:50
In one file and just asked PR my PR and it would work.
40:00
So if you want to publish a package, this is probably the number one reason why you’re going in the first place it’s because you want to be able to share your binaries.
40:11
The command to generate a package is conan create just conan file and it will read all the attributes all your settings and run with it and it’s the same syntax is installed, so you can specify profiles settings configurations, etc.
40:28
And you can do conan upload below 0.1 That was the projects that I was working on to make this presentation and that was my drove on Hello world.
40:38
And it’s that easy so somebody else can go to their system they can type conan install Hello 0.1 and they get the binary assuming I actually uploaded the right settings and the reason is, what are the odds somebody has the same compiler version is me.
40:55
If you’re an open source author and I strongly encourage everybody if you are is you can submit a pull request to con Center.
41:03
So get hub conan Center index, and we have some gorgeous box up folder and, if you want to learn how to add a package or something that’s how you would go about doing it.
41:14
Thank you.
41:20
Is there any other questions.
41:35
Yes.
41:38
by default.
41:40
What we do in the conan community.
41:46
where’s a good place to find this.
41:49
Is there is a shared option, so if I go find a good recipe.
41:59
We like seven zip everybody likes to work with compressed files 12 months it’ll still be there.
42:11
While do I pick a bad example the first one.
42:29
So you’ll notice, here we have something called options so most packages have different settings you can flick on and off that actually impacts is the binary that generates.
42:42
You can see share here and conan automatically supports this one, so if you put shared true you can even use a wild card if i’m not mistaken, so you can do conan install minus oh.
42:53
And you put wild card colon shared equals true and all your dependence will stallman share and it’ll pass the correct settings the build share.
43:02
See make file if you’re using that one, for instance, so if you do build from source that knows how to manage it, the other one that’s managed for you and almost all the recipes is a epic I don’t know what that does, but I know it’s important, so there as well, for y’all.
43:18
For this one, you can see fmt has aliases and less API so depending which options you pick it will actually generate a different binary with different symbols that are installed, so you can track these different things with.
43:38
Alison.
43:43
Of the binaries.
43:46
So.
43:51
So.
43:53
We are looking at conan Center index, this is where the conan Community hosts all of their recipes and.
44:03
The way that we’ve taken to guarantee the security is that every change has to go through the Community and be reviewed by the Community currently the rules are.
44:15
There needs to be at least two approvals on every pull request, so if you try to make a change you try to add something different to the recipe that would compromise it’s the reviewers and the Community have attempts to catch it if you are an author and you write bad code guilty.
44:34
And you upload the dependency yourself we won’t review your code for you, so if you introduce security vulnerabilities in the code that won’t get caught.
44:42
But in terms of the pipeline that the project got published to the Community, we do our best to make sure that there’s no.
44:49
unintended side effects there’s nobody trying to put malicious code into these packages i’m sure we’re all familiar with incidents like solar winds are some of the famous node js mpm install attacks, those are definitely not something you’re going to find in conan.
45:15
Yes.
45:19
1300 and 53 the last time I checked so github is actually very nice if you click on recipes it’ll actually tell you there’s too many and it’s still 1300 and 53.
45:43
or costs, so you can notice here on github there’s 166 pull requests if we check this out you’ll notice that there’s different activities so.
45:54
We have string view lights, I absolutely love this guy his work for his non STD packages are brilliant and he’s adding version one dot 702 is recipe.
46:20
yeah.
46:22
So my involvement in this Community has been going on for quite a while, and one of the things i’m going to take the chance to promote is we have Community resources.
46:35
And you’ll notice here there’s quite a few different bots.
46:39
We have updatable recipes So if you write a recipe and you’re published on github there’s a Bot that knows how to read releases on github and automatically alert us to new updates, so you don’t have to go chasing down it’ll actually create i’ll take a show you here.
46:57
So you can see there’s different projects that all have different things we sort on pull requests.
47:03
You can see a lot of these already have pull request open, you can always click the open one button on the far right it’s a little hard to see I apologize, but you can click on it and open a pull request for your project and.
47:19
The one that i’ve personally worked on is called pending review, and this is a list of all the podcasts that are open, that are waiting for reviews and there’s currently 34 of them and there’s a quite a long list.
47:34
And you can see there’s a few ready to merge with some mornings so something’s not right, so the bots not merging it and.
47:42
All of these are different ones so for the instance of a new project we have this one here, which is a.
47:50
By lyrics it’s a an one C compiler, and this is a new recipe these adding I should know this better because apparently I clicked the proof on it.
48:04
And in this pull request he’s adding version 0.29.
48:09
You can see in the different the top right it’s all new files or deletion so it’s a completely new recipe that he’s adding.
48:17
So if you’re an author of a library and you contribute to a library and you want your libraries available as conan there’s a very easy way to get it in.
48:30
yeah.
48:35
Yes.
48:44
I promised earlier, I wouldn’t do any sales pitch So if you want to host your own server that easiest way is going to be using J frogs are to factory.
48:55
I just pull mine up for you.
48:59
And I can sign in I can manage all my own.
49:10
it’s it’s definitely companies it’s definitely nice to be at a scale where you need to manage and track miners it’s usually not an individual.
49:17
I use it in my own personal projects because I have large dependency trees and I get a and this platform is free, so you can sign up for a free J frog platform, and you can use it so it’s kind of convenient but it’s mostly predominantly businesses that you said.
49:37
Yes, most often.
49:46
it’s not logical if I do.
49:49
Remote list.
49:54
And you can see, I have the conan center.io, which is the default Community one, and I also have user management which points to my super frogs instance of artifacts that I have with all my own.
50:06
So my personal projects as I alluded to, is built for Alpine and deployed on the cloud, so I have a different settings model than the default one.
50:15
So, in order to host my own binaries with the knowledge of G lipsey I actually have to pull them through my own artifact, for instance, to get my binary.
50:25
Because obviously conan Center doesn’t track the binary compatibility for you, I wish it did.
50:31
So I have my own instance that does a binary for myself.
50:41
For the most part, yes I I follow a lot on slack and write it and I think, almost all of the Open Source developers just use straight what content or gives us and.
50:51
The way the infrastructure behind it is done is that.
50:55
Most of the Nicky picky binary compatibility are old enough that you probably won’t notice So even if you’re running ubuntu 16.4 and you download the latest binary they’ll still work.
51:05
Even if it’s for a newer GCC that ubuntu 16.4 didn’t ship with so for the most part, Open Source developers don’t really need to worry they don’t need an artifact, for instance spark different partners.
51:33
I will detect that you have the project on github so you’ll have to open up the very first floor requests to say hey I want this it’s a text the updates.
51:46
No that’d be cool gabi github is mess.
51:50
yeah.
52:05
nope so name spaces are definitely a little bit of a.
52:10
personal preference, especially when it comes to c++ developers some projects do and we typically encourage people who are hosting their own community wants to do this, so I didn’t show you any examples, but the full syntax for a package name can actually have a username and channel.
52:30
So you can do a drug on slash one dot 75 X prints dash Chris MC me.
52:39
slash stable and you can install and download and reference that full user channel as well the default user and channel for content or indexes obviously none, which is why you haven’t seen any in this instance because i’m just using the Community recipes.
52:54
shoot Richard.
53:16
they’re kept separately, so you can actually see the entire graph.
53:22
There is conan.
53:27
info.
53:29
shocks.
53:32
i’m not the guy who memorized the command line.
53:42
or we’ll get there we’ll get there, we got we got a few more minutes before they kicked me out.
53:50
shucks.
53:53
I want to login.
53:56
All right, I wish I could show it to you.
53:59
But no, it doesn’t so you can actually use this command conan infographic.
54:03
And it’ll give you a nice beautiful table and it’ll show you all your dependencies and your dependency will be separate to all the other, so you can actually see your whole graph of what it looks like and how it works.
54:35
conan support something called version ranges personally I despise them and they almost never work because c++ developers are terrible shame on all of you shame.
54:46
But most projects don’t actually use something like semantic burgeoning so it’s really hard to write version ranges that are consistent reliable, but there is support for that so.
54:54
If your business always works in semantic visioning and you can trust that one dot 751 dot seven dot five is less than and binary compatible one dot 75 dot six grandsons with drago would have been.
55:08
Then you could specify that in your version range and you could download a different version, and it would update and compute a different package ID for you, depending on the semantic range.
55:19
So, yes.
55:33
Yes, you understand the concept that’s exactly it i’m going to pick on boost for not using semantic version.
55:38
there’s no API guarantee between the two right, so you would you would fall in the trap right away of like if you picked a boost version that was one minor higher it wouldn’t be compatible.
55:50
But yes, you could do that and conan does support that so the default tools dot version that’s supported in the conan file it actually understands these things and.
56:02
I don’t have an example for you, but if you inspected the inner workings of some of the output files, you would actually see for drago it would call it a one.x.ly instead of the one dot 75 because internally it’s thinking it’s magic burgeoning because that’s the default behavior.
56:22
Any final questions.
56:28
I will hand it back over to Max so we can do the wrap up, thank you very much, everybody.
56:44
yeah so grab yourself a magazine i’m all let’s thank our speaker again.
56:57
and the last thing I have on here is to invite you all to come get dinner with us at a Ruby GIs which is on Murphy avenue down the street from here in sunnyvale.
57:19
Oh yeah the discord you can find that on the meetup page.
57:40
Oh.
57:45
Alright, so we’re now closing bids for the for the ECHO and i’m gonna tally and see who who paid me off the highest to win.
57:56
So so apparently pranay sorana.
58:02
Or, nay, give them a big round of applause.
58:06
Okay, so you you win the ECHO show, I have some paperwork, you need to sign, but thank you very much.
58:17
And thanks everybody for coming to the meetup tonight at J frog for our great hosts and for excellent presenter so.
58:25
yeah frogs as well take frogs take magazines.
58:29
and come to CP