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

Windows Install oatpp-zlib #4

Open
lganzzzo opened this issue Feb 23, 2022 · 0 comments
Open

Windows Install oatpp-zlib #4

lganzzzo opened this issue Feb 23, 2022 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@lganzzzo
Copy link
Member

By @AlexandreHURDYK

I think I've successfully managed to compile oatpp-zlib for windows. Here's the procedure :

You will need the following files :

  • zlib.h
  • zconf.h
  • zlib.lib
  • oatpp must be compiled and installed on your computer.

Steps :

  • Create a folder containing all your zlib components.

  • Open a console in administrator mode. This is very important, otherwise you won't be able to compile anything.

  • Clone the repo : $ git clone https://github.com/oatpp/oatpp-zlib.git

  • Enter the directory : $ cd oatpp-zlib

  • Create the build directory : $ mkdir build

  • Go inside that directory : $ cd build

  • Execute the following command :

    $ cmake .. -DZLIB_INCLUDE_DIR=PATH\TO\zlib\INCLUDES -DZLIB_LIBRARY=PATH\TO\zlib.lib
    

    Mind the -DZLIB_LIBRARY argument ! You need to literally make it point to your zlib.lib file (ex : C:/path/to/zlib/zlib.lib).
    Otherwise, you will get compilation errors.

    Another compilation error I personally encountered is due to a missing "unistd.h" library. The thing is, unistd.h is a Linux library
    and you're not supposed to be able to use it on windows (though some compilers seem to have a built in version of unistd.h for
    windows). If you get compilation errors related to unistd.h, you may have to edit zconf.h :
    --> Find the following three lines (I've personally found them starting from line 434 in the zconf.h file) :

    #if 1 
    #  define Z_HAVE_UNISTD_H
    #endif

    --> Comment them. This should prevent unistd from being used. I recommend saving your precedent version of zconf.h before
    doing something like this.

  • FINAL STEP : perform the following command depending which kind of application you want to run :
    --> For a debug application : $ cmake --build . --target INSTALL
    --> For a release application : $ cmake --build . --target INSTALL --config Release

If at this point you get mismatch errors, it means your oatpp installation directory doesn't match the compilation mode of your library : you will need to re-compile oatpp with a compilation mode matching the one you chose for the oatpp-zlib module (debug for debug, release for release).
Small reminder about how to compile oatpp :

$ git clone https://github.com/oatpp/oatpp.git
$ cd oatpp\
$ MD build
$ cd build\

$ cmake ..
//For a debug app :
$ cmake --build . --target INSTALL 
//For a release app :
$ cmake --build . --target INSTALL --config Release
@lganzzzo lganzzzo added the documentation Improvements or additions to documentation label Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant