delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2022/01/26/06:30:24

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; s=arcselector9901; d=microsoft.com; cv=none;
b=VagJHkn44FNFNmor8YeXSRTdOaOVv7TyQJJ4kar378VOBPf4YQHB1yEAjy1tDTWIf8gt72aEw/sbH23hBRGZBgC2O3urEq6qFcIbfSnwVmbHxWwFjneyOpnAjMBO/JZV50Dwx+lG9INxnFKtDBrUCpvD4cKHAQLyugUgBRFwJS9qhydsyLxni7DzlYDWrK1bIqPnokirGOYQHtLyPsxs8wuJecT2DwEjJniozj3wvXchPxPC5dctj+BdHIzTBKqkMj6ppApdYcrWW95HBsWYuRtEWCDhNQhdotkLWNBS58qbYWAR8DJXFu4GoEt40gECSAaV6fBPiMvMK8Io/RoPMg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector9901;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=4MmZlNuvFd2JZovpSEeZrXLgK+7G8l6gVsD4OFJw4so=;
b=Lc7l+tV9U0nSF+aXhFxO7hifk1+JVMUzSN+yJI1IwlIhrCKT0NuLLmHOUtXXQ/WbGbriULhv58JRpL3QixriZfAuX0jGN6MTCiyLUAamGnemxV1GGbvLg9OdrY3ejCLGX+Qbq9af8bq2En9QCckfK3TMoxaSuDTp7KfrPzg6awNFmmjc74rck0qFUGtTWkkpoxhAdAUfV26Vzc1y4JVePJCRFWWTpRp6YNfpLctBgNgLX54Z0uE+D0rs6iEN4PMTjZ28tqGpeE7Tte331qPSR+foMRqkm6R4UTVvmUHDGtn2KcyAU5iH4R9Kq3AeaMPJOXKSy/X2yl8cSn3decbm9A==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none;
dkim=none; arc=none
X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com;
s=selector1;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=4MmZlNuvFd2JZovpSEeZrXLgK+7G8l6gVsD4OFJw4so=;
b=RUziC+9mZewO0GeTgKhuZat9ImbFx+SOrZygNTMD31bZAtvAjFonxArCyTIMh2gXg+ClI179PegBtgVcaPQTcgXkvPUAr2rIL3umXvARqUVuHhQK7K9iTTI43Dz6X56iOyRTxOExdj7fhYKAj13lZ+CUEkIRPsu3ZoE69oOulNNFgVo+B+/6FQvQuBnNfMACMcseBxtKvcZuqIPYDIIYoyWXTDjeHOpk+dTh3NFWIOXE8xkHRgQ8H9mSJf5TU61Fo04BFpgs3EaJD94kF3T3FGCDNzFGkM2eLfEZY5BXaGx6AMsXItKSjLe/UxZSwdeFB2nixXk/Pml9F/ZoAhdYVA==
From: "Jay K (jayk123 AT hotmail DOT com) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
To: "djgpp AT delorie DOT com" <djgpp AT delorie DOT com>
Subject: Re: command line length problems?
Thread-Topic: command line length problems?
Thread-Index: AQHYEqgO378iML9TM0+Fyd/vmysVYA==
Date: Wed, 26 Jan 2022 11:30:01 +0000
Message-ID:
<MWHPR1401MB1951A1E9DA9688FF49E522C1E6209 AT MWHPR1401MB1951 DOT namprd14 DOT prod DOT outlook DOT com>
References:
<MWHPR1401MB1951CCC95276E44447921D28E6209 AT MWHPR1401MB1951 DOT namprd14 DOT prod DOT outlook DOT com>
In-Reply-To:
<MWHPR1401MB1951CCC95276E44447921D28E6209 AT MWHPR1401MB1951 DOT namprd14 DOT prod DOT outlook DOT com>
Accept-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
suggested_attachment_session_id: cbf04818-e028-e11d-047a-b4167b893180
x-tmn: [sdUgSjWc6ryrDWlQo1bVvzZC5J7LjGhtmunLfI4OsGK+Tot2n3NZMICDiFXIiQ/C]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 84c185b3-072d-492f-25c6-08d9e0bf3100
x-ms-traffictypediagnostic: BY5PR14MB3397:EE_
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info:
OtQweI1aP9DTy8YkT420oQvgQrWIYdRgCQ5CLCY+UJcHKe8j2XgUHJGvXaEnkHwmFiPn6L+mAagScTbZQ4/xTap6+PgUufpDZ6MezpB0PI3iUzETqgHp0662RiZ11f6MKSMx8Jmp+LZERb1Wmb1lMg8Dw2oX9BuXNC60lj5lWTYm1Xqms8h6yWHWSfQN/LHRiK1zNjAl97Ef0nyNREe1jWeXtBqRdAOfwH97QUY5+0+gHXDiMddkMM3cMMUuRBlVKQXZtdIm38IFIa4F7QeH0GNIxwFksBEsOSnI6UZc1qqAHSgypn8wXaCIww9YcdXmeIHCZtZ4WE2sm0Z5IPoDGWw9CvFn6GRuA2oJaJJhKc+2+9HGzZYPW5QUubgs1ArRyZ6UgZxtSEdGaVDdba0NwoKsgvM96nYnmheS2oshCmAEf0yYyyUM51lnEZSeN2xhtyfo49fP/7wFfrvZ/UQInLj6hpMPTwk3Gg8M2zQZdkiJtgndacthDrmUsykDmdri4E+sOlouaxF1QYA0uiIg6q85tXooF7CqgzL8hRFSRNN3Ex0mvSXoS3xCGq2OXYfEeMofwQ2mhbKRIECsrO7+aVPTSyLEklmrKEgHLQLaOx2jXNR9ZW/2/Kkwq71sCnfCed3uirC4DdHGWNtLQR8BY5XoqwwZ9PkHGOJTPwvIYcU=
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0:
=?iso-8859-1?Q?LFuc7GThtg7OR7WtYyJkgJiKnE5WuQy8UgZ+pe7Uwe+bmA8RnP7+vbmIfd?=
=?iso-8859-1?Q?8cxpeVOEjYQXxKV+Tc7oZUAAG7tH+EckBx9QHs8o+/BlTSKKNjjfKugjZG?=
=?iso-8859-1?Q?pwc15r4aT6XcFwZgZv5dtI/IiFgqJapLkH5Sl80SpDsG5DP1hVCGfHVFh6?=
=?iso-8859-1?Q?uORVtrKRokXT6+31XieswM1Sjy5+XSs4BgXFUDuoUZndvb18niTT46+WdN?=
=?iso-8859-1?Q?Tklx1Kn78VAZhqdrE7oLOGR1ifjEnld2eDc8M9yDIimzXtT3fWEvgha1xo?=
=?iso-8859-1?Q?3DzsIvUavgRZo6LQT6chogiAJUEiT7gzcwilCE4uESsNF3szUbWzIXEzDT?=
=?iso-8859-1?Q?Ak8SWwH7+qKlkPN6KqJHd0OugIICGIWz9YnbP9883A9cxtYrbo62/yHDX3?=
=?iso-8859-1?Q?OXDWYA/peNxEN32WASWSDV+fnqIJ5vNAuCkTDjOAgACmIdXmyQRET9DP+a?=
=?iso-8859-1?Q?RZi9vAQLyElc36PwxgoLONeaZIjPurdh1+5NVbq/zOkCIEvEksV4dA7VKQ?=
=?iso-8859-1?Q?jfK6sD0PgzLw4Y2AJYqBV6h1Tb/emrs+gUqlLk/JtQvjbEMXfq4zW+LalS?=
=?iso-8859-1?Q?6GVRriaE/JHjo8VyDUuc2Ji0O/QiyWnJCmpnT6ouERmwlN8vyEKb5bmRRD?=
=?iso-8859-1?Q?cxVqfA3cJbi1aTuIAU2RIN5fpcG2gzhQbgkOblEJCZkJrNDD7I99KYQSyx?=
=?iso-8859-1?Q?pWkkbH+zw9nFkJ/R7oRdYMfQ2HceizuA65ZMkUnGxE0xV+LCpd9ASQUJPJ?=
=?iso-8859-1?Q?VUaOsNV98b80aZFKm3zHTaSyJhhWmn8k021vvEg8isL+UM1yhVSJKGLYss?=
=?iso-8859-1?Q?MAantLTZLWJ8DrfaD69dXfzAjtwQ6SpBphwFEaiVx0Ve5YxPIoS74sNRcP?=
=?iso-8859-1?Q?T/v2T7434YfDIJ3yyogxI5tfinSoPKHZPDktV9iGVXgbFzlR3as7M8NJDN?=
=?iso-8859-1?Q?Sn7DQfDmL68ieO+b4oVg2+C1XjdXot9DbzrUnBFu9SI2WFkwG12Awf2YMK?=
=?iso-8859-1?Q?GNujNTeK3HDrJHPMDZ1F9PmCEkzUpsvU62PlxN?=
MIME-Version: 1.0
X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-cd57b.templateTenant
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: MWHPR1401MB1951.namprd14.prod.outlook.com
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-CrossTenant-Network-Message-Id: 84c185b3-072d-492f-25c6-08d9e0bf3100
X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jan 2022 11:30:01.4323
(UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR14MB3397

--_000_MWHPR1401MB1951A1E9DA9688FF49E522C1E6209MWHPR1401MB1951_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Well I am having better results now under dosbox-x, though it is much slowe=
r.
Under 32bit Windows 10, trivial use of system() like with just a short comm=
and name and no parameters, fails.
From the source I can see, it is complicated.
There are flags, etc. There is CMDLINE for up to 1k command lines.
And newer gcc runs out of memory on small programs.
So it could be any number of things, and unfortunately gdb largely fails on=
 the 32bit Windows 10.

C:\dos>type exec.cpp
#include <stdio.h>
#include <string>
#include <stdlib.h>
using namespace std;

int main(int argc, char** argv)
{
int i;
string e =3D ".\\ech.exe";
for (i =3D 1; i < argc; ++i)
{
 e +=3D " ";
 e +=3D argv[i];
}
for (i =3D 1; i < argc; ++i)//again to make it longer
{
 e +=3D " ";
 e +=3D argv[i];
}
printf("%s\n"); //it does get here
system(e.c_str()); // fails in here
}

C:\dos>type cc.bat     hacky I know sorry

c:/dos/libexec/gcc/djgpp/4.94/cc1plus.exe -g -quiet -remap %1.cpp -o %1.s
as %1.s -o %1.o
ld c:/dos/lib/crt0.o %1.o -LC:/dos/lib/gcc/djgpp/4.94 -Lc:/dos/lib -lgcc -l=
c -lstdcxx -lgcc -lc -o %1.exe

C:\dos>go32-v2
go32/v2 version 2.0 built Oct 18 2015 09:41:08
Usage: go32 coff-image [args]
Rename this to go32.exe only if you need a go32 that can run v2 binaries as
 well as v1 binaries (old makefiles).  Put ahead of the old go32 in your PA=
TH
 but do not delete your old go32 - leave it in the PATH after this one.
Set GO32_V2_DEBUG=3Dy in the environment to get verbose output.

DPMI memory available: 1103989 Kb
DPMI swap space available: 0 Kb

C:\dos>cc.bat ech

C:\dos>c:/dos/libexec/gcc/djgpp/4.94/cc1plus.exe -g -quiet -remap ech.cpp -=
o ech.s

C:\dos>as ech.s -o ech.o

C:\dos>ld c:/dos/lib/crt0.o ech.o -LC:/dos/lib/gcc/djgpp/4.94 -Lc:/dos/lib =
-lgcc -lc -lstdcxx -lgcc -lc -o ech.exe

C:\dos>cc.bat exec

C:\dos>c:/dos/libexec/gcc/djgpp/4.94/cc1plus.exe -g -quiet -remap exec.cpp =
-o exec.s

C:\dos>as exec.s -o exec.o

C:\dos>ld c:/dos/lib/crt0.o exec.o -LC:/dos/lib/gcc/djgpp/4.94 -Lc:/dos/lib=
 -lgcc -lc -lstdcxx -lgcc -lc -o exec.exe

C:\dos>.\ech.exe a b c d
c:/dos/ech.exe
a
b
c
d

C:\dos>file ech.exe
ech.exe: DOS-executable compiled w/DJGPP (stub v2.05)

C:\dos>file exec.exe
exec.exe: DOS-executable compiled w/DJGPP (stub v2.05)

C:\dos>.\exec.exe a
a
Exiting due to signal SIGSEGV
Stack Fault at eip=3D00000a11
eax=3D00010001 ebx=3D00020080 ecx=3D0000d000 edx=3D000007bf esi=3D00002b2b =
edi=3D00002b1b
ebp=3D000c773a esp=3D000c773a program=3DC:\DOS\EXEC.EXE
cs: sel=3D00cf  base=3D000d3a70  limit=3D00000db0
ds: sel=3D00b7  base=3D000cc180  limit=3D0000ffff
es: sel=3D0040  invalid
fs: sel=3D0000
gs: sel=3D0000
ss: sel=3D00b7  base=3D000cc180  limit=3D0000ffff
App stack: [000c7ef0..00047ef0]  Exceptn stack: [00047e1c..00045edc]


C:\dos>gdb ech.exe
GNU gdb (GDB) 8.0.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.htm=
l>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=3Di786-pc-msdosdjgpp --target=3Ddjgpp".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ech.exe...done.
(gdb) break main
Breakpoint 1 at 0x16f1: file ech.cpp, line 5.
(gdb) r

---------------------------
16 bit MS-DOS Subsystem
---------------------------
C:\Windows\system32\cmd.exe - gdb  ech.exe
NTVDM has encountered a System Error
NTVDM has encountered a System Error 4001h Choose 'Close' to terminate the =
application.
---------------------------
Close   Ignore
---------------------------

but gdb works better under dosbox-x.

Funny/sad that 32bit Windows 10 is seemingly not the best MS-DOS here.

 - Jay

________________________________
From: Jay K
Sent: Wednesday, January 26, 2022 9:53 AM
To: djgpp AT delorie DOT com <djgpp AT delorie DOT com>
Subject: command line lenght problems?

Hi folks.

I am trying to port my program to MS-DOS. For fun, granted.
I figured DJGPP would help.
Esp. because it seems to have a useful "sigalarm" functionality,
I might use to implement preemptive threads.
I have a prototype that suggests that will work:
 https://github.com/modula3/cm3/blob/3be819ed8e2fa60885aff0cb6278934a17b307=
02/m3-libs/m3core/src/thread/POSIX/test_dos_threads.cpp

The rest of the Posix support helps also.
 I'm not sure about network/sockets, maybe give up.

I have experimented with a few "DOS"s.
 FreeDOS, DosBos-X, 32bit Windows 10 VM.

They all have advantages and disadvantages.

Granted I could spend more time configuring each and none is "really" MS-DO=
S.

My program is a compiler, that produces .cpp files and would run g++ or gxx=
, etc.
  (I might experiment with e.g. OpenWatcom, might, like if it can link the =
djpp libraries.)

I am seeing, I guess, command line length limitations.

gcc and collect2 crash, but if I run them manually with shorter equivalent-=
enough commands, they work.

Advise?

I tried trimming environment. That didn't help.
I tried running bash, thinking within there, maybe Djgpp would use
its technique to transfer command lines otherwise, but bash won't start.

bash:
---------------------------
16 bit MS-DOS Subsystem
---------------------------
Administrator: C:\Windows\system32\cmd.exe
NTVDM has encountered a System Error
NTVDM has encountered a System Error 4001h Choose 'Close' to terminate the =
application.
---------------------------
Close   Ignore
---------------------------


C:\dos>type 1.c
#include <stdio.h>
int main()
{
printf("hello\n");
}

C:\dos>gcc -v -c 1.c
Using built-in specs.
COLLECT_GCC=3Dc:/dos/bin/gcc.exe
Target: djgpp
Configured with: /gcc-9.30/configure djgpp --prefix=3D/dev/env/DJDIR --disa=
ble-werror --enable-languages=3Dc,c++,fortran,objc,obj-c++,ada --with-gcc-m=
ajor-version-only --enable-libquadmath-support --enable-lto --disable-libst=
dcxx-pch --enable-libstdcxx-filesystem-ts
Thread model: single
gcc version 9.3.0 (GCC)
COLLECT_GCC_OPTIONS=3D'-v' '-c' '-mtune=3Dpentium' '-march=3Dpentium'
 c:/dos/bin/../libexec/gcc/djgpp/9/cc1.exe -quiet -v -iprefix c:/dos/bin/..=
/lib/gcc/djgpp/9/ -remap 1.c -quiet -dumpbase 1.c -mtune=3Dpentium -march=
=3Dpentium -auxbase 1 -version -o c:/dos/tmp/cczF3Ew0.s
Exiting due to signal SIGSEGV
Stack Fault at eip=3D00000a11
eax=3D00010001 ebx=3D01ad0080 ecx=3D01549400 edx=3D004207bf esi=3D00001223 =
edi=3D00001213
ebp=3D0042773a esp=3D0042773a program=3DC:\DOS\BIN\GCC.EXE
cs: sel=3D00cf  base=3D000d3a50  limit=3D00000db0
ds: sel=3D00b7  base=3D000cc160  limit=3D0000ffff
es: sel=3D0040  invalid
fs: sel=3D0000
gs: sel=3D0000
ss: sel=3D00b7  base=3D000cc160  limit=3D0000ffff
App stack: [00423b78..00223b7c]  Exceptn stack: [00223ac8..00221b88]



C:\dos> c:/dos/bin/../libexec/gcc/djgpp/9/cc1.exe -quiet -v -iprefix c:/dos=
/bin/../lib/gcc/djgpp/9/ -remap 1.c -quiet -dumpbase 1.c -mtune=3Dpentium -=
march=3Dpentium -auxbase 1 -version -o c:/dos/tmp/cczF3Ew0.s
The system cannot execute the specified program.


c:/dos/bin/../libexec/gcc/djgpp/9/cc1.exe -iprefix c:/dos/bin/../lib/gcc/dj=
gpp/9/ -remap 1.c -quiet -dumpbase 1.c -o 1.s

=3D> success

as 1.s

 =3D> success

C:\dos>gcc 1.o -v
...

208 characters:
c:/dos/bin/../libexec/gcc/djgpp/9/collect2.exe c:/dos/lib/crt0.o -Lc:/dos/b=
in/../lib/gcc/djgpp/9 -Lc:/dos/bin/../lib/gcc -Lc:/dos/lib -Lc:/dos/bin/../=
lib/gcc/djgpp/9/../../.. -Lc:/dos/lib 1.o -lgcc -lc -lgcc

Exiting due to signal SIGSEGV
Stack Fault at eip=3D00000a11
eax=3D00010001 ebx=3D001c0080 ecx=3D001804

90 characters:
ld.exe c:/dos/lib/crt0.o 1.o -lgcc -lc -Lc:/dos/lib/gcc/djgpp/9 -Lc:/dos/li=
b -o a.exe

 =3D> success

.\a.exe

=3D> success


Suggestions?
I mean, worst case, I will run:

C:\dos>gcc --print-prog-name ld
c:/dos/bin/ld.exe

C:\dos>gcc --print-prog-name cc1
c:/dos/bin/../libexec/gcc/djgpp/9/cc1.exe

and run things more manually "like" that, with response files.

I had to reinvent the compiler driver though, it hides things so well.
I suppose I could run gcc directly with -v, capture the command lines,
change them to use response files and rerun them "verbatim", thereby
preserving the compiler driver.

Can/should the gcc driver handle this more automatically itself?

Thank you,
 - Jay

--_000_MWHPR1401MB1951A1E9DA9688FF49E522C1E6209MWHPR1401MB1951_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
Well I am having better results now under dosbox-x, though it is much slowe=
r.</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
Under 32bit Windows 10, trivial use of system() like with just a short comm=
and name and no parameters, fails.</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
From the source I can see, it is complicated.<br>
There are flags, etc. There is CMDLINE for up to 1k command lines.</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
And newer gcc runs out of memory on small programs.</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
So it could be any number of things, and unfortunately gdb largely fails on=
 the 32bit Windows 10.</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<div>C:\dos&gt;type exec.cpp</div>
<div>#include &lt;stdio.h&gt;</div>
<div>#include &lt;string&gt;</div>
<div>#include &lt;stdlib.h&gt;</div>
<div>using namespace std;</div>
<div><br>
</div>
<div>int main(int argc, char** argv)</div>
<div>{</div>
<div>int i;</div>
<div>string e =3D &quot;.\\ech.exe&quot;;</div>
<div>for (i =3D 1; i &lt; argc; ++i)</div>
<div>{</div>
<div>&nbsp;e +=3D &quot; &quot;;</div>
<div>&nbsp;e +=3D argv[i];</div>
<div>}</div>
<div>for (i =3D 1; i &lt; argc; ++i)//again to make it longer</div>
<div>{</div>
<div>&nbsp;e +=3D &quot; &quot;;</div>
<div>&nbsp;e +=3D argv[i];</div>
<div>}</div>
<div>printf(&quot;%s\n&quot;); //it does get here&nbsp;</div>
<div>system(e.c_str()); // fails in here</div>
<div>}</div>
<div><br>
</div>
<div>C:\dos&gt;type cc.bat&nbsp; &nbsp; &nbsp;hacky I know sorry</div>
<div>&nbsp;</div>
<div>c:/dos/libexec/gcc/djgpp/4.94/cc1plus.exe -g -quiet -remap %1.cpp -o %=
1.s</div>
<div>as %1.s -o %1.o</div>
<div>ld c:/dos/lib/crt0.o %1.o -LC:/dos/lib/gcc/djgpp/4.94 -Lc:/dos/lib -lg=
cc -lc -lstdcxx -lgcc -lc -o %1.exe</div>
<div><br>
</div>
<div>C:\dos&gt;go32-v2</div>
<div>go32/v2 version 2.0 built Oct 18 2015 09:41:08</div>
<div>Usage: go32 coff-image [args]</div>
<div>Rename this to go32.exe only if you need a go32 that can run v2 binari=
es as</div>
<div>&nbsp;well as v1 binaries (old makefiles). &nbsp;Put ahead of the old =
go32 in your PATH</div>
<div>&nbsp;but do not delete your old go32 - leave it in the PATH after thi=
s one.</div>
<div>Set GO32_V2_DEBUG=3Dy in the environment to get verbose output.</div>
<div><br>
</div>
<div>DPMI memory available: 1103989 Kb</div>
<div>DPMI swap space available: 0 Kb</div>
<div><br>
</div>
<div>C:\dos&gt;cc.bat ech</div>
<div><br>
</div>
<div>C:\dos&gt;c:/dos/libexec/gcc/djgpp/4.94/cc1plus.exe -g -quiet -remap e=
ch.cpp -o ech.s</div>
<div><br>
</div>
<div>C:\dos&gt;as ech.s -o ech.o</div>
<div><br>
</div>
<div>C:\dos&gt;ld c:/dos/lib/crt0.o ech.o -LC:/dos/lib/gcc/djgpp/4.94 -Lc:/=
dos/lib -lgcc -lc -lstdcxx -lgcc -lc -o ech.exe</div>
<div><br>
</div>
<div>C:\dos&gt;cc.bat exec</div>
<div><br>
</div>
<div>C:\dos&gt;c:/dos/libexec/gcc/djgpp/4.94/cc1plus.exe -g -quiet -remap e=
xec.cpp -o exec.s</div>
<div><br>
</div>
<div>C:\dos&gt;as exec.s -o exec.o</div>
<div><br>
</div>
<div>C:\dos&gt;ld c:/dos/lib/crt0.o exec.o -LC:/dos/lib/gcc/djgpp/4.94 -Lc:=
/dos/lib -lgcc -lc -lstdcxx -lgcc -lc -o exec.exe</div>
<div><br>
</div>
<div>C:\dos&gt;.\ech.exe a b c d</div>
<div>c:/dos/ech.exe</div>
<div>a</div>
<div>b</div>
<div>c</div>
<div>d</div>
<div><br>
</div>
<div>C:\dos&gt;file ech.exe</div>
<div>ech.exe: DOS-executable compiled w/DJGPP (stub v2.05)</div>
<div><br>
</div>
<div>C:\dos&gt;file exec.exe</div>
<div>exec.exe: DOS-executable compiled w/DJGPP (stub v2.05)</div>
<div><br>
</div>
<div>C:\dos&gt;.\exec.exe a</div>
<div>a</div>
<div>Exiting due to signal SIGSEGV</div>
<div>Stack Fault at eip=3D00000a11</div>
<div>eax=3D00010001 ebx=3D00020080 ecx=3D0000d000 edx=3D000007bf esi=3D0000=
2b2b edi=3D00002b1b</div>
<div>ebp=3D000c773a esp=3D000c773a program=3DC:\DOS\EXEC.EXE</div>
<div>cs: sel=3D00cf &nbsp;base=3D000d3a70 &nbsp;limit=3D00000db0</div>
<div>ds: sel=3D00b7 &nbsp;base=3D000cc180 &nbsp;limit=3D0000ffff</div>
<div>es: sel=3D0040 &nbsp;invalid</div>
<div>fs: sel=3D0000</div>
<div>gs: sel=3D0000</div>
<div>ss: sel=3D00b7 &nbsp;base=3D000cc180 &nbsp;limit=3D0000ffff</div>
<div>App stack: [000c7ef0..00047ef0] &nbsp;Exceptn stack: [00047e1c..00045e=
dc]</div>
<div><br>
</div>
<div><br>
</div>
<div>C:\dos&gt;gdb ech.exe
<div>GNU gdb (GDB) 8.0.1</div>
<div>Copyright (C) 2017 Free Software Foundation, Inc.</div>
<div>License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses=
/gpl.html&gt;</div>
<div>This is free software: you are free to change and redistribute it.</di=
v>
<div>There is NO WARRANTY, to the extent permitted by law. &nbsp;Type &quot=
;show copying&quot;</div>
<div>and &quot;show warranty&quot; for details.</div>
<div>This GDB was configured as &quot;--host=3Di786-pc-msdosdjgpp --target=
=3Ddjgpp&quot;.</div>
<div>Type &quot;show configuration&quot; for configuration details.</div>
<div>For bug reporting instructions, please see:</div>
<div>&lt;http://www.gnu.org/software/gdb/bugs/&gt;.</div>
<div>Find the GDB manual and other documentation resources online at:</div>
<div>&lt;http://www.gnu.org/software/gdb/documentation/&gt;.</div>
<div>For help, type &quot;help&quot;.</div>
<div>Type &quot;apropos word&quot; to search for commands related to &quot;=
word&quot;...</div>
<div>Reading symbols from ech.exe...done.</div>
<div>(gdb) break main</div>
<div>Breakpoint 1 at 0x16f1: file ech.cpp, line 5.</div>
(gdb) r<br>
</div>
<div><br>
</div>
<div>---------------------------
<div>16 bit MS-DOS Subsystem</div>
<div>---------------------------</div>
<div>C:\Windows\system32\cmd.exe - gdb &nbsp;ech.exe</div>
<div>NTVDM has encountered a System Error</div>
<div>NTVDM has encountered a System Error 4001h Choose 'Close' to terminate=
 the application.</div>
<div>---------------------------</div>
<div>Close &nbsp; Ignore &nbsp; </div>
<span>---------------------------</span><br>
</div>
<div><span><br>
</span></div>
but gdb works better under dosbox-x.<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
Funny/sad that 32bit Windows 10 is seemingly not the best MS-DOS here.</div=
>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
&nbsp;- Jay</div>
<div>
<div id=3D"appendonsend"></div>
<div style=3D"font-family:Calibri,Helvetica,sans-serif; font-size:12pt; col=
or:rgb(0,0,0)">
<br>
</div>
<hr tabindex=3D"-1" style=3D"display:inline-block; width:98%">
<div id=3D"divRplyFwdMsg" dir=3D"ltr"><font face=3D"Calibri, sans-serif" co=
lor=3D"#000000" style=3D"font-size:11pt"><b>From:</b> Jay K<br>
<b>Sent:</b> Wednesday, January 26, 2022 9:53 AM<br>
<b>To:</b> djgpp AT delorie DOT com &lt;djgpp AT delorie DOT com&gt;<br>
<b>Subject:</b> command line lenght problems?</font>
<div>&nbsp;</div>
</div>
<div dir=3D"ltr">
<div style=3D"font-family:Calibri,Helvetica,sans-serif; font-size:12pt; col=
or:rgb(0,0,0)">
Hi folks.
<div><br>
</div>
<div>I am trying to port my program to MS-DOS. For fun, granted.</div>
<div>I figured DJGPP would help.</div>
<div>Esp. because it seems to have a useful &quot;sigalarm&quot; functional=
ity,</div>
<div>I might use to implement preemptive threads.</div>
<div>I have a prototype that suggests that will work:</div>
<div>&nbsp;https://github.com/modula3/cm3/blob/3be819ed8e2fa60885aff0cb6278=
934a17b30702/m3-libs/m3core/src/thread/POSIX/test_dos_threads.cpp</div>
<div><br>
</div>
<div>The rest of the Posix support helps also.</div>
<div>&nbsp;I'm not sure about network/sockets, maybe give up.</div>
<div><br>
</div>
<div>I have experimented with a few &quot;DOS&quot;s.</div>
<div>&nbsp;FreeDOS, DosBos-X, 32bit Windows 10 VM.</div>
<div><br>
</div>
<div>They all have advantages and disadvantages.</div>
<div><br>
</div>
<div>Granted I could spend more time configuring each and none is &quot;rea=
lly&quot; MS-DOS.</div>
<div><br>
</div>
<div>My program is a compiler, that produces .cpp files and would run g++ o=
r gxx, etc.</div>
<div>&nbsp; (I might experiment with e.g. OpenWatcom, might, like if it can=
 link the djpp libraries.)</div>
<div><br>
</div>
<div>I am seeing, I guess, command line length limitations.</div>
<div><br>
</div>
<div>gcc and collect2 crash, but if I run them manually with shorter equiva=
lent-enough commands, they work.</div>
<div><br>
</div>
<div>Advise?</div>
<div><br>
</div>
<div>I tried trimming environment. That didn't help.</div>
<div>I tried running bash, thinking within there, maybe Djgpp would use</di=
v>
<div>its technique to transfer command lines otherwise, but bash won't star=
t.</div>
<div><br>
</div>
<div>bash:</div>
<div>---------------------------</div>
<div>16 bit MS-DOS Subsystem</div>
<div>---------------------------</div>
<div>Administrator: C:\Windows\system32\cmd.exe</div>
<div>NTVDM has encountered a System Error</div>
<div>NTVDM has encountered a System Error 4001h Choose 'Close' to terminate=
 the application.</div>
<div>---------------------------</div>
<div>Close &nbsp; Ignore &nbsp; </div>
<div>---------------------------</div>
<div><br>
</div>
<div><br>
</div>
<div>C:\dos&gt;type 1.c</div>
<div>#include &lt;stdio.h&gt;</div>
<div>int main()</div>
<div>{</div>
<div>printf(&quot;hello\n&quot;);</div>
<div>}</div>
<div><br>
</div>
<div>C:\dos&gt;gcc -v -c 1.c</div>
<div>Using built-in specs.</div>
<div>COLLECT_GCC=3Dc:/dos/bin/gcc.exe</div>
<div>Target: djgpp</div>
<div>Configured with: /gcc-9.30/configure djgpp --prefix=3D/dev/env/DJDIR -=
-disable-werror --enable-languages=3Dc,c++,fortran,objc,obj-c++,ada --with-=
gcc-major-version-only --enable-libquadmath-support --enable-lto --disable-=
libstdcxx-pch --enable-libstdcxx-filesystem-ts</div>
<div>Thread model: single</div>
<div>gcc version 9.3.0 (GCC)</div>
<div>COLLECT_GCC_OPTIONS=3D'-v' '-c' '-mtune=3Dpentium' '-march=3Dpentium'<=
/div>
<div>&nbsp;c:/dos/bin/../libexec/gcc/djgpp/9/cc1.exe -quiet -v -iprefix c:/=
dos/bin/../lib/gcc/djgpp/9/ -remap 1.c -quiet -dumpbase 1.c -mtune=3Dpentiu=
m -march=3Dpentium -auxbase 1 -version -o c:/dos/tmp/cczF3Ew0.s</div>
<div>Exiting due to signal SIGSEGV</div>
<div>Stack Fault at eip=3D00000a11</div>
<div>eax=3D00010001 ebx=3D01ad0080 ecx=3D01549400 edx=3D004207bf esi=3D0000=
1223 edi=3D00001213</div>
<div>ebp=3D0042773a esp=3D0042773a program=3DC:\DOS\BIN\GCC.EXE</div>
<div>cs: sel=3D00cf &nbsp;base=3D000d3a50 &nbsp;limit=3D00000db0</div>
<div>ds: sel=3D00b7 &nbsp;base=3D000cc160 &nbsp;limit=3D0000ffff</div>
<div>es: sel=3D0040 &nbsp;invalid</div>
<div>fs: sel=3D0000</div>
<div>gs: sel=3D0000</div>
<div>ss: sel=3D00b7 &nbsp;base=3D000cc160 &nbsp;limit=3D0000ffff</div>
<div>App stack: [00423b78..00223b7c] &nbsp;Exceptn stack: [00223ac8..00221b=
88]</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>C:\dos&gt; c:/dos/bin/../libexec/gcc/djgpp/9/cc1.exe -quiet -v -iprefi=
x c:/dos/bin/../lib/gcc/djgpp/9/ -remap 1.c -quiet -dumpbase 1.c -mtune=3Dp=
entium -march=3Dpentium -auxbase 1 -version -o c:/dos/tmp/cczF3Ew0.s</div>
<div>The system cannot execute the specified program.</div>
<div><br>
</div>
<div><br>
</div>
<div>c:/dos/bin/../libexec/gcc/djgpp/9/cc1.exe -iprefix c:/dos/bin/../lib/g=
cc/djgpp/9/ -remap 1.c -quiet -dumpbase 1.c -o 1.s</div>
<div><br>
</div>
<div>=3D&gt; success</div>
<div><br>
</div>
<div>as 1.s</div>
<div><br>
</div>
<div>&nbsp;=3D&gt; success</div>
<div><br>
</div>
<div>C:\dos&gt;gcc 1.o -v</div>
<div>...</div>
<div><br>
</div>
<div>208 characters:</div>
<div>c:/dos/bin/../libexec/gcc/djgpp/9/collect2.exe c:/dos/lib/crt0.o -Lc:/=
dos/bin/../lib/gcc/djgpp/9 -Lc:/dos/bin/../lib/gcc -Lc:/dos/lib -Lc:/dos/bi=
n/../lib/gcc/djgpp/9/../../.. -Lc:/dos/lib 1.o -lgcc -lc -lgcc</div>
<div><br>
</div>
<div>Exiting due to signal SIGSEGV</div>
<div>Stack Fault at eip=3D00000a11</div>
<div>eax=3D00010001 ebx=3D001c0080 ecx=3D001804</div>
<div><br>
</div>
<div>90 characters:</div>
<div>ld.exe c:/dos/lib/crt0.o 1.o -lgcc -lc -Lc:/dos/lib/gcc/djgpp/9 -Lc:/d=
os/lib -o a.exe</div>
<div><br>
</div>
<div>&nbsp;=3D&gt; success</div>
<div><br>
</div>
<div>.\a.exe</div>
<div><br>
</div>
<div>=3D&gt; success</div>
<div><br>
</div>
<div><br>
</div>
<div>Suggestions?</div>
<div>I mean, worst case, I will run:</div>
<div><br>
</div>
<div>C:\dos&gt;gcc --print-prog-name ld</div>
<div>c:/dos/bin/ld.exe</div>
<div><br>
</div>
<div>C:\dos&gt;gcc --print-prog-name cc1</div>
<div>c:/dos/bin/../libexec/gcc/djgpp/9/cc1.exe</div>
<div><br>
</div>
<div>and run things more manually &quot;like&quot; that, with response file=
s.</div>
<div><br>
</div>
<div>I had to reinvent the compiler driver though, it hides things so well.=
</div>
<div>I suppose I could run gcc directly with -v, capture the command lines,=
</div>
<div>change them to use response files and rerun them &quot;verbatim&quot;,=
 thereby</div>
<div>preserving the compiler driver.</div>
<div><br>
</div>
<div>Can/should the gcc driver handle this more automatically itself?</div>
<div><br>
</div>
<div>Thank you,</div>
<span>&nbsp;- Jay</span><br>
</div>
</div>
</div>
</body>
</html>

--_000_MWHPR1401MB1951A1E9DA9688FF49E522C1E6209MWHPR1401MB1951_--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019