Open FrankRay78 opened 1 year ago
My mistake. Because this implementation of asciichart is written in C, and also because it uses meson for the build (which is cross-platform), I mistakenly believed the codebase would naturally be cross-platform as well. It turns out that it has been written for Linux and not Windows.
An example is the use of sigaction
in animate.c, which is Linux only.
Compiling it on Windows results in the following build error:
The code would need to change with a conditional statement to include platform specific code, as per:
ref: https://medium.com/codex/running-open-source-software-on-windows-50dd1231cae9
The other problem I see is also the missing getopts C library/functions which also are not included on windows.
Correct, plot has not been tested on windows, and I don't have much knowledge of windows.
I’m going to see if I can get it working on windows, I don’t think the code changes will be too extensive. If I do manage it, I’ll submit a PR for your consideration. I’d really like to be able to use plot in my cross-platform app, if possible. Nice work on the port btw.
Hello @annacrombie, I think I'm pretty close to having plot compile on both Linux and Windows now. I've persisted with this as largely a learning exercise, and it seems the Microsoft C compiler has a few known quirks when it comes to the meson build system. Can I please ask if you remember what Linux distros / compilers you used when developing plot? If you remember, I'd be interested in testing my changes on these to make sure I haven't introduced a regression somewhere.
I primarily develop on alpine linux with gcc. This is a pretty standard setup aside from the fact that alpine linux uses musl libc rather than glibc, which means that some non-standard extensions that some programs expect are not present.
One other thing since it seems you are intending on submitting a PR -- I prefer doing platform specific code without using #ifdefs when possible. One strategy I use a lot is this:
src = files(...)
if platform == 'windows'
src += 'src/platform/windows/example.c'
else
src += 'src/platform/posix/example.c'
endif
// include/platform/example.h
// Define some common api functions
void do_this(int);
// src/platform/windows/example.c
void
do_this(int)
{
// windows-specific code
}
// src/platform/posix/example.c
void
do_this(int)
{
// posix-specific code
}
Build output when performing
meson build
meson.build
file with the offending line:Any ideas what library 'm' is, and how I might be able to fix this error?