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
Add MS-Windows support ? #11
Comments
Thanks. I modified Makefile and it should produce dll on windows now, could you verify? |
Yes it works , thank you ! 👍 |
any chance i can bump this ticket and @pRot0ta1p for knowing if youre running emacs inside msys2 or natively using the windows builds of emacs form the main site. I cannot seem to get the latest code to build/run correctly per the information here. I will create a new ticket if pRot0ta1p can let me know more detail on how they are using the setup (inside msys2 or not) |
I use emacs inside msys2, but I think the promlem is with the Makefile, try apply this patch to Makefile and make sure the compiled .dll file is inside your diff --git a/Makefile b/Makefile
index d890d78..c627f5d 100644
--- a/Makefile
+++ b/Makefile
@@ -7,17 +7,17 @@ LDFLAGS=-L$(PREFIX)/lib
LDLIBS=-lxapian
# Dylib extensions.
-ifeq ($(OS),Windows_NT)
- SOEXT = dll
-endif
ifeq ($(shell uname),Darwin)
SOEXT = dylib
else
SOEXT = so
endif
+ifeq ($(OS),Windows_NT)
+ SOEXT = dll
+endif
xapian-lite.$(SOEXT): module/xapian-lite.cc
$(CXX) $< -o $@ -shared $(CXXFLAGS) $(LDFLAGS) $(LDLIBS)
clean:
- rm -f *.so *.o
+ rm -f *.so *.o *.dll |
Hmmm, could you explain what does this change fix? |
The goal is to produce a dll file on windows, the catch with msys2 is that it is also a unix environment, so ifeq ($(shell uname),Darwin)
SOEXT = dylib
else
SOEXT = so
endif will cause SOEXT = so in msys2, this will compile a xapian-lite.so without error but emacs in mingw64 is a native win64 application ( the official win distribution of emacs is compiled with mingw64 toolchain) and only recognize the native dll file, so to fix this, I moved the ifeq Windows_NT part behind so SOEXT will be dll. |
@pRot0ta1p Thank you for the clarity. I had come up with a similar process but I'm getting an error on GPL compatibility. @casouri The patch will fixup the build for msys2 so the dll is properly generated and found by emacs when loading xeft. For both of y'all: I'm getting a gpl compatibility error (below) when loading The error: Full build process: export PATH=/mingw64/bin/:${PATH} # setup g++ binary discovery for make
pacman -Syyu # upgrade to latest software
# some of the below packages may be unneeded
pacman -S --needed mingw-w64-x86_64-xapian-core git base-devel mingw-w64-x86_64-toolchain # install needed tools
mkdir ~/.emacs.d
cd ~/.emacs.d
git clone https://github.com/casouri/xeft.git /opt/xeft
cd xeft
g++ -o xapian-lite.dll -shared -fPIC -I/mingw64/include -L/mingw64/include -lxapian -lWs2_32 -municode # build xeft
# add activation for xeft to init.el
# launch emacs then xeft with "M-x xeft [RET]" Emacs (add-to-list 'load-path "~/.emacs.d/xeft")
(require 'xeft)
; xeft-database
; xeft-directory
; xeft-default-extension
; xeft-recursive |
I have also tried the below changes to the code to try to force-export the nano -w module/xapian-lite.cc
Change: int plugin_is_GPL_compatible;
To: __declspec(dllexport) int plugin_is_GPL_compatible;
Change:
int
emacs_module_init(struct emacs_runtime *ert)
To:
int __declspec(dllexport)
emacs_module_init(struct emacs_runtime *ert) |
I don't think Msys2 can have concurrent version fo g++, its rolling release-ish kinda like archlinux. In terms of your build proccess, I don't quite understand why you need to export PATH variable and call g++ manually instead of just invoke |
well that is a new way of launching mysy2. I'll try that and report back soon. Thank you for the tip. |
With the patch at #11 (comment) I can run the below procedure to compile and use xeft inside msys2. If you install the
|
You can also auto run the msys2 mingw emacs directly from a windows shortcut (these can be pinned to the taskbar) using the below.
It'll launch using the |
Ah, yes, duh. I fixed the makefile. IIUC that's the only thing that needs fixing right? |
Yes, issue solved confirmed , thank you. |
the instructions i added to the ticket may be good for windows userts ; or at least knowing to use the flavor of mingw noted above and the msys2 package thatll get you a native emacs ui ; these ended up being really important things for me to start using xeft. Good stuff too btw ; this does what I wanted 💯 |
I'll draft a PR on the windows instruction stuff later, I run emacs master branch in msys2 on windows as daily. |
Does this solution only suitable for emacs installed from mingw? I use the native emacs binary from GNU Emacs mirror and follow this instruction. However, although the xapian-lite.dll has been properly generated, when I execute
|
For ms-windows I tried using msys2 to compile the module , and it turns out not hard to do.
All I need todo is first install package mingw-w64-x86_64-xapian-core and change the
xapian-lite.so
toxapian-lite.dll
in Makefile.Can you change the Makefile so it produce a .dll file in ms-windows instead of a .so file? This and the msys2 dependency is all it need to make xeft work on windows.
The text was updated successfully, but these errors were encountered: