Goal: recompile
http://ftp.gnu.org/gnu/chess/gnuchess-6.2.8.tar.gz in Linux for FreeDOS project.
Subgoal:
Compile the following program taken from:
https://man7.org/linux/man-pages/man3/pthread_sigmask.3.html
===============
//#include <pthread.h>
#include <pth.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
/* Simple error handling functions */
#define handle_error_en(en, msg) \
do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)
static void *
sig_thread(void *arg)
{
sigset_t *set = arg;
int s, sig;
for (;;) {
s = sigwait(set, &sig);
if (s != 0)
handle_error_en(s, "sigwait");
printf("Signal handling thread got signal %d\n", sig);
}
}
int
main(int argc, char *argv[])
{
pthread_t thread;
sigset_t set;
https://github.com/jwt27/build-gcc
int s;
/* Block SIGQUIT and SIGUSR1; other threads created by main()
will inherit a copy of the signal mask. */
sigemptyset(&set);
sigaddset(&set, SIGQUIT);
sigaddset(&set, SIGUSR1);
s = pthread_sigmask(SIG_BLOCK, &set, NULL);
if (s != 0)
handle_error_en(s, "pthread_sigmask");
s = pthread_create(&thread, NULL, &sig_thread, &set);
if (s != 0)
handle_error_en(s, "pthread_create");
/* Main thread carries on to create other threads and/or do
other work. */
pause(); /* Dummy pause so we can test program */
}
=============
I changed #include <pthread.h> to <pth.h>
I might still be confused between pthread.h and pth.h.
I use:
https://github.com/jwt27/build-gcc with PREFIX=/home/paul/opt/cross
I have unzip
http://www.delorie.com/pub/djgpp/current/v2gnu/pth207b.zip in a temporary dir
I have copied: /pth/lib/ into /home/paul/opt/cross/i386-pc-msdosdjgpp/lib/
adjusting lastl line of .la files to that directory.
I have copied pth.h and pthread.h to: /home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/
While trying to compile subgoal program: I just commented out #include line not working in pth.h...
except for sys/select: I finished to download it from:
https://code.woboq.org/qt5/include/sys/select.h.html
paul@kasparno:~/sigset$ i386-pc-msdosdjgpp-gcc sigset.c -lpthread -lpth
In file included from sigset.c:2:
/home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/pth.h:43:10: fatal error: sys/wtime.h: No such file or directory
43 | #include <sys/wtime.h> /* for struct timespec */
| ^~~~~~~~~~~~~
compilation terminated.
paul@kasparno:~/sigset$ i386-pc-msdosdjgpp-gcc sigset.c -lpthread -lpth
In file included from sigset.c:2:
/home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/pth.h:45:10: fatal error: sys/socket.h: No such file or directory
45 | #include <sys/socket.h> /* for sockaddr */
| ^~~~~~~~~~~~~~
compilation terminated.
paul@kasparno:~/sigset$ i386-pc-msdosdjgpp-gcc sigset.c -lpthread -lpth
In file included from /home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/pth.h:47,
from sigset.c:2:
/home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/sys/select.h:21:10: fatal error: features.h: No such file or directory
21 | #include <features.h>
| ^~~~~~~~~~~~
compilation terminated.
paul@kasparno:~/sigset$
So, the sys/select.h (that I put in /home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/sys/ ).
That's where I am at for now... asking here for help.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta content="text/html;charset=UTF-8" http-equiv="Content-Type"></head><body ><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt;"><div>Goal:
recompile <a target="_blank" href="
http://ftp.gnu.org/gnu/chess/gnuchess-6.2.8.tar.gz">http://ftp.gnu.org/gnu/chess/gnuchess-6.2.8.tar.gz</a> in Linux for FreeDOS project.<br></div><div><br></div><div>Subgoal:<br></div><div>Compile the following program
taken from: <a target="_blank" href="
https://man7.org/linux/man-pages/man3/pthread_sigmask.3.html">https://man7.org/linux/man-pages/man3/pthread_sigmask.3.html</a><br></div><div>===============<br></div><div> //#include <
pthread.h><br></div><div> #include <pth.h><br></div><div> #include <stdio.h><br></div><div> #include <stdlib.h><br></div><div>
#include <unistd.h><br></div><div> #include <signal.h><br></div><div> #include <errno.h><br></div><div><br></div><div> &
nbsp; /* Simple error handling functions */<br></div><div><br></div><div> #define handle_error_en(en, msg) \<br></div><div>
do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)<br></div><div><br></div><div> static void *<br></div><div> sig_thread(void *arg)<br></div><div> &
nbsp; {<br></div><div> sigset_t *set = arg;<br></div><div> int s, sig;<br></div><div><br></div><div> &
nbsp; for (;;) {<br></div><div> s = sigwait(set, &sig);<br></div><div> &
nbsp; if (s != 0)<br></div><div> handle_error_en(s, "sigwait");<br></div><div> &
nbsp; printf("Signal handling thread got signal %d\n", sig);<br></div><div> }<br></div><div> }<br></div><div><br></div><
int<br></div><div> main(int argc, char *argv[])<br></div><div> {<br></div><div>
pthread_t thread;<br></div><div> sigset_t set;<a target="_blank" href="
https://github.com/jwt27/build-gcc">https://github.com/jwt27/build-gcc</a><br></div><div> &
nbsp; int s;<br></div><div><br></div><div> /* Block SIGQUIT and SIGUSR1; other threads created by main()<br></div><div> &
nbsp; will inherit a copy of the signal mask. */<br></div><div><br></div><div> sigemptyset(&set);<br></div><div> &
nbsp; sigaddset(&set, SIGQUIT);<br></div><div> sigaddset(&set, SIGUSR1);<br></div><div> s = pthread_sigmask(SIG_BLOCK, &
set, NULL);<br></div><div> if (s != 0)<br></div><div> handle_error_en(s, "pthread_sigmask");<br></div><div><br>
</div><div> s = pthread_create(&thread, NULL, &sig_thread, &set);<br></div><div> if (s != 0)<br></div><div> &
nbsp; handle_error_en(s, "pthread_create");<br></div><div><br></div><div> /* Main thread carries on to create other threads and/
or do<br></div><div> other work. */<br></div><div><br></div><div> pause(); &
nbsp; /* Dummy pause so we can test program */<br></div><div> }<br></div><div>=============<br></div><div>I changed #include <pthread.h> to <pth.h><br></div><div>I might still be confused
between pthread.h and pth.h.<br></div><div><br></div><div>I use: <a target="_blank" href="
https://github.com/jwt27/build-gcc">https://github.com/jwt27/build-gcc</a> with PREFIX=/home/paul/opt/cross<br></div><div><br></div><div>I have unzip <a target="_
blank" href="
http://www.delorie.com/pub/djgpp/current/v2gnu/pth207b.zip">http://www.delorie.com/pub/djgpp/current/v2gnu/pth207b.zip</a> in a temporary dir<br></div><div><br></div><div>I have copied: /pth/lib/ into /home/paul/opt/cross/i386-pc-msdosdjgpp/
lib/<br></div><div>adjusting lastl line of .la files to that directory.<br></div><div><br></div><div>I have copied pth.h and pthread.h to: /home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/<br></div><div><br></div><div>While trying to compile subgoal
program: I just commented out #include line not working in pth.h...<br></div><div>except for sys/select: I finished to download it from: <a target="_blank" href="
https://code.woboq.org/qt5/include/sys/select.h.html">https://code.woboq.org/qt5/include/sys/
select.h.html</a><br></div><div><br></div><div>paul@kasparno:~/sigset$ i386-pc-msdosdjgpp-gcc sigset.c -lpthread -lpth<br></div><div>In file included from sigset.c:2:<br></div><div>/home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/pth.h:43:10: fatal
error: sys/wtime.h: No such file or directory<br></div><div> 43 | #include <sys/wtime.h> /* for struct timespec */<br></div><div> | &
nbsp; ^~~~~~~~~~~~~<br></div><div>compilation terminated.<br></div><div>paul@kasparno:~/sigset$ i386-pc-msdosdjgpp-gcc sigset.c -lpthread -lpth<br></div><div>In file included from sigset.c:2:<br></div><div>/home/paul/opt/cross/i386-pc-msdosdjgpp/sys-
include/pth.h:45:10: fatal error: sys/socket.h: No such file or directory<br></div><div> 45 | #include <sys/socket.h> /* for sockaddr */<br></div><div> &
nbsp; | ^~~~~~~~~~~~~~<br></div><div>compilation terminated.<br></div><div>paul@kasparno:~/sigset$ i386-pc-msdosdjgpp-gcc sigset.c -lpthread -lpth<br></div><div>In file included from /home/paul/opt/
cross/i386-pc-msdosdjgpp/sys-include/pth.h:47,<br></div><div> from sigset.c:2:<br></div><div>/home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/sys/select.h:
21:10: fatal error: features.h: No such file or directory<br></div><div> 21 | #include <features.h><br></div><div> | ^~~~~~~~~~~~<br></div><div>
compilation terminated.<br></div><div>paul@kasparno:~/sigset$ <br></div><div><br></div><div>So, the sys/select.h (that I put in /home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/sys/ ).<br></div><div><br></div><div>That's where I am at for now...
asking here for help.<br></div></div><br></body></html>
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)