• GCC 10.2.0, collect2.exe error - cannot create temporary file

    From [via djgpp@delorie.com]" @21:1/5 to All on Sat Oct 31 01:39:38 2020
    Receiving this error when trying to compile AdvanceMAME using DJGPP.
    I have the latest version of all packages (based on the Mini-FAQ).
    This is a 32-bit Windows XP VM in VirtualBox.

    I have seen that there is a problem with LFN ? but I assumed that
    only applied to 16-bit systems, while NTVDM supports LFN already. So
    I don't know why this would be happening.

    Cannot create temporary file in c:/djgpp/tmp/: Permission denied (EACCES) Abort!
    Exiting due to signal SIGABRT
    Raised at eip=0013e551
    eax=0039d8c4 ebx=00000120 ecx=00000000 edx=00000000 esi=0013e3ca edi=003acec8 ebp=0039d9e8 esp=0039d8b0 program=c:\djgpp\libexec\gcc\djgpp\10\collect2.exe cs: sel=0257 base=031d0000 limit=003bffff
    ds: sel=025f base=031d0000 limit=003bffff
    es: sel=025f base=031d0000 limit=003bffff
    fs: sel=022f base=0000ff40 limit=0000ffff
    gs: sel=026f base=00000000 limit=0010ffff
    ss: sel=025f base=031d0000 limit=003bffff
    App stack: [0039dc58..0019dc5c] Exceptn stack: [0019dba8..0019bc68]

    Call frame traceback EIPs:
    0x00167a04
    0x0013e551
    0x0013eb12
    0x0013ef45
    0x0013f279
    0x0000557a
    0x00003952
    0x0017a8e7

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From [via djgpp@delorie.com]" @21:1/5 to kennedy.greg@gmail.com on Fri Nov 20 21:39:22 2020
    Any ideas on this? I get the same error with 9.3.0. I believe it
    could be related to trying to use -flto?

    On Sat, Oct 31, 2020 at 1:39 AM Greg Kennedy <kennedy.greg@gmail.com> wrote:

    Receiving this error when trying to compile AdvanceMAME using DJGPP.
    I have the latest version of all packages (based on the Mini-FAQ).
    This is a 32-bit Windows XP VM in VirtualBox.

    I have seen that there is a problem with LFN ? but I assumed that
    only applied to 16-bit systems, while NTVDM supports LFN already. So
    I don't know why this would be happening.

    Cannot create temporary file in c:/djgpp/tmp/: Permission denied (EACCES) Abort!
    Exiting due to signal SIGABRT
    Raised at eip=0013e551
    eax=0039d8c4 ebx=00000120 ecx=00000000 edx=00000000 esi=0013e3ca edi=003acec8 ebp=0039d9e8 esp=0039d8b0 program=c:\djgpp\libexec\gcc\djgpp\10\collect2.exe cs: sel=0257 base=031d0000 limit=003bffff
    ds: sel=025f base=031d0000 limit=003bffff
    es: sel=025f base=031d0000 limit=003bffff
    fs: sel=022f base=0000ff40 limit=0000ffff
    gs: sel=026f base=00000000 limit=0010ffff
    ss: sel=025f base=031d0000 limit=003bffff
    App stack: [0039dc58..0019dc5c] Exceptn stack: [0019dba8..0019bc68]

    Call frame traceback EIPs:
    0x00167a04
    0x0013e551
    0x0013eb12
    0x0013ef45
    0x0013f279
    0x0000557a
    0x00003952
    0x0017a8e7

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From [via djgpp@delorie.com]" @21:1/5 to djgpp@delorie.com] on Sun Nov 22 11:12:07 2020
    On 11/21/20 5:39 AM, Greg Kennedy (kennedy.greg@gmail.com) [via djgpp@delorie.com] wrote:
    Any ideas on this? I get the same error with 9.3.0. I believe it
    could be related to trying to use -flto?

    Checked sources: -flto will not work without long file name support. Without LTO gcc recent
    versions for DJGPP should work:

    [andris@ap gcc]$ git checkout djgpp/native/gcc-10.2.0
    HEAD is now at 0de6b027530 Merge branch 'djgpp/gcc-10' into djgpp/native/gcc-10 [andris@ap gcc]$ grep make_temp_file gcc/*.c
    gcc/collect2.c:      c_file = make_temp_file (CDTOR_C_NAME); gcc/collect2.c:      o_file = make_temp_file (CDTOR_O_NAME); gcc/collect2.c:      export_file = make_temp_file (".x"); gcc/collect-utils.c:      response_file = make_temp_file (""); gcc/gcc.c:  char *temp_file = make_temp_file (""); gcc/gcc.c:                  temp_filename = make_temp_file (t->suffix);
    gcc/gcc.c:      temp_stdout_files[attempt] = make_temp_file (".out"); gcc/gcc.c:      temp_stderr_files[attempt] = make_temp_file (".err"); gcc/lto-wrapper.c:  filename = make_temp_file (".target.o"); gcc/lto-wrapper.c:      char *crtoffloadtable = make_temp_file (".crtoffloadtable.o");
    gcc/lto-wrapper.c:    outfile = make_temp_file (".debug.temp.o"); gcc/lto-wrapper.c:      flto_out = make_temp_file (".lto.o"); gcc/lto-wrapper.c:        ltrans_output_file = make_temp_file_with_prefix (prefix,
    gcc/lto-wrapper.c:        makefile = make_temp_file (".mk"); gcc/selftest.c:  m_filename = make_temp_file (suffix);

    1) CDTOR_C_NAME and CDTOR_O_NAME should be compatible with SFN (defined inside #ifdef __DJGPP__ ....)

    2) gcc/lto-wrapper.c: generated temporary file name are unusable without LFN and expected error
    message is as seen below.

    So try without -flto.


    Andris


    PS. one can see sources on GitHub (no need to download source archive gcc1020s.zip):

    - collect2.c: should be OK without LFN support: https://github.com/apavenis/djgpp-gcc/blob/djgpp/native/gcc-10.2.0/gcc/collect2.c

    - lto-wrapper.c: will not work without LFN: https://github.com/apavenis/djgpp-gcc/blob/djgpp/native/gcc-10.2.0/gcc/lto-wrapper.c

    - implementation of make_temp_file(): https://github.com/apavenis/djgpp-gcc/blob/djgpp/native/gcc-10/libiberty/make-temp-file.c


    On Sat, Oct 31, 2020 at 1:39 AM Greg Kennedy <kennedy.greg@gmail.com> wrote:
    Receiving this error when trying to compile AdvanceMAME using DJGPP.
    I have the latest version of all packages (based on the Mini-FAQ).
    This is a 32-bit Windows XP VM in VirtualBox.

    I have seen that there is a problem with LFN ? but I assumed that
    only applied to 16-bit systems, while NTVDM supports LFN already. So
    I don't know why this would be happening.

    Cannot create temporary file in c:/djgpp/tmp/: Permission denied (EACCES)
    Abort!
    Exiting due to signal SIGABRT
    Raised at eip=0013e551
    eax=0039d8c4 ebx=00000120 ecx=00000000 edx=00000000 esi=0013e3ca edi=003acec8
    ebp=0039d9e8 esp=0039d8b0 program=c:\djgpp\libexec\gcc\djgpp\10\collect2.exe >> cs: sel=0257 base=031d0000 limit=003bffff
    ds: sel=025f base=031d0000 limit=003bffff
    es: sel=025f base=031d0000 limit=003bffff
    fs: sel=022f base=0000ff40 limit=0000ffff
    gs: sel=026f base=00000000 limit=0010ffff
    ss: sel=025f base=031d0000 limit=003bffff
    App stack: [0039dc58..0019dc5c] Exceptn stack: [0019dba8..0019bc68]

    Call frame traceback EIPs:
    0x00167a04
    0x0013e551
    0x0013eb12
    0x0013ef45
    0x0013f279
    0x0000557a
    0x00003952
    0x0017a8e7

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From [via djgpp@delorie.com]" @21:1/5 to djgpp@delorie.com] on Wed Nov 25 09:32:50 2020
    Thanks for the tip - Compilation works fine without -flto, but it
    fails with it enabled. I have LFN=Y and am building under Windows XP,
    so it's definitely supported.

    Since I have a reliable test case I will try building a new
    collect2.exe with some debug print and report back :)

    On Sun, Nov 22, 2020 at 3:19 AM Andris Pavenis (andris.pavenis@iki.fi)
    [via djgpp@delorie.com] <djgpp@delorie.com> wrote:

    On 11/21/20 5:39 AM, Greg Kennedy (kennedy.greg@gmail.com) [via djgpp@delorie.com] wrote:
    Any ideas on this? I get the same error with 9.3.0. I believe it
    could be related to trying to use -flto?

    Checked sources: -flto will not work without long file name support. Without LTO gcc recent
    versions for DJGPP should work:

    [andris@ap gcc]$ git checkout djgpp/native/gcc-10.2.0
    HEAD is now at 0de6b027530 Merge branch 'djgpp/gcc-10' into djgpp/native/gcc-10
    [andris@ap gcc]$ grep make_temp_file gcc/*.c
    gcc/collect2.c: c_file = make_temp_file (CDTOR_C_NAME);
    gcc/collect2.c: o_file = make_temp_file (CDTOR_O_NAME);
    gcc/collect2.c: export_file = make_temp_file (".x"); gcc/collect-utils.c: response_file = make_temp_file ("");
    gcc/gcc.c: char *temp_file = make_temp_file ("");
    gcc/gcc.c: temp_filename = make_temp_file (t->suffix); gcc/gcc.c: temp_stdout_files[attempt] = make_temp_file (".out"); gcc/gcc.c: temp_stderr_files[attempt] = make_temp_file (".err"); gcc/lto-wrapper.c: filename = make_temp_file (".target.o"); gcc/lto-wrapper.c: char *crtoffloadtable = make_temp_file (".crtoffloadtable.o");
    gcc/lto-wrapper.c: outfile = make_temp_file (".debug.temp.o"); gcc/lto-wrapper.c: flto_out = make_temp_file (".lto.o"); gcc/lto-wrapper.c: ltrans_output_file = make_temp_file_with_prefix (prefix,
    gcc/lto-wrapper.c: makefile = make_temp_file (".mk");
    gcc/selftest.c: m_filename = make_temp_file (suffix);

    1) CDTOR_C_NAME and CDTOR_O_NAME should be compatible with SFN (defined inside #ifdef __DJGPP__ ....)

    2) gcc/lto-wrapper.c: generated temporary file name are unusable without LFN and expected error
    message is as seen below.

    So try without -flto.


    Andris


    PS. one can see sources on GitHub (no need to download source archive gcc1020s.zip):

    - collect2.c: should be OK without LFN support: https://github.com/apavenis/djgpp-gcc/blob/djgpp/native/gcc-10.2.0/gcc/collect2.c

    - lto-wrapper.c: will not work without LFN: https://github.com/apavenis/djgpp-gcc/blob/djgpp/native/gcc-10.2.0/gcc/lto-wrapper.c

    - implementation of make_temp_file(): https://github.com/apavenis/djgpp-gcc/blob/djgpp/native/gcc-10/libiberty/make-temp-file.c


    On Sat, Oct 31, 2020 at 1:39 AM Greg Kennedy <kennedy.greg@gmail.com> wrote:
    Receiving this error when trying to compile AdvanceMAME using DJGPP.
    I have the latest version of all packages (based on the Mini-FAQ).
    This is a 32-bit Windows XP VM in VirtualBox.

    I have seen that there is a problem with LFN ? but I assumed that
    only applied to 16-bit systems, while NTVDM supports LFN already. So
    I don't know why this would be happening.

    Cannot create temporary file in c:/djgpp/tmp/: Permission denied (EACCES) >> Abort!
    Exiting due to signal SIGABRT
    Raised at eip=0013e551
    eax=0039d8c4 ebx=00000120 ecx=00000000 edx=00000000 esi=0013e3ca edi=003acec8
    ebp=0039d9e8 esp=0039d8b0 program=c:\djgpp\libexec\gcc\djgpp\10\collect2.exe
    cs: sel=0257 base=031d0000 limit=003bffff
    ds: sel=025f base=031d0000 limit=003bffff
    es: sel=025f base=031d0000 limit=003bffff
    fs: sel=022f base=0000ff40 limit=0000ffff
    gs: sel=026f base=00000000 limit=0010ffff
    ss: sel=025f base=031d0000 limit=003bffff
    App stack: [0039dc58..0019dc5c] Exceptn stack: [0019dba8..0019bc68]

    Call frame traceback EIPs:
    0x00167a04
    0x0013e551
    0x0013eb12
    0x0013ef45
    0x0013f279
    0x0000557a
    0x00003952
    0x0017a8e7




    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From [via djgpp@delorie.com]" @21:1/5 to kennedy.greg@gmail.com on Fri Nov 27 22:11:21 2020
    I have added some debug print. The problem is in pex-common.c, line
    109, which creates a temp file using make_temp_file(null);

    collect2.c: make_temp_file(.ctc)
    Called make_temp_file(.ctc), redirecting
    Called make_temp_file_with_prefix(cc, .ctc):
    'c:/djgpp/tmp/ccXXXXXX.ctc'-> 'c:/djgpp/tmp/ccehuQ7Q.ctc'
    collect2.c: make_temp_file(.cto)
    Called make_temp_file(.cto), redirecting
    Called make_temp_file_with_prefix(cc, .cto):
    'c:/djgpp/tmp/ccXXXXXX.cto'-> 'c:/djgpp/tmp/ccioOw5x.cto'
    pex-common.c: make_temp_file(NULL)
    Called make_temp_file((null)), redirecting
    Called make_temp_file_with_prefix(cc, ): 'c:/djgpp/tmp/ccXXXXXX'-> ''
    Cannot create temporary file in c:/djgpp/tmp/: Permission denied (EACCES) Abort!

    I *think* the problem is that pex-common functions are being run "as a subprocess", which may not have the same permissions as the original
    launch process? but I am not sure about this. I will look at Windows
    XP folder permissions and see if I can figure out more details.

    On Wed, Nov 25, 2020 at 9:32 AM Greg Kennedy <kennedy.greg@gmail.com> wrote:

    Thanks for the tip - Compilation works fine without -flto, but it
    fails with it enabled. I have LFN=Y and am building under Windows XP,
    so it's definitely supported.

    Since I have a reliable test case I will try building a new
    collect2.exe with some debug print and report back :)

    On Sun, Nov 22, 2020 at 3:19 AM Andris Pavenis (andris.pavenis@iki.fi)
    [via djgpp@delorie.com] <djgpp@delorie.com> wrote:

    On 11/21/20 5:39 AM, Greg Kennedy (kennedy.greg@gmail.com) [via djgpp@delorie.com] wrote:
    Any ideas on this? I get the same error with 9.3.0. I believe it
    could be related to trying to use -flto?

    Checked sources: -flto will not work without long file name support. Without LTO gcc recent
    versions for DJGPP should work:

    [andris@ap gcc]$ git checkout djgpp/native/gcc-10.2.0
    HEAD is now at 0de6b027530 Merge branch 'djgpp/gcc-10' into djgpp/native/gcc-10
    [andris@ap gcc]$ grep make_temp_file gcc/*.c
    gcc/collect2.c: c_file = make_temp_file (CDTOR_C_NAME); gcc/collect2.c: o_file = make_temp_file (CDTOR_O_NAME); gcc/collect2.c: export_file = make_temp_file (".x"); gcc/collect-utils.c: response_file = make_temp_file ("");
    gcc/gcc.c: char *temp_file = make_temp_file ("");
    gcc/gcc.c: temp_filename = make_temp_file (t->suffix); gcc/gcc.c: temp_stdout_files[attempt] = make_temp_file (".out"); gcc/gcc.c: temp_stderr_files[attempt] = make_temp_file (".err"); gcc/lto-wrapper.c: filename = make_temp_file (".target.o"); gcc/lto-wrapper.c: char *crtoffloadtable = make_temp_file (".crtoffloadtable.o");
    gcc/lto-wrapper.c: outfile = make_temp_file (".debug.temp.o"); gcc/lto-wrapper.c: flto_out = make_temp_file (".lto.o"); gcc/lto-wrapper.c: ltrans_output_file = make_temp_file_with_prefix (prefix,
    gcc/lto-wrapper.c: makefile = make_temp_file (".mk"); gcc/selftest.c: m_filename = make_temp_file (suffix);

    1) CDTOR_C_NAME and CDTOR_O_NAME should be compatible with SFN (defined inside #ifdef __DJGPP__ ....)

    2) gcc/lto-wrapper.c: generated temporary file name are unusable without LFN and expected error
    message is as seen below.

    So try without -flto.


    Andris


    PS. one can see sources on GitHub (no need to download source archive gcc1020s.zip):

    - collect2.c: should be OK without LFN support: https://github.com/apavenis/djgpp-gcc/blob/djgpp/native/gcc-10.2.0/gcc/collect2.c

    - lto-wrapper.c: will not work without LFN: https://github.com/apavenis/djgpp-gcc/blob/djgpp/native/gcc-10.2.0/gcc/lto-wrapper.c

    - implementation of make_temp_file(): https://github.com/apavenis/djgpp-gcc/blob/djgpp/native/gcc-10/libiberty/make-temp-file.c


    On Sat, Oct 31, 2020 at 1:39 AM Greg Kennedy <kennedy.greg@gmail.com> wrote:
    Receiving this error when trying to compile AdvanceMAME using DJGPP.
    I have the latest version of all packages (based on the Mini-FAQ).
    This is a 32-bit Windows XP VM in VirtualBox.

    I have seen that there is a problem with LFN ? but I assumed that
    only applied to 16-bit systems, while NTVDM supports LFN already. So
    I don't know why this would be happening.

    Cannot create temporary file in c:/djgpp/tmp/: Permission denied (EACCES)
    Abort!
    Exiting due to signal SIGABRT
    Raised at eip=0013e551
    eax=0039d8c4 ebx=00000120 ecx=00000000 edx=00000000 esi=0013e3ca edi=003acec8
    ebp=0039d9e8 esp=0039d8b0 program=c:\djgpp\libexec\gcc\djgpp\10\collect2.exe
    cs: sel=0257 base=031d0000 limit=003bffff
    ds: sel=025f base=031d0000 limit=003bffff
    es: sel=025f base=031d0000 limit=003bffff
    fs: sel=022f base=0000ff40 limit=0000ffff
    gs: sel=026f base=00000000 limit=0010ffff
    ss: sel=025f base=031d0000 limit=003bffff
    App stack: [0039dc58..0019dc5c] Exceptn stack: [0019dba8..0019bc68]

    Call frame traceback EIPs:
    0x00167a04
    0x0013e551
    0x0013eb12
    0x0013ef45
    0x0013f279
    0x0000557a
    0x00003952
    0x0017a8e7




    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From [via djgpp@delorie.com]" @21:1/5 to All on Sat Nov 28 10:18:06 2020
    From: "Greg Kennedy (kennedy.greg@gmail.com) [via djgpp@delorie.com]" <djgpp@delorie.com>
    Date: Fri, 27 Nov 2020 22:11:21 -0600

    I have added some debug print. The problem is in pex-common.c, line
    109, which creates a temp file using make_temp_file(null);

    collect2.c: make_temp_file(.ctc)
    Called make_temp_file(.ctc), redirecting
    Called make_temp_file_with_prefix(cc, .ctc):
    'c:/djgpp/tmp/ccXXXXXX.ctc'-> 'c:/djgpp/tmp/ccehuQ7Q.ctc'
    collect2.c: make_temp_file(.cto)
    Called make_temp_file(.cto), redirecting
    Called make_temp_file_with_prefix(cc, .cto):
    'c:/djgpp/tmp/ccXXXXXX.cto'-> 'c:/djgpp/tmp/ccioOw5x.cto'
    pex-common.c: make_temp_file(NULL)
    Called make_temp_file((null)), redirecting
    Called make_temp_file_with_prefix(cc, ): 'c:/djgpp/tmp/ccXXXXXX'-> ''
    Cannot create temporary file in c:/djgpp/tmp/: Permission denied (EACCES) Abort!

    Given this trace, I think the problem is in libiberty's mkstemps,
    which is called with 'c:/djgpp/tmp/ccXXXXXX' and fails due to EACCES.
    Can you trace inside that as well?

    I *think* the problem is that pex-common functions are being run "as a subprocess", which may not have the same permissions as the original
    launch process?

    No, that's not so. It's collect2.exe that calls pex-common functions
    as part of its code. And process permissions on MS-DOS have no
    meaning anyway.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From [via djgpp@delorie.com]" @21:1/5 to djgpp@delorie.com] on Sat Nov 28 18:41:35 2020
    Tried again with that. mkstemps calls open() from fcntl, which is
    apparently returning EACCES. So the problem is coming from djgpp's
    libc somewhere. I will keep digging...

    While adding this it occurred to me that there are a *lot* of .o files
    being linked at once here, plus a couple .a with stuff inside. I
    don't know what all happens in the intervening time between the
    collect2 and the pex-common calls but it's possible there is a
    resource limit being hit in the meantime (open file descriptors, stack
    space, memory allocation, whatever). -flto works on smaller projects,
    but not this one.

    Here's the printout. (I also tried adding a ".pex" extension in
    pex-common.c but it gave the same result - the problem isn't related
    to the filenames in use)

    collect2.c: make_temp_file(.ctc)
    Called make_temp_file(.ctc), redirecting
    Called make_temp_file_with_prefix(cc, .ctc): 'c:/djgpp/tmp/ccXXXXXX.ctc' ->
    mkstemps(c:/djgpp/tmp/ccXXXXXX.ctc, 4): trying open(c:/djgpp/tmp/ccFoBQz9.ctc, ...)
    Got new file descriptor 5
    'c:/djgpp/tmp/ccFoBQz9.ctc'

    collect2.c: make_temp_file(.cto)
    Called make_temp_file(.cto), redirecting
    Called make_temp_file_with_prefix(cc, .cto): 'c:/djgpp/tmp/ccXXXXXX.cto' ->
    mkstemps(c:/djgpp/tmp/ccXXXXXX.cto, 4): trying open(c:/djgpp/tmp/ccaD2wZ8.cto, ...)
    Got new file descriptor 5
    'c:/djgpp/tmp/ccaD2wZ8.cto'

    pex-common.c: make_temp_file(NULL)
    Called make_temp_file((null)), redirecting
    Called make_temp_file_with_prefix(cc, ): 'c:/djgpp/tmp/ccXXXXXX' ->
    mkstemps(c:/djgpp/tmp/ccXXXXXX, 0): trying open(c:/djgpp/tmp/ccF27J2I, ...)
    encountered fatal error during open: : Permission denied (EACCES)
    Zeroing pattern and returning -1
    ''
    Cannot create temporary file in c:/djgpp/tmp/: Permission denied (EACCES) Abort!
    Exiting due to signal SIGABRT

    On Sat, Nov 28, 2020 at 2:24 AM Eli Zaretskii (eliz@gnu.org) [via djgpp@delorie.com] <djgpp@delorie.com> wrote:

    From: "Greg Kennedy (kennedy.greg@gmail.com) [via djgpp@delorie.com]" <djgpp@delorie.com>
    Date: Fri, 27 Nov 2020 22:11:21 -0600

    I have added some debug print. The problem is in pex-common.c, line
    109, which creates a temp file using make_temp_file(null);

    collect2.c: make_temp_file(.ctc)
    Called make_temp_file(.ctc), redirecting
    Called make_temp_file_with_prefix(cc, .ctc):
    'c:/djgpp/tmp/ccXXXXXX.ctc'-> 'c:/djgpp/tmp/ccehuQ7Q.ctc'
    collect2.c: make_temp_file(.cto)
    Called make_temp_file(.cto), redirecting
    Called make_temp_file_with_prefix(cc, .cto):
    'c:/djgpp/tmp/ccXXXXXX.cto'-> 'c:/djgpp/tmp/ccioOw5x.cto'
    pex-common.c: make_temp_file(NULL)
    Called make_temp_file((null)), redirecting
    Called make_temp_file_with_prefix(cc, ): 'c:/djgpp/tmp/ccXXXXXX'-> '' Cannot create temporary file in c:/djgpp/tmp/: Permission denied (EACCES) Abort!

    Given this trace, I think the problem is in libiberty's mkstemps,
    which is called with 'c:/djgpp/tmp/ccXXXXXX' and fails due to EACCES.
    Can you trace inside that as well?

    I *think* the problem is that pex-common functions are being run "as a subprocess", which may not have the same permissions as the original
    launch process?

    No, that's not so. It's collect2.exe that calls pex-common functions
    as part of its code. And process permissions on MS-DOS have no
    meaning anyway.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From [via djgpp@delorie.com]" @21:1/5 to All on Sun Nov 29 17:17:33 2020
    From: "Greg Kennedy (kennedy.greg@gmail.com) [via djgpp@delorie.com]" <djgpp@delorie.com>
    Date: Sat, 28 Nov 2020 18:41:35 -0600

    Tried again with that. mkstemps calls open() from fcntl, which is
    apparently returning EACCES. So the problem is coming from djgpp's
    libc somewhere.

    Yes, it sounds like that.

    While adding this it occurred to me that there are a *lot* of .o files
    being linked at once here, plus a couple .a with stuff inside. I
    don't know what all happens in the intervening time between the
    collect2 and the pex-common calls but it's possible there is a
    resource limit being hit in the meantime (open file descriptors, stack
    space, memory allocation, whatever).

    It could be. You can try enlarging the stack of collect2.exe, to
    eliminate that. Given the small numbers of file descriptor (5), it
    seems unlikely that this should be the problem, but who knows...

    Called make_temp_file((null)), redirecting
    Called make_temp_file_with_prefix(cc, ): 'c:/djgpp/tmp/ccXXXXXX' ->
    mkstemps(c:/djgpp/tmp/ccXXXXXX, 0): trying open(c:/djgpp/tmp/ccF27J2I, ...)
    encountered fatal error during open: : Permission denied (EACCES)
    Zeroing pattern and returning -1
    ''
    Cannot create temporary file in c:/djgpp/tmp/: Permission denied (EACCES)

    I guess the next question is: with what DOS error code does 'open'
    fail and why?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From [via djgpp@delorie.com]" @21:1/5 to djgpp@delorie.com] on Mon Nov 30 00:25:33 2020
    I had the idea that I could put all my .o files into a single .a
    archive and attempt to build that way. Unfortunately, -flto with
    archives requires the lto-plugin to be enabled, so nothing actually
    built. I looked at the gcc-10.20 configure script and found that
    DJGPP does not build the lto plugin.

    # Among non-ELF, only Windows platforms support the lto-plugin so far.
    # Build it unless LTO was explicitly disabled.
    case $target in
    *-cygwin* | *-mingw*) build_lto_plugin=$enable_lto ;;
    *) ;;
    esac

    Bummer.

    ---

    However, this did give me a way to try building with more or less .o
    files on the command-line. As I did this I found that the pex-common
    call was returning an FD that *increased* for every .o I added. For
    example, here's where I put three .o files and the rest in a .a:

    collect2.c: make_temp_file(.ctc)
    Called make_temp_file(.ctc), redirecting
    Called make_temp_file_with_prefix(cc, .ctc): 'c:/djgpp/tmp/ccXXXXXX.ctc'mkstemps(c:/djgpp/tmp/ccXXXXXX.ctc, 4):
    trying open(c:/djgpp/tmp/cchFW50P.ctc, ...)
    Got new file descriptor 5
    'c:/djgpp/tmp/cchFW50P.ctc'
    collect2.c: make_temp_file(.cto)
    Called make_temp_file(.cto), redirecting
    Called make_temp_file_with_prefix(cc, .cto): 'c:/djgpp/tmp/ccXXXXXX.cto'mkstemps(c:/djgpp/tmp/ccXXXXXX.cto, 4):
    trying open(c:/djgpp/tmp/ccoaJ1Rv.cto, ...)
    Got new file descriptor 5
    'c:/djgpp/tmp/ccoaJ1Rv.cto'
    pex-common.c: make_temp_file(NULL)
    Called make_temp_file((null)), redirecting
    Called make_temp_file_with_prefix(cc, ):
    'c:/djgpp/tmp/ccXXXXXX'mkste
  • From [via djgpp@delorie.com]" @21:1/5 to All on Mon Nov 30 18:07:08 2020
    From: "Greg Kennedy (kennedy.greg@gmail.com) [via djgpp@delorie.com]" <djgpp@delorie.com>
    Date: Mon, 30 Nov 2020 00:25:33 -0600

    However, this did give me a way to try building with more or less .o
    files on the command-line. As I did this I found that the pex-common
    call was returning an FD that *increased* for every .o I added. For
    example, here's where I put three .o files and the rest in a .a:

    collect2.c: make_temp_file(.ctc)
    Called make_temp_file(.ctc), redirecting
    Called make_temp_file_with_prefix(cc, .ctc): 'c:/djgpp/tmp/ccXXXXXX.ctc'mkstemps(c:/djgpp/tmp/ccXXXXXX.ctc, 4):
    trying open(c:/djgpp/tmp/cchFW50P.ctc, ...)
    Got new file descriptor 5
    'c:/djgpp/tmp/cchFW50P.ctc'
    collect2.c: make_temp_file(.cto)
    Called make_temp_file(.cto), redirecting
    Called make_temp_file_with_prefix(cc, .cto): 'c:/djgpp/tmp/ccXXXXXX.cto'mkstemps(c:/djgpp/tmp/ccXXXXXX.cto, 4):
    trying open(c:/djgpp/tmp/ccoaJ1Rv.cto, ...)
    Got new file descriptor 5
    'c:/djgpp/tmp/ccoaJ1Rv.cto'
    pex-common.c: make_temp_file(NULL)
    Called make_temp_file((null)), redirecting
    Called make_temp_file_with_prefix(cc, ): 'c:/djgpp/tmp/ccXXXXXX'mkstemps(c:/djgpp/tmp/ccXXXXXX, 0): trying open(c:/djgpp/tmp/ccYv0qDi, ...)
    Got new file descriptor 9
    'c:/djgpp/tmp/ccYv0qDi'

    (Meanwhile, just one .o file gave an FD of 7. All objects in a .a
    never actually calls this function, I guess because it isn't
    involved.)

    My assumption then is that I'm running out of free File Descriptors by passing too many .o files at once. This seems like a bug, maybe?

    How many *.o files do you have in this case? You can have up to 255
    files open at any given time, see the DJGPP FAQ for details.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From [via djgpp@delorie.com]" @21:1/5 to djgpp@delorie.com] on Fri Dec 11 22:35:46 2020
    More than that, unfortunately. (It's a MAME compile, each cpu or
    machine is essentially in its own .o)

    I also have a few static libs I'd like compiled in. Since this
    apparently requires the lto-plugin for visibility, it looks like I
    should just abandon this attempt to use lto. Oh well.

    On Mon, Nov 30, 2020 at 10:13 AM Eli Zaretskii (eliz@gnu.org) [via djgpp@delorie.com] <djgpp@delorie.com> wrote:

    From: "Greg Kennedy (kennedy.greg@gmail.com) [via djgpp@delorie.com]" <djgpp@delorie.com>
    Date: Mon, 30 Nov 2020 00:25:33 -0600

    However, this did give me a way to try building with more or less .o
    files on the command-line. As I did this I found that the pex-common
    call was returning an FD that *increased* for every .o I added. For example, here's where I put three .o files and the rest in a .a:

    collect2.c: make_temp_file(.ctc)
    Called make_temp_file(.ctc), redirecting
    Called make_temp_file_with_prefix(cc, .ctc): 'c:/djgpp/tmp/ccXXXXXX.ctc'mkstemps(c:/djgpp/tmp/ccXXXXXX.ctc, 4):
    trying open(c:/djgpp/tmp/cchFW50P.ctc, ...)
    Got new file descriptor 5
    'c:/djgpp/tmp/cchFW50P.ctc'
    collect2.c: make_temp_file(.cto)
    Called make_temp_file(.cto), redirecting
    Called make_temp_file_with_prefix(cc, .cto): 'c:/djgpp/tmp/ccXXXXXX.cto'mkstemps(c:/djgpp/tmp/ccXXXXXX.cto, 4):
    trying open(c:/djgpp/tmp/ccoaJ1Rv.cto, ...)
    Got new file descriptor 5
    'c:/djgpp/tmp/ccoaJ1Rv.cto'
    pex-common.c: make_temp_file(NULL)
    Called make_temp_file((null)), redirecting
    Called make_temp_file_with_prefix(cc, ): 'c:/djgpp/tmp/ccXXXXXX'mkstemps(c:/djgpp/tmp/ccXXXXXX, 0): trying open(c:/djgpp/tmp/ccYv0qDi, ...)
    Got new file descriptor 9
    'c:/djgpp/tmp/ccYv0qDi'

    (Meanwhile, just one .o file gave an FD of 7. All objects in a .a
    never actually calls this function, I guess because it isn't
    involved.)

    My assumption then is that I'm running out of free File Descriptors by passing too many .o files at once. This seems like a bug, maybe?

    How many *.o files do you have in this case? You can have up to 255
    files open at any given time, see the DJGPP FAQ for details.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From [via djgpp@delorie.com]" @21:1/5 to All on Sat Dec 12 09:33:12 2020
    From: "Greg Kennedy (kennedy.greg@gmail.com) [via djgpp@delorie.com]" <djgpp@delorie.com>
    Date: Fri, 11 Dec 2020 22:35:46 -0600

    More than that, unfortunately. (It's a MAME compile, each cpu or
    machine is essentially in its own .o)

    I also have a few static libs I'd like compiled in. Since this
    apparently requires the lto-plugin for visibility, it looks like I
    should just abandon this attempt to use lto. Oh well.

    The DJGPP FAQ offers a solution for this: use @response-file.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)