Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Seasocks with makefile #183

Open
toutriste opened this issue Oct 12, 2022 · 9 comments
Open

Use Seasocks with makefile #183

toutriste opened this issue Oct 12, 2022 · 9 comments

Comments

@toutriste
Copy link

Hello.

Any help on how I can integrate this into my project that uses Makefiles?
Ive tried searching but I can only find CMake stuff..

@mattgodbolt
Copy link
Owner

Hi there! Seasocks is built using CMake, but you don't have to use it that way. You can build it using CMake and then just include the headers in your project. Or use a version of Seasocks from conan ( https://conan.io/center/seasocks ).

How are you currently using third party libraries in your makefile? And what platform are you on? Maybe we can build a few versions of seasocks as part of the release we do.

@toutriste
Copy link
Author

toutriste commented Oct 12, 2022

Hi, thanks for answering!

I'm developing on Linux, and this is how I'm currently linking seasocks and others:

LIBRARIES  	= -L/home/user/seasocks/build/src/main/c/ -lseasocks -lconfig++
INCLUDEFLAG = -I$(INCLUDE) -I/home/user/seasocks/src/main/c/
..

The problem is that I'm hardcoding seasocks library path, I wanted something easier to compile, so the user does not need to build first seasocks and then my project.

@mattgodbolt
Copy link
Owner

There's no easy solution for this more generally I'm afraid. The ecosystem for C++ is not well set up for this. You can try one of these things, though none are that appealing:

  • Port to CMake and use Seasocks as an external library
  • Use a library dependency manager like conan or vcpkg to explain your package dependencies
  • Use git submodule to bring a version of Seasocks in, and then hand-write a bunch of Makefiles to build it as part of your own build. Or use Cmake from your makefile to do so. That would be fragile as we don't support makefiles in our project so you'd be on your own keeping the build up to date.
  • If we were to publish a binary build of seasocks for Linux, for some version of the compiler you might be able to get that binary build and then curl it in your makefile. This would be fragile as it may rely on a particular libc and libstdc++ version for the compiler we build with (and the compiler you're running locally).

@toutriste
Copy link
Author

I see D: But this makes me curious, how other libraries do it? e.g I'm using -lconfig++ and I just installed libconfig 1.7.3-1 package... And it works.. Not sure if that would be possible with seasocks.. Lets say installing the package, it builds the library (locally), it stores somewhere in /usr/lib and then it would be easier to use I guess.. ?

@madebr
Copy link
Collaborator

madebr commented Oct 12, 2022

You can parameterize the location of seasocks:

SEASOCKS_ROOT=/usr
SEASOCKS_LIBRARIES=-L$(SEASOCKS_ROOT)/lib -lseasocks -lconfig++
SEASOCKS_INCLUDEFLAGS=-I$(SEASOCKS_ROOT)/include

You can then call your makefile with arguments:

$ make SEASOCKS_ROOT=/path/to/your/seasocks/installation

@mattgodbolt
Copy link
Owner

I see D: But this makes me curious, how other libraries do it? e.g I'm using -lconfig++ and I just installed libconfig 1.7.3-1 package... And it works.. Not sure if that would be possible with seasocks.. Lets say installing the package, it builds the library (locally), it stores somewhere in /usr/lib and then it would be easier to use I guess.. ?

If you don't mind forcing your users to globally install seasocks as a library as root (which is not something I particularly like) you can ask them to download seasocks, and then install it in /usr/lib or /usr/include. Or we can make packages for Arch, Ubuntu, debian...all the various UNIX OSes... and then folks can apt install it (or whatever). But it'll be tied to that specific OS's default C++ compiler (which may be ok?)

It's not something we've done, as it takes time and effort to craft package installations/packages for every OS going. I'm not against this, but it's not something I like doing myself (either the effort of packaging, or as a consumer, relying on OS-installed development libraries and headers; nothing annoys me more than having to apt install a bunch of random stuff :D )

@toutriste
Copy link
Author

I see, I guess people have different tastes :)
My suggestion remains, having a distro package would make some things easier for X users.
Thanks for replying!

@mattgodbolt
Copy link
Owner

We'd be happy for someone to take this on :) I'll happily merge in!

@madebr
Copy link
Collaborator

madebr commented Oct 13, 2022

Create an issue and mark it with an octoberfest label, you've got 2 weeks left 😄
For a little python library I'm maintaining, I received a little pr out of the blue.

See https://hacktoberfest.com/participation/#maintainers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants