Mail Archives: djgpp/2021/06/21/08:27:10
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f
|
X-Recipient: | djgpp AT delorie DOT com
|
ARC-Seal: | i=1; a=rsa-sha256; t=1624278419; cv=none;
|
| d=zohomail.com; s=zohoarc;
|
| b=Y3HJY0ipUiWJPYOQjYKjVH+rWrA55tvkUnOoNBEv3Ohqn8ETYoquGElCxw7RMxbOP218K2TYG5tafaFlmU2VA9u0gtrjAuj4ea/1bC0qs1IP00d8wzD+0VIxCjwR3JxSO3vzSG7ps5CP9PY2clmak13q2lNw7et6WpGWBR9W1tY=
|
ARC-Message-Signature: | i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc;
|
| t=1624278419; h=Content-Type:Date:From:MIME-Version:Message-ID:Subject:To;
|
| bh=gxUFslDyprwXNXz2xJHVFRdbV0XOLPFB7G/mLUypqbo=;
|
| b=TGi1SB4v3w5wgdwFDrZXP/DFoNIq+O0EnXI9xF3hIKf9+jw0HZpC+FtG+wfQ6vgvqIXdbkrQytK9dBugm6PI5IW8EhREuMxJcB1btxqhCd4dTM/8nhKAJIFjzgUo5X2lMNzz5q/0owfgX5xK+fVzZ1nhIgADqaK85hTpIICBm7U=
|
ARC-Authentication-Results: | i=1; mx.zohomail.com;
|
| dkim=pass header.i=zoho.com;
|
| spf=pass smtp.mailfrom=dufresnep AT zoho DOT com;
|
| dmarc=pass header.from=<dufresnep AT zoho DOT com>
|
DomainKey-Signature: | a=rsa-sha1; q=dns; c=nofws;
|
| s=zapps768; d=zoho.com;
|
| h=date:from:to:message-id:in-reply-to:subject:mime-version:content-type:user-agent;
|
| b=m4EHAzzMu+LMWMKNofZcnSLuTZcE/bURhncXURiCEjsY5+dZl7eNyJJRjCczEJxfIjKMa0oFJNOc
|
| fP+OjSnh+hp0qE5wg9YiSvabJJGV6vXWPhcdbqJH3UuxwIzJTATi
|
X-Original-DKIM-Signature: | v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1624278419;
|
| s=zm2020; d=zoho.com; i=dufresnep AT zoho DOT com;
|
| h=Date:From:To:Message-Id:In-Reply-To:Subject:MIME-Version:Content-Type;
|
| bh=gxUFslDyprwXNXz2xJHVFRdbV0XOLPFB7G/mLUypqbo=;
|
| b=PEBR/bRYGcrZPxAksnnszM6bcLMDQUssICigZ/SNXQ9ChgJqAQJi27YJ/zEgyZ9I
|
| +x8MzATQ+4WxwjU2rZF/MDYsAg9WSE4i76R+DwozFr6e09MnK29tSBOvx6UXYn0nKbb
|
| kiNTV8Lok//m/8WUVJuvm+gSNIZRJbgyMdLkvr54=
|
Date: | Mon, 21 Jun 2021 08:26:53 -0400
|
From: | "Paul Dufresne (dufresnep AT zoho DOT com) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
|
To: | "djgpp" <djgpp AT delorie DOT com>
|
Message-Id: | <17a2e89b1d2.1044467a864026.4287440461235414665@zoho.com>
|
In-Reply-To: | |
Subject: | sys/select.h missing for pth.h (pthread)
|
MIME-Version: | 1.0
|
Importance: | Medium
|
User-Agent: | Zoho Mail
|
X-Mailer: | Zoho Mail
|
Reply-To: | djgpp AT delorie DOT com
|
------=_Part_176021_1045841627.1624278413778
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 //#include <pthread.h>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #include <pth.h>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #include <stdio.h>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #include <stdlib.h>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #include <unistd.h>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #include <signal.h>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #include <errno.h>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* Simple error handling functions */
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #define handle_error_en(en, msg) \
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 do { errno =3D en; perror(msg); exit(EXIT_FAILURE); } while (0)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 static void *
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 sig_thread(void *arg)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 sigset_t *set =
=3D arg;
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 int s, sig;
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 for (;;) {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 s =3D sigwait(set, &sig);
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 if (s !=3D 0)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 handle_error_en(s, "sigwait");
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 printf("Signal handling thread got signal %d\n", sig);
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 int
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 main(int argc, char *argv[])
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 {
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pthread_t thre=
ad;
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 sigset_t set;h=
ttps://github.com/jwt27/build-gcc
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 int s;
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* Block SIGQU=
IT and SIGUSR1; other threads created by main()
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 will inherit a copy of the signal mask. */
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 sigemptyset(&s=
et);
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 sigaddset(&set=
, SIGQUIT);
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 sigaddset(&set=
, SIGUSR1);
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 s =3D pthread_=
sigmask(SIG_BLOCK, &set, NULL);
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (s !=3D 0)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 handle_error_en(s, "pthread_sigmask");
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 s =3D pthread_=
create(&thread, NULL, &sig_thread, &set);
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (s !=3D 0)
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 handle_error_en(s, "pthread_create");
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* Main thread=
carries on to create other threads and/or do
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 other work. */
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pause();=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* Dummy pause=
so we can test program */
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 }
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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=3D/home/paul/opt/cros=
s
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-msdosdjg=
pp/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.o=
rg/qt5/include/sys/select.h.html
paul AT 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 erro=
r: sys/wtime.h: No such file or directory
=C2=A0=C2=A0 43 | #include <sys/wtime.h>=C2=A0=C2=A0=C2=A0=C2=A0 /* for str=
uct timespec */
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 ^~~~~~~~~~~~~
compilation terminated.
paul AT 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 erro=
r: sys/socket.h: No such file or directory
=C2=A0=C2=A0 45 | #include <sys/socket.h>=C2=A0=C2=A0=C2=A0 /* for sockaddr=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 */
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 ^~~~~~~~~~~~~~
compilation terminated.
paul AT kasparno:~/sigset$ i386-pc-msdosdjgpp-gcc sigset.c -lpthread -lpth
In file included from /home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/p=
th.h:47,
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 from sigset.c:2:
/home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/sys/select.h:21:10: fat=
al error: features.h: No such file or directory
=C2=A0=C2=A0 21 | #include <features.h>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 ^~~~~~~~~~~~
compilation terminated.
paul AT kasparno:~/sigset$=20
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.
------=_Part_176021_1045841627.1624278413778
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>=
<meta content=3D"text/html;charset=3DUTF-8" http-equiv=3D"Content-Type"></h=
ead><body ><div style=3D"font-family: Verdana, Arial, Helvetica, sans-serif=
; font-size: 10pt;"><div>Goal: recompile <a target=3D"_blank" href=3D"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=3D"_blank" href=3D"https://man7.org/linux/man-pages/man3/pthread=
_sigmask.3.html">https://man7.org/linux/man-pages/man3/pthread_sigmask.3.ht=
ml</a><br></div><div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<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></di=
v><div> #include <unistd.h><br></=
div><div> #include <signal.h><br>=
</div><div> #include <errno.h><br=
></div><div><br></div><div> /* Simple e=
rror handling functions */<br></div><div><br></div><div> &=
nbsp; #define handle_error_en(en, msg) \<br></div><div> &n=
bsp;  =
; do { errno =3D en; perror(msg); exit(EXIT_FAILURE); } while (0)<br></div>=
<div><br></div><div> static void *<br><=
/div><div> sig_thread(void *arg)<br></d=
iv><div> {<br></div><div> &n=
bsp; sigset_t *set =3D arg;<br></=
div><div> int s=
, sig;<br></div><div><br></div><div> &nb=
sp; for (;;) {<br></div><div> &nbs=
p; s =3D sigwait(set,=
&sig);<br></div><div> &=
nbsp; if (s !=3D 0)<br></div><div>  =
; &n=
bsp; handle_error_en(s, "sigwait");<br></div><div> &=
nbsp; &nbs=
p; printf("Signal handling thread got signal %d\n", sig);<br></div><div>&nb=
sp; }<br></div><div>&=
nbsp; }<br></div><div><br></div><div> &n=
bsp; int<br></div><div> &nbs=
p; main(int argc, char *argv[])<br></div><div>  =
; {<br></div><div> &nb=
sp; pthread_t thread;<br></div><div> &nb=
sp; sigset_t set;<a target=3D"_blank" href=3D=
"https://github.com/jwt27/build-gcc">https://github.com/jwt27/build-gcc</a>=
<br></div><div> =
int s;<br></div><div><br></div><div> &n=
bsp; /* Block SIGQUIT and SIGUSR1; other threads created =
by main()<br></div><div> &nb=
sp; will inherit a copy of the signal mask. */<br><=
/div><div><br></div><div> &n=
bsp; sigemptyset(&set);<br></div><div> &nb=
sp; sigaddset(&set, SIGQUIT);<br></div><d=
iv> sigaddset(&=
amp;set, SIGUSR1);<br></div><div> =
s =3D pthread_sigmask(SIG_BLOCK, &set, NULL);<br></d=
iv><div> if (s =
!=3D 0)<br></div><div>  =
; handle_error_en(s, "pthread_sigmask");<br><=
/div><div><br></div><div> &n=
bsp; s =3D pthread_create(&thread, NULL, &sig_thread, &se=
t);<br></div><div> &nb=
sp; if (s !=3D 0)<br></div><div> &=
nbsp; handle_error_en(s, "pthread_creat=
e");<br></div><div><br></div><div>  =
; /* Main thread carries on to create other threads and/o=
r do<br></div><div> &n=
bsp; other work. */<br></div><div><br></div><div> &n=
bsp; pause(); &n=
bsp; /* Dummy pause so we c=
an test program */<br></div><div> }<br>=
</div><div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<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=3D"_blank" href=3D"https://github.com/jwt27/build-gcc">https://git=
hub.com/jwt27/build-gcc</a> with PREFIX=3D/home/paul/opt/cross<br></div><di=
v><br></div><div>I have unzip <a target=3D"_blank" href=3D"http://www.delor=
ie.com/pub/djgpp/current/v2gnu/pth207b.zip">http://www.delorie.com/pub/djgp=
p/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>Whil=
e 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 dow=
nload it from: <a target=3D"_blank" href=3D"https://code.woboq.org/qt5/incl=
ude/sys/select.h.html">https://code.woboq.org/qt5/include/sys/select.h.html=
</a><br></div><div><br></div><div>paul AT kasparno:~/sigset$ i386-pc-msdosdjgp=
p-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>&=
nbsp; 43 | #include <sys/wtime.h> /* fo=
r struct timespec */<br></div><div> | &n=
bsp; ^~~~~~~~~~~~~<br></div><div>=
compilation terminated.<br></div><div>paul AT kasparno:~/sigset$ i386-pc-msdos=
djgpp-gcc sigset.c -lpthread -lpth<br></div><div>In file included from sigs=
et.c:2:<br></div><div>/home/paul/opt/cross/i386-pc-msdosdjgpp/sys-include/p=
th.h:45:10: fatal error: sys/socket.h: No such file or directory<br></div><=
div> 45 | #include <sys/socket.h> /* fo=
r sockaddr */<br></div><div> =
; | =
^~~~~~~~~~~~~~<br></div><div>compilation terminated.<br></div><div>p=
aul AT 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>&n=
bsp; 21 | #include <features.h><br></div><div>  =
; | ^~~~~=
~~~~~~~<br></div><div>compilation terminated.<br></div><div>paul AT 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></di=
v></div><br></body></html>
------=_Part_176021_1045841627.1624278413778--
- Raw text -