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 port #90

Closed
crmabs opened this issue Apr 26, 2022 · 13 comments
Closed

windows port #90

crmabs opened this issue Apr 26, 2022 · 13 comments

Comments

@crmabs
Copy link

crmabs commented Apr 26, 2022

Hi,
Before I'm getting lost in the maze I'd like to ask this: Is it possible to compile it for windows? I can imagine that the question sounds rather stupid , sorry about that. I'm just hoping it's not.
I tried compiling in different environments (cygwin, mingw, etc) but so far I wasn't able to squeeze out an exe. It all went well, hunted down packages then re-run your scripts like a good boy,... close-yet-so-far
So - Could you pls point me to the right direction? Is it possible at all or flat out nonsense?
Thanks:
Andras

ps: Alright, now I noticed that the INSTALL contains info about compiling to different platforms. So the question above is answered.
Instead I got a cheeky one: I'm looking for one proper way to do it, possibly with/close to the simplicity of the linux compile. My head is spinning from the so many options and possibilities regarding cross compiling.

@hpjansson
Copy link
Owner

It's a good question.

It's meant to be "not too hard" to get it working (I kept portability in mind while writing it -- for instance, it uses GLib, which provides Windows compatibility wrappers for threading and I/O). But AFAIK no one has so far actually built it successfully on Windows. That includes me, because I haven't had the time to try it yet :)

In past projects, I've used MXE and (later) some awful scripts of my own to do cross-compilation, but I don't know if that's a good option anymore.

@oakes mentioned using Scoop to install the toolchain in #72. It's a similar issue to this one, but with a twist: He's using an embedded GLib, which makes the build more self-contained.

How far are you getting? Are you getting past configure, running make?

@crmabs
Copy link
Author

crmabs commented Apr 27, 2022

Hi,
Comparing to this the linux build is nothing. :))) I know, packages available widely. But to see the process I tried to build on linux first. And it's always very interesting how others solve stuff...

So, autogen.sh ends up successfully:
--- Success! You can now run tools/chafa/chafa, or install everything
--- using make install or sudo make install.

Make fails ...
make output
https://drive.google.com/file/d/1u7m87MDS9jY_U0q0ZFlqk4La9lfw8_-i/view?usp=sharing

autogen output
https://drive.google.com/file/d/1DBYg26j6HhI_1EUuDMHjopz_aXpdkFgc/view?usp=sharing

Mingw64 was used for the adventure.

This is getting interesting, many thanks for your time!!!

@cdluminate
Copy link
Collaborator

Maybe we can setup a CI for windows build and see how far it goes

@cdluminate
Copy link
Collaborator

according to the buildlog, the build failed because the linker cannot find _spawnv

bin/sh ../libtool  --tag=CC   --mode=link gcc -Wall -Wextra -Wmissing-prototypes -ffast-math  -DLODEPNG_NO_COMPILE_ENCODER -DLODEPNG_NO_COMPILE_DISK -DLODEPNG_NO_COMPILE_CPP -DLODEPNG_NO_COMPILE_CRC -I/mingw64/include/glib-2.0 -I/mingw64/lib/glib-2.0/include -mms-bitfields -I/mingw64/include  -g -O2 -fvisibility=hidden   -o term-info-test.exe term-info-test.o -L/mingw64/lib -lglib-2.0 -lintl  ../chafa/libchafa.la 
libtool: link: gcc -Wall -Wextra -Wmissing-prototypes -ffast-math -DLODEPNG_NO_COMPILE_ENCODER -DLODEPNG_NO_COMPILE_DISK -DLODEPNG_NO_COMPILE_CPP -DLODEPNG_NO_COMPILE_CRC -I/mingw64/include/glib-2.0 -I/mingw64/lib/glib-2.0/include -mms-bitfields -I/mingw64/include -g -O2 -fvisibility=hidden -o .libs/term-info-test.exe term-info-test.o  -L/mingw64/lib ../chafa/.libs/libchafa.a -lglib-2.0 -lintl
./.libs/lt-term-info-test.c: In function 'main':
./.libs/lt-term-info-test.c:319:16: warning: implicit declaration of function '_spawnv'; did you mean 'spawnv'? [-Wimplicit-function-declaration]
  319 |   rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
      |                ^~~~~~~
      |                spawnv
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /tmp/ccyz6v8N.o: in function `main':
/a/repo/chafa/tests/./.libs/lt-term-info-test.c:319: undefined reference to `_spawnv'
collect2: error: ld returned 1 exit status
strip: './term-info-test.exe': No such file
../libtool: line 11128: ./term-info-test.exe: No such file or directory
make[2]: Leaving directory '/a/repo/chafa/tests'
Making all in tools

@hpjansson
Copy link
Owner

Awesome work. It's not looking too bad, you're both probably running into a Libtool issue, or something similar to it. I've added a few commits to master that may help to work around it.

Let me know if the error goes away or not.

If it doesn't, ./autogen.sh --disable-shared could also help. You won't be getting the shared library then, but I guess it's of limited use on Windows anyway unless you're building another app on top of Chafa with conflicting license terms or something.

@hpjansson
Copy link
Owner

I expect there will be a few more issues to solve once it builds to make it pass the "actually does something" test :-)

@hpjansson
Copy link
Owner

@cdluminate @crmabs Did you get a chance to rerun the build with current master? I'm hoping commits f7e600b and 395e9f6 will improve things.

@crmabs
Copy link
Author

crmabs commented May 28, 2022

@hpjansson sorry not yet. I'm back soon and trust me I'll report the progress.

@hpjansson
Copy link
Owner

chafa_dos

Well well well.

@hpjansson
Copy link
Owner

I'm still curious to hear if it builds successfully in the various Windows-oriented environments. It'd be nice to get it into repositories/package managers too (I've been using MXE and am submitting a PR there).

@oakes
Copy link

oakes commented Jul 1, 2022

For me I still get the same SIGSEGV I mentioned in #72 but it's great that it builds with mingw now.

@hpjansson
Copy link
Owner

@oakes Thanks for testing it again. I might take a crack at Scoop this weekend, see if I can make sense of it.

@hpjansson
Copy link
Owner

We eventually solved this in #72. Chafa is now available in MXE and I know about a couple of people who've built it successfully there. I've also got static Windows binaries on the download page.

I think that's all for this issue. Please reopen if there's anything else!

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

4 participants