GithubHelp home page GithubHelp logo

small fix for Windows about orcania HOT 14 CLOSED

silvioprog avatar silvioprog commented on July 24, 2024
small fix for Windows

from orcania.

Comments (14)

silvioprog avatar silvioprog commented on July 24, 2024 2

Full steps:

Firstly, download and install ("next... next... finish" setup style) MinGW-w64 using MSYS2 installer, open the fresh installed terminal MSYS2 MinGW 32-bit (or MSYS2 MinGW 64-bit for 64 bits) and run all commands showed on the site. After that, install all required tools and libraries:

pacman -S --needed git
pacman -S --needed base-devel
pacman -S --needed mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain
pacman -S --needed mingw-w64-i686-cmake mingw-w64-x86_64-cmake
pacman -S --needed mingw-w64-i686-check mingw-w64-x86_64-check # (optional)
pacman -S --needed mingw-w64-i686-jansson mingw-w64-x86_64-jansson # (optional)

Now, download, build and install Orcania:

git clone https://github.com/babelouest/orcania.git
cd orcania/
git checkout cmake
mkdir build
cd build/
cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=/mingw32 .. # or `/mingw64` for 64 bits
make install/strip

and done, enjoy Orcania static/shared library! :-) The striped Ocania's DLL file is installed in C:\msys32\mingw32\bin\liborcania-1.dll.

Additional commands:

  • use sudo make install (without /strip) if you want the debugging version
  • use pkg-config to get library info, e.g: pkg-config liborcania --libs
  • use make test to run all tests (if check was installed)
  • use make dist to generate a production tag.gz file (use gpg --detach-sign <orcania-package>.tar.gz to sign it)
  • use make package to generate the basic .deb/.rpm packages

P.S.: I don't know what was forgotten from my PRs/patches, but I already fixed this problem in previous commits I've sent:

$ make
[ 12%] Building C object CMakeFiles/orcania.dir/src/orcania.c.obj
C:/msys32/home/duall/orcania/src/orcania.c: In function 'o_strnstr':
C:/msys32/home/duall/orcania/src/orcania.c:277:12: error: implicit declaration of function 'strnstr'; did you mean 'strstr'? [-Werror=implicit-function-declaration]
     return strnstr(haystack, needle, len);
            ^~~~~~~
            strstr
C:/msys32/home/duall/orcania/src/orcania.c:277:12: error: return makes pointer from integer without a cast [-Werror=int-conversion]
     return strnstr(haystack, needle, len);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys32/home/duall/orcania/src/orcania.c: In function 'o_strcasestr':
C:/msys32/home/duall/orcania/src/orcania.c:289:12: error: implicit declaration of function 'strcasestr'; did you mean 'o_strcasestr'? [-Werror=implicit-function-declaration]
     return strcasestr(haystack, needle);
            ^~~~~~~~~~
            o_strcasestr
C:/msys32/home/duall/orcania/src/orcania.c:289:12: error: return makes pointer from integer without a cast [-Werror=int-conversion]
     return strcasestr(haystack, needle);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1.exe: all warnings being treated as errors
make[2]: *** [CMakeFiles/orcania.dir/build.make:111: CMakeFiles/orcania.dir/src/orcania.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/orcania.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

from orcania.

silvioprog avatar silvioprog commented on July 24, 2024 1

You're welcome dude! :-) Now I'm debugging Yder building to fix ExternalProject_Add() calling ...

from orcania.

babelouest avatar babelouest commented on July 24, 2024

Thanks, I'll apply the patch to the branch cmake.

Can you tell what are the correct commands under a mingw shell to build orcania? I'll add to the INSTALL.md at the same time then.

from orcania.

babelouest avatar babelouest commented on July 24, 2024

Thanks @silvioprog ,

I've updated the CMakefile and orcania.c with your feedbacks, but something must have been missing, I can't run the command make test from the build/ folder, have I missed something?

from orcania.

babelouest avatar babelouest commented on July 24, 2024

OK I think I found it, there were some lines commented out or functionnalities disabled. I think I have something working full now!

from orcania.

silvioprog avatar silvioprog commented on July 24, 2024

On Linux (Xubuntu) it works fine, on Windows (building on /c/dev/git/orcania/build):

$ cmake -G "MSYS Makefiles" -DBUILD_TESTING=ON ..
$ make test
Running tests...
Test project C:/dev/git/orcania/build
[ 66%] Built target orcania
Scanning dependencies of target str_test
[ 83%] Building C object CMakeFiles/str_test.dir/test/str_test.c.obj
[100%] Linking C executable str_test.exe
[100%] Built target str_test
[ 66%] Built target orcania
Scanning dependencies of target split_test
[ 83%] Building C object CMakeFiles/split_test.dir/test/split_test.c.obj
[100%] Linking C executable split_test.exe
[100%] Built target split_test
[ 66%] Built target orcania
Scanning dependencies of target memory_test
[ 83%] Building C object CMakeFiles/memory_test.dir/test/memory_test.c.obj
C:/dev/git/orcania/test/memory_test.c: In function 'test_o_malloc':
C:/dev/git/orcania/test/memory_test.c:18:7: error: argument 1 value '4294967295' exceeds maximum object size 2147483647 [-Werror=alloc-size-larger-than=]
   var = malloc(-1);
   ~~~~^~~~~~~~~~~~
In file included from C:/dev/git/orcania/test/memory_test.c:4:0:
C:/msys32/mingw32/i686-w64-mingw32/include/stdlib.h:503:17: note: in a call to allocation function 'malloc' declared here
   void *__cdecl malloc(size_t _Size);
                 ^~~~~~
C:/dev/git/orcania/test/memory_test.c: In function 'test_o_realloc':
C:/dev/git/orcania/test/memory_test.c:30:11: error: argument 2 value '4294967295' exceeds maximum object size 2147483647 [-Werror=alloc-size-larger-than=]
   new_var = realloc(var, -1);
   ~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from C:/dev/git/orcania/test/memory_test.c:4:0:
C:/msys32/mingw32/i686-w64-mingw32/include/stdlib.h:504:17: note: in a call to allocation function 'realloc' declared here
   void *__cdecl realloc(void *_Memory,size_t _NewSize);
                 ^~~~~~~
cc1.exe: all warnings being treated as errors
make[4]: *** [CMakeFiles/memory_test.dir/build.make:63: CMakeFiles/memory_test.dir/test/memory_test.c.obj] Error 1
make[3]: *** [CMakeFiles/Makefile2:201: CMakeFiles/memory_test.dir/all] Error 2
make[2]: *** [CMakeFiles/Makefile2:208: CMakeFiles/memory_test.dir/rule] Error 2
make[1]: *** [Makefile:249: memory_test] Error 2
Problem running command: C:/msys32/usr/bin/make.exe str_test split_test memory_test jansson_test
Problem executing pre-test command(s).
Errors while running CTest
make: *** [Makefile:130: test] Error 8

(it was already fixed in PRs too 😶 )

from orcania.

babelouest avatar babelouest commented on July 24, 2024

OK, it was due to ugly tests that shouldn't exist anyway, is it OK now?

from orcania.

silvioprog avatar silvioprog commented on July 24, 2024

Almost there ...

$ make test
Running tests...
Test project C:/dev/git/orcania/build
Scanning dependencies of target orcania
[ 16%] Building C object CMakeFiles/orcania.dir/src/base64.c.obj
[ 33%] Building C object CMakeFiles/orcania.dir/src/memory.c.obj
[ 50%] Building C object CMakeFiles/orcania.dir/src/orcania.c.obj
[ 66%] Linking C shared library liborcania-1.dll
[ 66%] Built target orcania
Scanning dependencies of target str_test
[ 83%] Building C object CMakeFiles/str_test.dir/test/str_test.c.obj
[100%] Linking C executable str_test.exe
[100%] Built target str_test
[ 66%] Built target orcania
Scanning dependencies of target split_test
[ 83%] Building C object CMakeFiles/split_test.dir/test/split_test.c.obj
[100%] Linking C executable split_test.exe
[100%] Built target split_test
[ 66%] Built target orcania
Scanning dependencies of target memory_test
[ 83%] Building C object CMakeFiles/memory_test.dir/test/memory_test.c.obj
[100%] Linking C executable memory_test.exe
[100%] Built target memory_test
[ 66%] Built target orcania
Scanning dependencies of target jansson_test
[ 83%] Building C object CMakeFiles/jansson_test.dir/test/jansson_test.c.obj
[100%] Linking C executable jansson_test.exe
[100%] Built target jansson_test
    Start 1: str_test
1/4 Test #1: str_test .........................***Failed    0.06 sec
    Start 2: split_test
2/4 Test #2: split_test .......................   Passed    0.02 sec
    Start 3: memory_test
3/4 Test #3: memory_test ......................   Passed    0.02 sec
    Start 4: jansson_test
4/4 Test #4: jansson_test .....................   Passed    0.05 sec

75% tests passed, 1 tests failed out of 4

Total Test time (real) =   0.17 sec

The following tests FAILED:
          1 - str_test (Failed)
Errors while running CTest
make: *** [Makefile:130: test] Error 8

$ ./str_test.exe
Running suite(s): Orcania tests string functions
94%: Checks: 18, Failures: 1, Errors: 0
C:/dev/git/orcania/test/str_test.c:25:P:test_orcania_str:test_str_replace:0: Passed
C:/dev/git/orcania/test/str_test.c:36:P:test_orcania_str:test_o_strdup:0: Passed
C:/dev/git/orcania/test/str_test.c:51:P:test_orcania_str:test_o_strndup:0: Passed
C:/dev/git/orcania/test/str_test.c:63:P:test_orcania_str:test_o_strcmp:0: Passed
C:/dev/git/orcania/test/str_test.c:76:P:test_orcania_str:test_o_strncmp:0: Passed
C:/dev/git/orcania/test/str_test.c:87:P:test_orcania_str:test_o_strcasecmp:0: Passed
C:/dev/git/orcania/test/str_test.c:100:P:test_orcania_str:test_o_strncasecmp:0: Passed
C:/dev/git/orcania/test/str_test.c:111:P:test_orcania_str:test_o_strcpy:0: Passed
C:/dev/git/orcania/test/str_test.c:122:P:test_orcania_str:test_o_strncpy:0: Passed
C:/dev/git/orcania/test/str_test.c:133:P:test_orcania_str:test_o_strstr:0: Passed
C:/dev/git/orcania/test/str_test.c:145:P:test_orcania_str:test_o_strnstr:0: Passed
C:/dev/git/orcania/test/str_test.c:154:P:test_orcania_str:test_o_strchr:0: Passed
C:/dev/git/orcania/test/str_test.c:164:P:test_orcania_str:test_o_strrchr:0: Passed
C:/dev/git/orcania/test/str_test.c:172:P:test_orcania_str:test_o_strlen:0: Passed
C:/dev/git/orcania/test/str_test.c:181:F:test_orcania_str:test_msprintf:0: Assertion 'target == "target1 str1 42 0000000000000000"' failed: target == "target1 str1 42 00000000", "target1 str1 42 0000000000000000" == "target1 str1 42 0000000000000000"
C:/dev/git/orcania/test/str_test.c:196:P:test_orcania_str:test_trimwhitespace:0: Passed
C:/dev/git/orcania/test/str_test.c:230:P:test_orcania_str:test_base64:0: Passed
C:/dev/git/orcania/test/str_test.c:216:P:test_orcania_str:test_string_array:0: Passed

from orcania.

babelouest avatar babelouest commented on July 24, 2024

should be fixed now, thanks.

from orcania.

silvioprog avatar silvioprog commented on July 24, 2024

100% working on Linux and Windows!

from orcania.

babelouest avatar babelouest commented on July 24, 2024

I'll release the cmake scripts when all my libraries will be ready, but this should not be very long now, thank to your help!

from orcania.

silvioprog avatar silvioprog commented on July 24, 2024

Oops, I found a small issue in the Orcania building. ^^' Could I send it as patch here on comments or via PR?

from orcania.

babelouest avatar babelouest commented on July 24, 2024

I guess so, thanks

from orcania.

silvioprog avatar silvioprog commented on July 24, 2024

Done: #15. Now Yder will found Orcania's version via pkginfo. :-)

from orcania.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.