davidmoreno / onion

C library to create simple HTTP servers and Web Applications.
http://www.coralbits.com/libonion/
Other
2.02k stars 250 forks source link

How to compile Examples #218

Closed khusseini closed 6 years ago

khusseini commented 6 years ago

Hello there,

I have been looking around in this repository for answers but couldn't find any. How do I compile the examples (specifically the hello example)?

I tried using cmake with two different approaches:

cd examples/hello
cmake .
make

or

cd examples/hello
mkdir build; cd build;
cmake ..
make

Both result in an error

./hello: error while loading shared libraries: libonion.so.0: cannot open shared object file: No such file or directory

I have installed onion like so:

git clone ...
mkdir build
cd build
cmake ..
make
sudo make install

What am I doing wrong?

davidmoreno commented 6 years ago

You have to follow the main compilation steps, and the examples should have the Makefiles generated and already compiled. No need for another "cmake".

If the examples are not automatically compiled, it may be that they need an optional not available library, as libpam or gnutls. Check the "cmake .." output from the general installation steps.

So in resume:

git clone...
cd onion
mkdir build
cd build
cmake ..
make
cd examples/hello
# we are now at onion/build/examples/hello
./hello

(not tested)

khusseini commented 6 years ago

Thanks for your help :) How would you go about building your own application? Are there any best practices or guidance documents?

davidmoreno commented 6 years ago

AFAIK not, but check the wiki at github.

You can check https://github.com/davidmoreno/garlic as a possible simple example on how to do it.

On 21 September 2017 at 12:39, Khairi Husseini notifications@github.com wrote:

Thanks for your help :) How would you go about building your own application? Are there any best practices or guidance documents?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/davidmoreno/onion/issues/218#issuecomment-331119758, or mute the thread https://github.com/notifications/unsubscribe-auth/AATsuhqK0VMmmPqivMfEkQvnDHr0ixP_ks5skjz1gaJpZM4Pd5ku .

-- David Moreno Montero

dmoreno@coralbits.com +34 658 18 77 17 [image: Coralbits.com] http://www.coralbits.com/ http://www.coralbits.com