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

Building on FreeBSD #53

Closed
Surgams opened this issue Jul 6, 2018 · 16 comments
Closed

Building on FreeBSD #53

Surgams opened this issue Jul 6, 2018 · 16 comments

Comments

@Surgams
Copy link

Surgams commented Jul 6, 2018

Hi @babelouest
Thanks for this awesome work
I was trying to install the ulfius library on FreeBSD (couldn't find it the port system) and it complained about systemd absence.
CMake Error at /usr/local/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find Systemd (missing: SYSTEMD_LIBRARY SYSTEMD_INCLUDE_DIR)

Is there away to get around this to get work on freeBSD? and is there any plan for the future to support a freeBSD release as well?

Cheers

@Surgams Surgams changed the title Building of FreeBSD Building on FreeBSD Jul 6, 2018
@babelouest
Copy link
Owner

Hello @bluecub ,

Thanks for the support!
The quick workaround is to build yder without systemd logging, then install ulfius:

$ git clone https://github.com/babelouest/yder.git
$ cd yder/
$ mkdir build
$ cd build
$ cmake .. -DWITH_JOURNALD=off
$ make && sudo make install
$ cd ../../ulfius # or cd /path/to/ulfius/source
$ mkdir build && cd build
$ cmake .. && make && sudo make install

This should fix your problem.
I'll also add the option -DWITH_JOURNALD to Ulfius CMake script as well so systems without systemd installed will be able to install Ulfius more easily.

About FreeBSD port of Ulfius, I would like to have one, although I don't know nor use any *BSD on a daily basis.
So I'm very cool with the idea, but I can't make it myself at the moment. If you volunteer to make a BSD port, that would be awesome!

@Surgams
Copy link
Author

Surgams commented Jul 7, 2018

Thanks I will try it and let you know how it goes. Cheers

@babelouest
Copy link
Owner

It's even better than that, thanks to CMake's magic!

All you need is to pass the argument -DWITH_JOURNALD=off to cmake when you build Ulfius and this options will be passed to sub libraries, so Yder will be built without systemd support.

$ cd <ulfius source>
$ mkdir build
$ cd build
$ cmake -DWITH_JOURNALD=off ..
$ make && sudo make install

@Surgams
Copy link
Author

Surgams commented Jul 9, 2018

Thanks so much, I really appreciate your support ... had another tiny issue which I will look into it as I’m not familiar with cmake. FreeBSD keeps user installed lib in /usr/local/lib and /usr/local/include and to link it is needed to add the path in cmake.
Cheers

@babelouest
Copy link
Owner

Maybe try with DESTDIR: https://cmake.org/cmake/help/v3.0/variable/CMAKE_INSTALL_PREFIX.html

$ make DESTDIR=/home/john install

@Surgams
Copy link
Author

Surgams commented Jul 10, 2018

The error I am getting is as below because it seems CMake does not find headers installed in /usr/local/include by default. On FreeBSD by default the local is /usr/local/include.

make
[ 7%] Building C object orcania-build/CMakeFiles/orcania.dir/src/base64.c.o
In file included from /home/code/app/lib/ulfius/build/orcania-src/src/base64.c:10:
/home/code/app/lib/ulfius/build/orcania-src/src/../include/orcania.h:14:10: fatal error: 'jansson.h' file not found
#include <jansson.h>
^~~~~~~~~~~

The solution I guess must be something like this... yet I am not sure where I should add this

if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
  set(CMAKE_REQUIRED_INCLUDES "/usr/local/include" "/usr/include")
endif()

@babelouest
Copy link
Owner

That's weird, because /usr/include is the default include path for Linux as well. So it should look in this path as well obviously.
How did you install jansson library? Using the source, a freeBSD port, something else?

@Surgams
Copy link
Author

Surgams commented Jul 10, 2018

Yes using FreeBSD ports. All user installed libs go to /usr/local/lib and headers to /usr/local/include. In normal make I add those in the CFLags.

@Surgams
Copy link
Author

Surgams commented Jul 10, 2018

$pkgconf --cflags jansson
-I/usr/local/include

@babelouest
Copy link
Owner

Sorry, I misread you last message and mixed /usr/include and /usr/local/include.

I could add a constant path in the include search but I'd rather keep this script as much system agnostic as possible.
Can you check, then maybe change your environment variable C_INCLUDE_PATH and see if it works?

See:
http://www.network-theory.co.uk/docs/gccintro/gccintro_23.html
https://docs.freebsd.org/info/gcc/gcc.info.Environment_Variables.html

@Surgams
Copy link
Author

Surgams commented Jul 10, 2018

I want to add that path to which file in the package I should add it?
Thanks

@babelouest
Copy link
Owner

Can you try with the environment variable first?

@Surgams
Copy link
Author

Surgams commented Jul 10, 2018

Environment variable solved that issue. Thanks :)

@babelouest
Copy link
Owner

Awesome!
I'll add this in the install document :)

@babelouest
Copy link
Owner

@bluecub , if Ulfius builds completely on your FreeBSD, I'd close this issue then.

If you have other problems or concerns, don't hesitate to open a new issue on the repo.

@Surgams
Copy link
Author

Surgams commented Jul 10, 2018

Thanks

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

No branches or pull requests

2 participants