Package Details: djgpp-djcrx 2.05-12

Git Clone URL: https://aur.archlinux.org/djgpp-djcrx.git (read-only, click to copy)
Package Base: djgpp-djcrx
Description: Headers and utilities for the djgpp cross-compiler
Upstream URL: http://www.delorie.com/djgpp/
Keywords: build cross djgpp DOS headers libc
Licenses: GPL, LGPL, custom:djgpp
Conflicts: djgpp-djcrx-bootstrap
Submitter: felix.s
Maintainer: andris
Last Packager: andris
Votes: 6
Popularity: 0.001210
First Submitted: 2015-09-06 19:38 (UTC)
Last Updated: 2023-08-06 15:30 (UTC)

Latest Comments

1 2 Next › Last »

joshdevga commented on 2023-10-22 05:56 (UTC)

Hello and thank you for maintaining.

I ran into a bug in open.c that turns out to already have an upstream fix. The issue causes open() to sometimes set the incorrect value for the readonly attribute on new files. Applying the upstream change fixed the issue.

Here is the patch I applied:

--- src/libc/posix/fcntl/open.c 2014-04-18 09:37:39.000000000 -0400
+++ src/libc/posix/fcntl/open.c 2023-10-22 01:06:30.776592878 -0400
@@ -21,6 +21,7 @@
 #include <io.h>
 #include <sys/fsext.h>
 #include <dos.h>
+#include <stdarg.h>

 #include <libc/dosio.h>
 #include <libc/fd_props.h>
@@ -116,6 +117,12 @@
   char real_name[FILENAME_MAX + 1];
   int should_create = (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL);
   int dirs_solved = 0; /* Only directories resolved in real_name? */
+  int permissions;
+  va_list ap;
+
+  va_start(ap, oflag);
+  permissions = va_arg(ap, int);
+  va_end(ap);

   /* Solve symlinks and honor O_NOLINK flag  */
   if (oflag & O_NOLINK)
@@ -219,7 +226,7 @@
   /* DOS doesn't want to see these bits */
   oflag &= ~(O_TEXT | O_BINARY);

-  dmode = (*((&oflag) + 1) & S_IWUSR) ? 0 : 1;
+  dmode = (permissions & S_IWUSR) ? 0 : 1;

   /* Merge the share flags if they are specified */
   dont_have_share = ((oflag &

For reference, here is a link to the change history from delorie.com:

https://www.delorie.com/bin/cvsweb.cgi/djgpp/src/libc/posix/fcntl/open.c

The fix is spread across two commits (1.18 and 1.19)

Would you mind applying the patch to this package? I'm happy to supply a full patch (including PKGBUILD changes) if it would be helpful.

Thanks again

dreieck commented on 2023-07-24 13:46 (UTC) (edited on 2023-07-24 13:52 (UTC) by dreieck)

In the build() function, at the beginning you need to add

  CFLAGS+=' -Wno-error=use-after-free -Wno-error=free-nonheap-object -Wno-error=stringop-truncation -Wno-error=register'
  export CFLAGS

and apply the following ↗ patch:

diff -rU0 src.orig/makefile.cfg src/makefile.cfg
--- src.orig/makefile.cfg   2023-07-24 15:37:18.544753422 +0200
+++ src/makefile.cfg    2023-07-24 15:38:11.634757070 +0200
@@ -39 +39 @@
-   @./misc.exe echo - "-Werror" >>gcc.opt
+#  @./misc.exe echo - "-Werror" >>gcc.opt

otherwise build() fails with

doscan.c: In function ‘_instr’:
doscan.c:540:9: error: pointer ‘orig_ptr’ may be used after ‘realloc’ [-Werror=use-after-free]
  540 |         free(orig_ptr);
      |         ^~~~~~~~~~~~~~
[...]
nmalloc.c: In function ‘memalign’:
nmalloc.c:59:23: error: ‘free’ called on pointer ‘<unknown>’ with nonzero offset 16 [-Werror=free-nonheap-object]
   59 | #     define nfree    free
      |                       ^
[...]
nmalloc.c:60:23: error: ‘realloc’ called on pointer ‘m’ with nonzero offset 16 [-Werror=free-nonheap-object]
   60 | #     define nrealloc realloc
      |                       ^
[...]
dosexec.c: In function ‘__dosexec_find_on_path’:
dosexec.c:1420:3: error: ‘strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-truncation]
 1420 |   strncpy(buf, program, blen + 1);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[...]
emu387.cc: In function ‘void fsincos()’:
emu387.cc:2095:16: error: ISO C++17 does not allow ‘register’ storage class specifier [-Werror=register]
 2095 |   register int qq = q & 3;
      |                ^~
emu387.cc: In function ‘void fcos()’:
emu387.cc:2526:16: error: ISO C++17 does not allow ‘register’ storage class specifier [-Werror=register]
 2526 |   register int qq = q & 3;
      |                ^~
[...]
k_rem_pio2.c: In function ‘__kernel_rem_pio2’:
k_rem_pio2.c:296:24: error: ‘fq’ may be used uninitialized [-Werror=maybe-uninitialized]
  296 |                 fw = fq[0]-fw;
      |                      ~~^~~

↗ Upstream issue report was not possible, it refuses with "Due to abuse, the bug database is not currently accepting changes.". I have reported the issue upstream via ↗ email.

Regards & thanks for maintaining!

tranqtech commented on 2023-02-12 15:26 (UTC)

@Hatsum Thank you. I made a rookie mistake when I first tried adding your patch, but after figuring out my error it worked a real treat.

Hatsum commented on 2023-01-29 23:06 (UTC) (edited on 2023-01-29 23:07 (UTC) by Hatsum)

I cloned the Git repository of this package.
Then, I edited the file PKGBUILD as follows:
- I added gcc-12.patch (the name of my patch) to the source attribute,
- I added the sha256 checksum of the patch to sha256sums,
- And I added at the end of the prepare step:

# fix build with gcc >= 12
patch -Np1 < gcc-12.patch

Finally, I used makepkg to build the package with my patch.

epoch32 commented on 2023-01-23 08:46 (UTC)

@Hatsum

how did you apply the patch?

Hatsum commented on 2023-01-14 14:06 (UTC)

I can't build this package with djgpp-gcc 12.2.0-2 because gcc returns several errors as explained in https://www.delorie.com/archives/browse.cgi?p=djgpp-workers/2022/05/15/11:30:49 .

I made the following patch to successfully build the package:

Only in a: gcc-12.patch
diff -r -U3 a/src/libc/ansi/stdio/makefile b/src/libc/ansi/stdio/makefile
--- a/src/libc/ansi/stdio/makefile      2001-05-21 19:25:49.000000000 +0200
+++ b/src/libc/ansi/stdio/makefile      2023-01-14 14:31:35.361845387 +0100
@@ -66,3 +66,6 @@
 SRC += vsnprntf.c

 include $(TOP)/../makefile.inc
+
+doscan.o: EXTRA_CFLAGS= -Wno-use-after-free
+rename.o: EXTRA_CFLAGS= -Wno-use-after-free
diff -r -U3 a/src/libc/ansi/stdlib/makefile b/src/libc/ansi/stdlib/makefile
--- a/src/libc/ansi/stdlib/makefile     2015-05-02 06:32:11.000000000 +0200
+++ b/src/libc/ansi/stdlib/makefile     2023-01-14 14:31:35.371845403 +0100
@@ -37,6 +37,6 @@
 # FIXME: This is really only needed for gcc-5 .
 #        Unfortunatelly GCC version is not yet checked
 #        here.
-nmalloc.o: EXTRA_CFLAGS := -fno-builtin-malloc
+nmalloc.o: EXTRA_CFLAGS := -fno-builtin-malloc -Wno-free-nonheap-object

 include $(TOP)/../makefile.inc
diff -r -U3 a/src/libc/dos/process/makefile b/src/libc/dos/process/makefile
--- a/src/libc/dos/process/makefile     2023-01-14 14:52:48.651858329 +0100
+++ b/src/libc/dos/process/makefile     2023-01-14 14:31:35.381845420 +0100
@@ -14,4 +14,4 @@

 include $(TOP)/../makefile.inc

-dosexec.o: EXTRA_CFLAGS += -Wno-stringop-overflow
+dosexec.o: EXTRA_CFLAGS += -Wno-stringop-overflow -Wno-stringop-truncation
diff -r -U3 a/src/libemu/src/makefile b/src/libemu/src/makefile
--- a/src/libemu/src/makefile   2015-05-02 06:32:33.000000000 +0200
+++ b/src/libemu/src/makefile   2023-01-14 14:31:35.401845452 +0100
@@ -16,7 +16,7 @@
 # FIXME: fix emu387.cc instead to avoid need for -fno-strict-aliasing

 %.o : %.cc
-       $(XNOPGGPP) -c -fno-exceptions -fno-strict-aliasing $<
+       $(XNOPGGPP) -c -fno-exceptions -fno-strict-aliasing -Wno-register $<

 %.o : %.c
        $(XNOPGGCC) -c $<
diff -r -U3 a/src/libm/math/makefile b/src/libm/math/makefile
--- a/src/libm/math/makefile    2015-07-18 16:07:52.000000000 +0200
+++ b/src/libm/math/makefile    2023-01-14 14:31:35.411845468 +0100
@@ -224,6 +224,9 @@
 chew.exe: chew.c
        $(GCC) -O2 -o $@ $<

+k_rem_pio2.o: EXTRA_CFLAGS += -Wno-maybe-uninitialized
+kf_rem_pio2.o: EXTRA_CFLAGS += -Wno-maybe-uninitialized
+
 clean ::
        -$(MISC) rm *.def *.d chew.exe targetdep.texi

This patch only ignore errors returned by gcc but does not fix them :(

JL2210 commented on 2020-05-19 20:47 (UTC)

delorie.com copy of files is down. http://na.mirror.garr.it/mirrors/djgpp/current is reliable

ron2138 commented on 2019-03-16 17:58 (UTC) (edited on 2019-03-16 23:57 (UTC) by ron2138)

(1) Package doesn't built:

Using djgpp-djcrx-bootstrap, but I see no other option.

% tail djgpp-djcrx-2.05-8-x86_64-build.log
tempnam.c:51:3: error: 'strncat' output truncated copying between 0 and 8 bytes from a string of length 8 [-Werror=stringop-truncation]
   strncat (template, x8, 8 - strlen (pfx));
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[3]: *** [../../../makefile.inc:90: tempnam.o] Error 1
make[2]: *** [makefile.sub:25: all_subs] Error 2
make[1]: *** [../makefile.lib:7: all] Error 2
make: *** [makefile:44: subs] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

Edit: djgpp-djcrx-cvs doesn't fail in that way.

(2) Shouldn't this package also

provides=('djgpp-djcrx-bootstrap')

?