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

Not Default-compileable on Windows #26

Open
ZxBiohazardZx opened this issue Jul 25, 2024 · 3 comments
Open

Not Default-compileable on Windows #26

ZxBiohazardZx opened this issue Jul 25, 2024 · 3 comments

Comments

@ZxBiohazardZx
Copy link

I have attempted to compile this on a windows32 system, but multiple issues occur:

CLOCK_MONOTONIC_RAW does not exist. this was an easy fix, as CLOCK_MONOTONIC works fine and was already suggested in a PR for UBUNTU

Threading:

pthread_setname_np is not supported on this system occurs for any non-linux or non-macos builds.

maybe i should look into SetThreadDescription(GetCurrentThread(), threadName) == S_OK) as option

will continue if needed.

is there someone that is good in making this work for windows?

@ZxBiohazardZx
Copy link
Author

ZxBiohazardZx commented Jul 25, 2024

gcc -pthread -Wall -I include -MT obj/bush.o -MMD -MP -MF .depend/bush.Td -Wextra -Wwrite-strings -Wno-parentheses -Winline -Wpedantic -Warray-bounds -fcommon -c src/bush.c -I include -o obj/bush.o
gcc -pthread -Wall -I include -MT obj/convexcombination.o -MMD -MP -MF .depend/convexcombination.Td -Wextra -Wwrite-strings -Wno-parentheses -Winline -Wpedantic -Warray-bounds -fcommon -c src/convexcombination.c -I include -o obj/convexcombination.o
gcc -pthread -Wall -I include -MT obj/datastructures.o -MMD -MP -MF .depend/datastructures.Td -Wextra -Wwrite-strings -Wno-parentheses -Winline -Wpedantic -Warray-bounds -fcommon -c src/datastructures.c -I include -o obj/datastructures.o
gcc -pthread -Wall -I include -MT obj/fileio.o -MMD -MP -MF .depend/fileio.Td -Wextra -Wwrite-strings -Wno-parentheses -Winline -Wpedantic -Warray-bounds -fcommon -c src/fileio.c -I include -o obj/fileio.o
gcc -pthread -Wall -I include -MT obj/main.o -MMD -MP -MF .depend/main.Td -Wextra -Wwrite-strings -Wno-parentheses -Winline -Wpedantic -Warray-bounds -fcommon -c src/main.c -I include -o obj/main.o
gcc -pthread -Wall -I include -MT obj/networks.o -MMD -MP -MF .depend/networks.Td -Wextra -Wwrite-strings -Wno-parentheses -Winline -Wpedantic -Warray-bounds -fcommon -c src/networks.c -I include -o obj/networks.o
gcc -pthread -Wall -I include -MT obj/parallel_bush.o -MMD -MP -MF .depend/parallel_bush.Td -Wextra -Wwrite-strings -Wno-parentheses -Winline -Wpedantic -Warray-bounds -fcommon -c src/parallel_bush.c -I include -o obj/parallel_bush.o
gcc -pthread -Wall -I include -MT obj/tap.o -MMD -MP -MF .depend/tap.Td -Wextra -Wwrite-strings -Wno-parentheses -Winline -Wpedantic -Warray-bounds -fcommon -c src/tap.c -I include -o obj/tap.o
gcc -pthread -Wall -I include -MT obj/thpool.o -MMD -MP -MF .depend/thpool.Td -Wextra -Wwrite-strings -Wno-parentheses -Winline -Wpedantic -Warray-bounds -fcommon -c src/thpool.c -I include -o obj/thpool.o
In file included from src/thpool.c:21:
include/thpool.h:194:5: error: expected declaration specifiers or '...' before string constant
  194 | err("thread_do(): pthread_setname_np is not supported on this system");
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/thpool.c: In function 'thpool_pause':
src/thpool.c:247:53: error: 'SIGUSR1' undeclared (first use in this function)
  247 |         pthread_kill(thpool_p->threads[n]->pthread, SIGUSR1);
      |                                                     ^~~~~~~
src/thpool.c:247:53: note: each undeclared identifier is reported only once for each function it appears in
src/thpool.c: In function 'thread_do':
src/thpool.c:334:22: error: storage size of 'act' isn't known
  334 |     struct sigaction act;
      |                      ^~~
src/thpool.c:335:5: error: implicit declaration of function 'sigemptyset' [-Wimplicit-function-declaration]
  335 |     sigemptyset(&act.sa_mask);
      |     ^~~~~~~~~~~
src/thpool.c:338:9: error: implicit declaration of function 'sigaction' [-Wimplicit-function-declaration]
  338 |     if (sigaction(SIGUSR1, &act, NULL) == -1) {
      |         ^~~~~~~~~
src/thpool.c:338:19: error: 'SIGUSR1' undeclared (first use in this function)
  338 |     if (sigaction(SIGUSR1, &act, NULL) == -1) {
      |                   ^~~~~~~
src/thpool.c:334:22: warning: unused variable 'act' [-Wunused-variable]
  334 |     struct sigaction act;
      |                      ^~~
make: *** [Makefile:83: obj/thpool.o] Error 1

the actual output from the compiler on windows after fixing CLOCK_MONOTONIC

@ZxBiohazardZx
Copy link
Author

Edit:

i got the compiler to work for windows by altering the whole code to use windows calls. if someone more proficient would be able to integrate them and make them an actual switch rather then hard alteration let me know... ill make a PR for the changes once i confirm results are as expected

@ZxBiohazardZx
Copy link
Author

coming to think of it, it would/could be better to migrate the thpool.c into thpool_win and just generate a switch for windows to use that instead of the original?

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

1 participant