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 Windows (and Github CI) #729

Closed
mgautierfr opened this issue Aug 26, 2024 · 3 comments
Closed

Building on Windows (and Github CI) #729

mgautierfr opened this issue Aug 26, 2024 · 3 comments
Assignees

Comments

@mgautierfr
Copy link
Member

mgautierfr commented Aug 26, 2024

This issue is a tracking issue about the native compilation of our projects on Windows,
including CI/CD on Github CI

Xapian compilation

This big (and most problematic) point is Xapian compilation.
Xapian build system is based on autotools.
It works well on Unix or Windows with tools like msys2 but we want to compile without msys2.

So a port of the build system has been made to Meson. This can be found in repository https://github.com/openzim/xapian-meson.
This build system mostly work but have few issues:

Upstream issue is https://trac.xapian.org/ticket/832

Libmicrohttpd

We are using meson build system coming from wrapdb. It has a small bug about detection of a type length. A patch is applied (and present) in kiwix-build (#726). Patch has also be sent upstream and is under discussion (mesonbuild/wrapdb#1625)
Edit 2024-09-01 : Patch has been accepted upstream.

Libzim

Libzim compiles correctly (except COMPACT_FULLER thing) on Windows.
Both static and dynamic.
However, dynamic building generate a lot of warning as we have stl symbols in our class and we must re-export them. See d2d1f68 (#703)

Libkiwix

libkiwix was never tested on Windows. Now we can and we have discover some bugs. They are fixed in kiwix/libkiwix#1113.
Until then, test are deactivated on kiwix-build windows CI (04d0ba6)

Tests are fixed on libkiwix.

Libkiwix build only statically as we don't export symbol (see "About dllexport symbols")

zim-tools

zimwriterfs is using libmagic to detect the mimetype of the file to add.
libmagic is also using autotool as build system and we have to port it to meson as made for xapian (but should be simpler)

However, it not need as top priority as zimwriterfs is deactivated by zim-tools meson if we are compiling to/on Windows.
#728 is building zim-tools on github windows CI.

Edit 2024-08-27: This is not only about libmagic. zimcheck also uses getopt to parse command line and I have strange error in metadata-test

Edit 2024-0901: zim-tools (without zimwriterfs) is compiled natively on Window using github CI

kiwix-tools

kiwix-tools uses getopt to parse command line.
We currently have not build for it on Windows. We have several solutions:

  • Port kiwix-tools and use docoptcpp (as zim-tools) as it is already available in our toolchain (Port kiwix-tools to docoptcpp kiwix-tools#691)
  • getopt is a simple function, we can copy it in kiwix-tools and use this implementation as fallback (as libmagic is doing).
  • Find a project providing getopt on Windows as build it as dependency in kiwix-build.

Edit 2024-09-01: kiwix-tools has been ported to docoptcpp and is compiled natively on Window using github CI

kiwix-desktop

  • Dependencies of kiwix-desktop is build by kiwix-build.
  • kiwix-desktop CI is now using those dependencies to compile at each PR ([CI] Compile on Windows kiwix-desktop#1184)
  • kiwix-build also publish nigthly of kiwix-desktop
  • Appveyor build is not removed. To remove once build in github CI is tested ok
  • kiwix-desktop is not signed.

Edit 2024-09-01: Kiwix compiles natively on Windows (github CI). It is published as nightly and release will be signed. Appveyor CI has been removed.

About dllexport symbols.

When compiling dynamically (dll) on Windows, we have to declare what symbols are exported in the dll (other symbols are private).
This can be done either by using __declspec(dllexport) attribute in our headers or using a .def file which list exported symbols.

Libzim takes the first way. However, as said, it generates a lot of warning as we are declaring/using stl symbols in our class and we are not reexporting them. (See d2d1f68 (#703) and linked links for more information). The importance of those warning are not totally known. But they are annoying anyway.
Note that using a .def file to export the same symbols would probably have the same effect.

Another solution is to export ALL symbols in the dll. The consequence of this is not totally known (at least by me). It seems that autotools and CMAKE have an option to generate a .def which contains all the symbols but meson have not (mesonbuild/meson#2132).

I have ported such a script in python (https://gist.github.com/mgautierfr/11eb53379bf063f965614dcc9b6baef7) and propose it to meson to integrate it mesonbuild/meson#2132

Quick testing shows that we could generate a dll and link to it.

Ping @rgaudin @kelson42 @veloman-yunkan

@veloman-yunkan

This comment was marked as off-topic.

@mgautierfr

This comment was marked as off-topic.

@kelson42
Copy link
Contributor

kelson42 commented Sep 2, 2024

@mgautierfr Thank you for the wrap-up, each of the remaining issue, should be put in a dedicated issue.

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

5 participants
@mgautierfr @kelson42 @veloman-yunkan and others