Re: Non-standard allocations in games/vkquake

2023-03-11 Thread Ali Farzanrad
Thomas Frohwein  wrote:
> On Sat, Mar 11, 2023 at 08:24:58AM +, Ali Farzanrad wrote:
> > Thomas Frohwein  wrote:
> > > On Fri, Mar 10, 2023 at 08:36:06PM +, Ali Farzanrad wrote:
> > > [...]
> > > > > > Please leave in the hunk that removes -Werror
> > > > > 
> > > > > yes, what's the reason for this being in the diff/
> > > > 
> > > > I thought that you've removed that -Werror mistakenly, because it was
> > > > used to detect compiler options and without that flag it's functionality
> > > > (compiler flags detection) is broken.
> 
> tradcpp(1):
>  -Werror   Make warnings into fatal errors.
> 
> There is a reason why this was removed. It wasn't mentioned in this
> particular port when the patch to remove -Werror was committed, but
> we have had ports abort for innocuous warnings.

OK

> > > 
> > > I see those. I feel like there must be a better way to silence those
> > > unused flags. Here they are:
> > > 
> > > cc: warning: optimization flag '-fweb' is not supported 
> > > [-Wignored-optimization-argument]
> > > cc: warning: optimization flag '-frename-registers' is not supported 
> > > [-Wignored-optimization-argument]
> > 
> > OK, but I think it is better to remove the compiler option detection
> > functionality compeletely, instead of breaking it, right?
> 
> Maybe I misunderstood you, but it sounded to me like your goal with
> patching in -Werror or patching out check_gcc was to make the above
> warnings go away.
> If you look through the Makefile, you will find these options aren't added
> by the compiler option detection, but inside the Makefile:
> 
> $ ag -s "(fweb|frename.registers)" Quake/Makefile
> 62:CFLAGS += $(call check_gcc,-fweb,)
> 63:CFLAGS += $(call check_gcc,-frename-registers,)
> 
> The actual question is if there is any value in keeping these options
> (and the warnings) active or not. Given that GCC supports them, I think
> the easiest way is to leave them in, whether or not clang will support
> them, because we still have ports-gcc arches.

I have no idea.

> [...]
> 
> > -check_gcc = $(shell if echo | $(CC) $(1) -Werror -S -o /dev/null -xc - > 
> > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;)
> 
> [...]
> 
> >  CFLAGS += $(CPUFLAGS)
> > +CFLAGS += -DUSE_CRT_MALLOC
> >  ifneq ($(DEBUG),0)
> >  DFLAGS += -D_DEBUG
> >  CFLAGS += -g
> >  do_strip=
> >  else
> >  DFLAGS += -DNDEBUG
> > -CFLAGS += -O3
> > -CFLAGS += $(call check_gcc,-fweb,)
> > -CFLAGS += $(call check_gcc,-frename-registers,)
> > -CFLAGS += $(call check_gcc,-fno-asynchronous-unwind-tables,)
> > -CFLAGS += $(call check_gcc,-fno-ident,)
> > +CFLAGS += -fweb
> > +CFLAGS += -frename-registers
> 
> This doesn't make any sense, you are still adding -fweb and
> -frename-registers. 
> 
> If there is harm in using check_gcc, please explain more clearly.

I just saying removing that -Werror will break check_gcc functionality.
If you don't need check_gcc, then simply remove it, instead of breaking
it.

Anyway, that wasn't important at all.

> [...]
> > > > Server using protocol 999+ (FTE-RMQ)
> > > > Exe: 21:30:40 Mar 10 2023
> > > > 
> > > > Vulkan Initialization
> > > > Using Vulkan 1.1
> > > > Instance extensions:
> > > >  VK_KHR_surface
> > > >  VK_KHR_xlib_surface
> > > >  VK_KHR_get_surface_capabilities2
> > > >  VK_KHR_get_physical_device_properties2
> > > > 
> > > > 
> > > > ERROR-OUT BEGIN
> > > > 
> > > > 
> > > > QUAKE ERROR: Couldn't find any Vulkan devices
> > > > 
> [...]
> > > 
> > > I don't get an error like yours. Do vulkaninfo and vkcube work?
> > 
> > No, they don't work too:
> > $ vulkaninfo
> > ERROR: [Loader Message] Code 0 : remove_all_non_valid_override_layers: 
> > Failed to get executable path and name
> > ERROR: [Loader Message] Code 0 : setup_loader_term_phys_devs:  Failed to 
> > detect any valid GPUs in the current config
> > ERROR at 
> > /usr/obj/ports/vulkan-tools-1.3.239.0/Vulkan-Tools-sdk-1.3.239.0/vulkaninfo/vulkaninfo.h:237:vkEnumeratePhysicalDevices
> >  failed with ERROR_INITIALIZATION_FAILED
> > $ vkcube
> > vkEnumeratePhysicalDevices reported zero accessible devices.
> > 
> > Do you have a compatible Vulkan installable client driver (ICD) installed?
> > Please look at the Getting Started guide for additional information.
> 
> Looks like your problem is with not having a vulkan-compatible video
> device. If you want to find out why, look at your GPU (maybe share a
> dmesg), and inspect glxinfo -B.
> 
> vkquake is closely derived from quakespasm. Maybe try quakespasm if
> your opengl acceleration works and you want to play quake.

OK, thank you.

Oh, I reported an issue for vkquake, and I might gave a bad advise:

https://github.com/Novum/vkQuake/issues/645



Re: Non-standard allocations in games/vkquake

2023-03-11 Thread Thomas Frohwein
On Sat, Mar 11, 2023 at 08:24:58AM +, Ali Farzanrad wrote:
> Thomas Frohwein  wrote:
> > On Fri, Mar 10, 2023 at 08:36:06PM +, Ali Farzanrad wrote:
> > [...]
> > > > > Please leave in the hunk that removes -Werror
> > > > 
> > > > yes, what's the reason for this being in the diff/
> > > 
> > > I thought that you've removed that -Werror mistakenly, because it was
> > > used to detect compiler options and without that flag it's functionality
> > > (compiler flags detection) is broken.

tradcpp(1):
 -Werror   Make warnings into fatal errors.

There is a reason why this was removed. It wasn't mentioned in this
particular port when the patch to remove -Werror was committed, but
we have had ports abort for innocuous warnings.

> > 
> > I see those. I feel like there must be a better way to silence those
> > unused flags. Here they are:
> > 
> > cc: warning: optimization flag '-fweb' is not supported 
> > [-Wignored-optimization-argument]
> > cc: warning: optimization flag '-frename-registers' is not supported 
> > [-Wignored-optimization-argument]
> 
> OK, but I think it is better to remove the compiler option detection
> functionality compeletely, instead of breaking it, right?

Maybe I misunderstood you, but it sounded to me like your goal with
patching in -Werror or patching out check_gcc was to make the above
warnings go away.
If you look through the Makefile, you will find these options aren't added
by the compiler option detection, but inside the Makefile:

$ ag -s "(fweb|frename.registers)" Quake/Makefile
62:CFLAGS += $(call check_gcc,-fweb,)
63:CFLAGS += $(call check_gcc,-frename-registers,)

The actual question is if there is any value in keeping these options
(and the warnings) active or not. Given that GCC supports them, I think
the easiest way is to leave them in, whether or not clang will support
them, because we still have ports-gcc arches.

[...]

> -check_gcc = $(shell if echo | $(CC) $(1) -Werror -S -o /dev/null -xc - > 
> /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;)

[...]

>  CFLAGS += $(CPUFLAGS)
> +CFLAGS += -DUSE_CRT_MALLOC
>  ifneq ($(DEBUG),0)
>  DFLAGS += -D_DEBUG
>  CFLAGS += -g
>  do_strip=
>  else
>  DFLAGS += -DNDEBUG
> -CFLAGS += -O3
> -CFLAGS += $(call check_gcc,-fweb,)
> -CFLAGS += $(call check_gcc,-frename-registers,)
> -CFLAGS += $(call check_gcc,-fno-asynchronous-unwind-tables,)
> -CFLAGS += $(call check_gcc,-fno-ident,)
> +CFLAGS += -fweb
> +CFLAGS += -frename-registers

This doesn't make any sense, you are still adding -fweb and
-frename-registers. 

If there is harm in using check_gcc, please explain more clearly.

[...]
> > > Server using protocol 999+ (FTE-RMQ)
> > > Exe: 21:30:40 Mar 10 2023
> > > 
> > > Vulkan Initialization
> > > Using Vulkan 1.1
> > > Instance extensions:
> > >  VK_KHR_surface
> > >  VK_KHR_xlib_surface
> > >  VK_KHR_get_surface_capabilities2
> > >  VK_KHR_get_physical_device_properties2
> > > 
> > > 
> > > ERROR-OUT BEGIN
> > > 
> > > 
> > > QUAKE ERROR: Couldn't find any Vulkan devices
> > > 
[...]
> > 
> > I don't get an error like yours. Do vulkaninfo and vkcube work?
> 
> No, they don't work too:
> $ vulkaninfo
> ERROR: [Loader Message] Code 0 : remove_all_non_valid_override_layers: Failed 
> to get executable path and name
> ERROR: [Loader Message] Code 0 : setup_loader_term_phys_devs:  Failed to 
> detect any valid GPUs in the current config
> ERROR at 
> /usr/obj/ports/vulkan-tools-1.3.239.0/Vulkan-Tools-sdk-1.3.239.0/vulkaninfo/vulkaninfo.h:237:vkEnumeratePhysicalDevices
>  failed with ERROR_INITIALIZATION_FAILED
> $ vkcube
> vkEnumeratePhysicalDevices reported zero accessible devices.
> 
> Do you have a compatible Vulkan installable client driver (ICD) installed?
> Please look at the Getting Started guide for additional information.

Looks like your problem is with not having a vulkan-compatible video
device. If you want to find out why, look at your GPU (maybe share a
dmesg), and inspect glxinfo -B.

vkquake is closely derived from quakespasm. Maybe try quakespasm if
your opengl acceleration works and you want to play quake.



Re: Non-standard allocations in games/vkquake

2023-03-11 Thread Ali Farzanrad
Thomas Frohwein  wrote:
> On Fri, Mar 10, 2023 at 08:36:06PM +, Ali Farzanrad wrote:
> [...]
> > > > Please leave in the hunk that removes -Werror
> > > 
> > > yes, what's the reason for this being in the diff/
> > 
> > I thought that you've removed that -Werror mistakenly, because it was
> > used to detect compiler options and without that flag it's functionality
> > (compiler flags detection) is broken.
> 
> I see those. I feel like there must be a better way to silence those
> unused flags. Here they are:
> 
> cc: warning: optimization flag '-fweb' is not supported 
> [-Wignored-optimization-argument]
> cc: warning: optimization flag '-frename-registers' is not supported 
> [-Wignored-optimization-argument]

OK, but I think it is better to remove the compiler option detection
functionality compeletely, instead of breaking it, right?

$ cat patches/patch-Quake_Makefile
remove hardcoded optimization flag
use standard library for allocation

Index: Quake/Makefile
--- Quake/Makefile.orig
+++ Quake/Makefile
@@ -25,14 +25,6 @@ MP3LIB=mad
 # which library to use for ogg decoding: vorbis or tremor
 VORBISLIB=vorbis
 
-# ---
-# Helper functions
-# ---
-
-check_gcc = $(shell if echo | $(CC) $(1) -Werror -S -o /dev/null -xc - > 
/dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;)
-
-# ---
-
 HOST_OS := $(shell uname|sed -e s/_.*//|tr '[:upper:]' '[:lower:]')
 
 DEBUG   ?= 0
@@ -51,19 +43,19 @@ LDFLAGS ?=
 DFLAGS ?=
 CFLAGS ?=
 
-CFLAGS += -Wall -Wno-trigraphs -Wno-unused-function -Werror -std=gnu11 -MMD
+CFLAGS += -Wall -Wno-trigraphs -Wno-unused-function -std=gnu11 -MMD
 CFLAGS += $(CPUFLAGS)
+CFLAGS += -DUSE_CRT_MALLOC
 ifneq ($(DEBUG),0)
 DFLAGS += -D_DEBUG
 CFLAGS += -g
 do_strip=
 else
 DFLAGS += -DNDEBUG
-CFLAGS += -O3
-CFLAGS += $(call check_gcc,-fweb,)
-CFLAGS += $(call check_gcc,-frename-registers,)
-CFLAGS += $(call check_gcc,-fno-asynchronous-unwind-tables,)
-CFLAGS += $(call check_gcc,-fno-ident,)
+CFLAGS += -fweb
+CFLAGS += -frename-registers
+CFLAGS += -fno-asynchronous-unwind-tables
+CFLAGS += -fno-ident
 cmd_strip=$(STRIP) $(1)
 define do_strip
$(call cmd_strip,$(1));

> [...]
> > > > > ++CFLAGS += -DUSE_CRT_MALLOC
> > > 
> > > Can you reference documentation about the option USE_CRT_MALLOC? I can't
> > > find any in the vkquake files, nor on a quick web search.
> > 
> > No, I just receive segmentation fault on my arm64 machine:
> > $ doas pkg_add vkquake
> > quirks-6.116 signed on 2023-03-09T01:36:51Z
> > vkquake-1.20.3: ok
> > New and changed readme(s):
> > /usr/local/share/doc/pkg-readmes/vkquake
> > $ vkquake
> > Command line: ./vkquake
> > Found SDL version 2.24.1
> > Detected 8 CPUs.
> > Initializing vkQuake v1.20.3
> > Built with Clang 13.0.0
> > Host_Init
> > Segmentation fault
> > 
> > And it was about a NULL-dereferencing after a failed memory allocation.
> > I tried to find the problem, but its memory management was so complex.
> > I found this option on Quake/mem.c file.
> > 
> > Even after applying my patch it is still not working on my system, but
> > I don't think it is related to this port:
> > $ vkquake
> > Command line: ./vkquake
> > Found SDL version 2.24.1
> > Detected 8 CPUs.
> > Initializing vkQuake v1.20.3
> > Built with Clang 13.0.0 
> > Host_Init
> > Playing registered version.
> > Console initialized.
> > UDP4_Init: gethostbyname failed (Host name lookup failure)
> > UDP4 Initialized
> > UDPv6 Initialized
> > Server using protocol 999+ (FTE-RMQ)
> > Exe: 21:30:40 Mar 10 2023
> > 
> > Vulkan Initialization
> > Using Vulkan 1.1
> > Instance extensions:
> >  VK_KHR_surface
> >  VK_KHR_xlib_surface
> >  VK_KHR_get_surface_capabilities2
> >  VK_KHR_get_physical_device_properties2
> > 
> > 
> > ERROR-OUT BEGIN
> > 
> > 
> > QUAKE ERROR: Couldn't find any Vulkan devices
> > 
> > > > >   ifneq ($(DEBUG),0)
> > > > >   DFLAGS += -D_DEBUG
> > > > > -@@ -59,7 +59,6 @@ CFLAGS += -g
> > > > > + CFLAGS += -g
> > > > >   do_strip=
> > > > >   else
> > > > >   DFLAGS += -DNDEBUG
> > > > > 
> > 
> 
> I don't get an error like yours. Do vulkaninfo and vkcube work?

No, they don't work too:
$ vulkaninfo
ERROR: [Loader Message] Code 0 : remove_all_non_valid_override_layers: Failed 
to get executable path and name
ERROR: [Loader Message] Code 0 : setup_loader_term_phys_devs:  Failed to detect 
any valid GPUs in the current config
ERROR at 
/usr/obj/ports/vulkan-tools-1.3.239.0/Vulkan-Tools-sdk-1.3.239.0/vulkaninfo/vulkaninfo.h:237:vkEnumeratePhysicalDevices
 failed with ERROR_INITIALIZATION_FAILED
$ vkcube
vkEnumeratePhysicalDevices reported zero accessible devices.

Do you have a compatible Vulkan installable client driver (ICD) installed?
Please look at the Getting Started guide for additional information.



Re: Non-standard allocations in games/vkquake

2023-03-10 Thread Thomas Frohwein
On Fri, Mar 10, 2023 at 08:36:06PM +, Ali Farzanrad wrote:
[...]
> > > Please leave in the hunk that removes -Werror
> > 
> > yes, what's the reason for this being in the diff/
> 
> I thought that you've removed that -Werror mistakenly, because it was
> used to detect compiler options and without that flag it's functionality
> (compiler flags detection) is broken.

I see those. I feel like there must be a better way to silence those
unused flags. Here they are:

cc: warning: optimization flag '-fweb' is not supported 
[-Wignored-optimization-argument]
cc: warning: optimization flag '-frename-registers' is not supported 
[-Wignored-optimization-argument]

[...]
> > > > ++CFLAGS += -DUSE_CRT_MALLOC
> > 
> > Can you reference documentation about the option USE_CRT_MALLOC? I can't
> > find any in the vkquake files, nor on a quick web search.
> 
> No, I just receive segmentation fault on my arm64 machine:
> $ doas pkg_add vkquake
> quirks-6.116 signed on 2023-03-09T01:36:51Z
> vkquake-1.20.3: ok
> New and changed readme(s):
> /usr/local/share/doc/pkg-readmes/vkquake
> $ vkquake
> Command line: ./vkquake
> Found SDL version 2.24.1
> Detected 8 CPUs.
> Initializing vkQuake v1.20.3
> Built with Clang 13.0.0
> Host_Init
> Segmentation fault
> 
> And it was about a NULL-dereferencing after a failed memory allocation.
> I tried to find the problem, but its memory management was so complex.
> I found this option on Quake/mem.c file.
> 
> Even after applying my patch it is still not working on my system, but
> I don't think it is related to this port:
> $ vkquake
> Command line: ./vkquake
> Found SDL version 2.24.1
> Detected 8 CPUs.
> Initializing vkQuake v1.20.3
> Built with Clang 13.0.0 
> Host_Init
> Playing registered version.
> Console initialized.
> UDP4_Init: gethostbyname failed (Host name lookup failure)
> UDP4 Initialized
> UDPv6 Initialized
> Server using protocol 999+ (FTE-RMQ)
> Exe: 21:30:40 Mar 10 2023
> 
> Vulkan Initialization
> Using Vulkan 1.1
> Instance extensions:
>  VK_KHR_surface
>  VK_KHR_xlib_surface
>  VK_KHR_get_surface_capabilities2
>  VK_KHR_get_physical_device_properties2
> 
> 
> ERROR-OUT BEGIN
> 
> 
> QUAKE ERROR: Couldn't find any Vulkan devices
> 
> > > >   ifneq ($(DEBUG),0)
> > > >   DFLAGS += -D_DEBUG
> > > > -@@ -59,7 +59,6 @@ CFLAGS += -g
> > > > + CFLAGS += -g
> > > >   do_strip=
> > > >   else
> > > >   DFLAGS += -DNDEBUG
> > > > 
> 

I don't get an error like yours. Do vulkaninfo and vkcube work?

I like using the system allocator, which is what USE_CRT_MALLOC does. I
still have problems with some of the time the game just locking up the
whole system when trying to launch. This is fairly new; I'm wondering
if this is also observed by others...



Re: Non-standard allocations in games/vkquake

2023-03-10 Thread Ali Farzanrad
Hello Thomas,

Thomas Frohwein  wrote:
> On Thu, Mar 09, 2023 at 12:06:57PM +, Stuart Henderson wrote:
> > On 2023/03/09 07:13, Ali Farzanrad wrote:
> > >  --- Quake/Makefile.orig
> > >  +++ Quake/Makefile
> > > -@@ -29,7 +29,7 @@ VORBISLIB=vorbis
> > > - # Helper functions
> > > - # ---
> > > - 
> > > --check_gcc = $(shell if echo | $(CC) $(1) -Werror -S -o /dev/null -xc - 
> > > > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;)
> > > -+check_gcc = $(shell if echo | $(CC) $(1) -S -o /dev/null -xc - > 
> > > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;)
> > > - 
> > 
> > Please leave in the hunk that removes -Werror
> 
> yes, what's the reason for this being in the diff/

I thought that you've removed that -Werror mistakenly, because it was
used to detect compiler options and without that flag it's functionality
(compiler flags detection) is broken.

> > 
> > 
> > > - # ---
> > > - 
> > > -@@ -51,7 +51,7 @@ LDFLAGS ?=
> > > +@@ -51,15 +51,15 @@ LDFLAGS ?=
> > >   DFLAGS ?=
> > >   CFLAGS ?=
> > >   
> > >  -CFLAGS += -Wall -Wno-trigraphs -Wno-unused-function -Werror -std=gnu11 
> > > -MMD
> > >  +CFLAGS += -Wall -Wno-trigraphs -Wno-unused-function -std=gnu11 -MMD
> > >   CFLAGS += $(CPUFLAGS)
> > > ++CFLAGS += -DUSE_CRT_MALLOC
> 
> Can you reference documentation about the option USE_CRT_MALLOC? I can't
> find any in the vkquake files, nor on a quick web search.

No, I just receive segmentation fault on my arm64 machine:
$ doas pkg_add vkquake
quirks-6.116 signed on 2023-03-09T01:36:51Z
vkquake-1.20.3: ok
New and changed readme(s):
/usr/local/share/doc/pkg-readmes/vkquake
$ vkquake
Command line: ./vkquake
Found SDL version 2.24.1
Detected 8 CPUs.
Initializing vkQuake v1.20.3
Built with Clang 13.0.0
Host_Init
Segmentation fault

And it was about a NULL-dereferencing after a failed memory allocation.
I tried to find the problem, but its memory management was so complex.
I found this option on Quake/mem.c file.

Even after applying my patch it is still not working on my system, but
I don't think it is related to this port:
$ vkquake
Command line: ./vkquake
Found SDL version 2.24.1
Detected 8 CPUs.
Initializing vkQuake v1.20.3
Built with Clang 13.0.0 
Host_Init
Playing registered version.
Console initialized.
UDP4_Init: gethostbyname failed (Host name lookup failure)
UDP4 Initialized
UDPv6 Initialized
Server using protocol 999+ (FTE-RMQ)
Exe: 21:30:40 Mar 10 2023

Vulkan Initialization
Using Vulkan 1.1
Instance extensions:
 VK_KHR_surface
 VK_KHR_xlib_surface
 VK_KHR_get_surface_capabilities2
 VK_KHR_get_physical_device_properties2


ERROR-OUT BEGIN


QUAKE ERROR: Couldn't find any Vulkan devices

> > >   ifneq ($(DEBUG),0)
> > >   DFLAGS += -D_DEBUG
> > > -@@ -59,7 +59,6 @@ CFLAGS += -g
> > > + CFLAGS += -g
> > >   do_strip=
> > >   else
> > >   DFLAGS += -DNDEBUG
> > > 



Re: Non-standard allocations in games/vkquake

2023-03-10 Thread Thomas Frohwein
On Thu, Mar 09, 2023 at 12:06:57PM +, Stuart Henderson wrote:
> On 2023/03/09 07:13, Ali Farzanrad wrote:
> >  --- Quake/Makefile.orig
> >  +++ Quake/Makefile
> > -@@ -29,7 +29,7 @@ VORBISLIB=vorbis
> > - # Helper functions
> > - # ---
> > - 
> > --check_gcc = $(shell if echo | $(CC) $(1) -Werror -S -o /dev/null -xc - > 
> > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;)
> > -+check_gcc = $(shell if echo | $(CC) $(1) -S -o /dev/null -xc - > 
> > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;)
> > - 
> 
> Please leave in the hunk that removes -Werror

yes, what's the reason for this being in the diff/

> 
> 
> > - # ---
> > - 
> > -@@ -51,7 +51,7 @@ LDFLAGS ?=
> > +@@ -51,15 +51,15 @@ LDFLAGS ?=
> >   DFLAGS ?=
> >   CFLAGS ?=
> >   
> >  -CFLAGS += -Wall -Wno-trigraphs -Wno-unused-function -Werror -std=gnu11 
> > -MMD
> >  +CFLAGS += -Wall -Wno-trigraphs -Wno-unused-function -std=gnu11 -MMD
> >   CFLAGS += $(CPUFLAGS)
> > ++CFLAGS += -DUSE_CRT_MALLOC

Can you reference documentation about the option USE_CRT_MALLOC? I can't
find any in the vkquake files, nor on a quick web search.

> >   ifneq ($(DEBUG),0)
> >   DFLAGS += -D_DEBUG
> > -@@ -59,7 +59,6 @@ CFLAGS += -g
> > + CFLAGS += -g
> >   do_strip=
> >   else
> >   DFLAGS += -DNDEBUG
> > 



Re: Non-standard allocations in games/vkquake

2023-03-09 Thread Ali Farzanrad
Stuart Henderson  wrote:
> On 2023/03/09 07:13, Ali Farzanrad wrote:
> >  --- Quake/Makefile.orig
> >  +++ Quake/Makefile
> > -@@ -29,7 +29,7 @@ VORBISLIB=vorbis
> > - # Helper functions
> > - # ---
> > - 
> > --check_gcc = $(shell if echo | $(CC) $(1) -Werror -S -o /dev/null -xc - > 
> > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;)
> > -+check_gcc = $(shell if echo | $(CC) $(1) -S -o /dev/null -xc - > 
> > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;)
> > - 
> 
> Please leave in the hunk that removes -Werror

That's just a check_gcc, which is used to detect supported compiler
options; without this -Werror, it adds a lot of compiler options which
produces a lot of not supported warnings:

cc: warning: optimization flag '-fweb' is not supported 
[-Wignored-optimization-argument]
cc: warning: optimization flag '-frename-registers' is not supported 
[-Wignored-optimization-argument]

> > - # ---
> > - 
> > -@@ -51,7 +51,7 @@ LDFLAGS ?=
> > +@@ -51,15 +51,15 @@ LDFLAGS ?=
> >   DFLAGS ?=
> >   CFLAGS ?=
> >   
> >  -CFLAGS += -Wall -Wno-trigraphs -Wno-unused-function -Werror -std=gnu11 
> > -MMD
> >  +CFLAGS += -Wall -Wno-trigraphs -Wno-unused-function -std=gnu11 -MMD
> >   CFLAGS += $(CPUFLAGS)
> > ++CFLAGS += -DUSE_CRT_MALLOC
> >   ifneq ($(DEBUG),0)
> >   DFLAGS += -D_DEBUG
> > -@@ -59,7 +59,6 @@ CFLAGS += -g
> > + CFLAGS += -g
> >   do_strip=
> >   else
> >   DFLAGS += -DNDEBUG
> > 



Re: Non-standard allocations in games/vkquake

2023-03-09 Thread Stuart Henderson
On 2023/03/09 07:13, Ali Farzanrad wrote:
>  --- Quake/Makefile.orig
>  +++ Quake/Makefile
> -@@ -29,7 +29,7 @@ VORBISLIB=vorbis
> - # Helper functions
> - # ---
> - 
> --check_gcc = $(shell if echo | $(CC) $(1) -Werror -S -o /dev/null -xc - > 
> /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;)
> -+check_gcc = $(shell if echo | $(CC) $(1) -S -o /dev/null -xc - > /dev/null 
> 2>&1; then echo "$(1)"; else echo "$(2)"; fi;)
> - 

Please leave in the hunk that removes -Werror


> - # ---
> - 
> -@@ -51,7 +51,7 @@ LDFLAGS ?=
> +@@ -51,15 +51,15 @@ LDFLAGS ?=
>   DFLAGS ?=
>   CFLAGS ?=
>   
>  -CFLAGS += -Wall -Wno-trigraphs -Wno-unused-function -Werror -std=gnu11 -MMD
>  +CFLAGS += -Wall -Wno-trigraphs -Wno-unused-function -std=gnu11 -MMD
>   CFLAGS += $(CPUFLAGS)
> ++CFLAGS += -DUSE_CRT_MALLOC
>   ifneq ($(DEBUG),0)
>   DFLAGS += -D_DEBUG
> -@@ -59,7 +59,6 @@ CFLAGS += -g
> + CFLAGS += -g
>   do_strip=
>   else
>   DFLAGS += -DNDEBUG
> 



Re: Non-standard allocations in games/vkquake

2023-03-08 Thread Ali Farzanrad
Ali Farzanrad  wrote:
> Hi,
> 
> I installed vkquake on my x13s laptop (arm64) but it didn't work.
> After a short debug I found it is a memory allocation error (actually
> NULL-dereferencing after a failed allocation).
> 
> It seems that this port is using it's own memory allocation (mimalloc)
> and after I forced it to use standard allocation functions it didn't
> showed those memory problem again.
> 
> Isn't it old enough that works fast enough without those optimizations?

Sorry, last email had a wrong patch.

Index: patches/patch-Quake_Makefile
===
RCS file: /home/cvs/ports/games/vkquake/patches/patch-Quake_Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 patch-Quake_Makefile
--- patches/patch-Quake_Makefile23 Oct 2022 14:59:26 -  1.7
+++ patches/patch-Quake_Makefile9 Mar 2023 07:08:04 -
@@ -1,27 +1,20 @@
 remove hardcoded optimization flag
+use standard library for allocation
 
 Index: Quake/Makefile
 --- Quake/Makefile.orig
 +++ Quake/Makefile
-@@ -29,7 +29,7 @@ VORBISLIB=vorbis
- # Helper functions
- # ---
- 
--check_gcc = $(shell if echo | $(CC) $(1) -Werror -S -o /dev/null -xc - > 
/dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;)
-+check_gcc = $(shell if echo | $(CC) $(1) -S -o /dev/null -xc - > /dev/null 
2>&1; then echo "$(1)"; else echo "$(2)"; fi;)
- 
- # ---
- 
-@@ -51,7 +51,7 @@ LDFLAGS ?=
+@@ -51,15 +51,15 @@ LDFLAGS ?=
  DFLAGS ?=
  CFLAGS ?=
  
 -CFLAGS += -Wall -Wno-trigraphs -Wno-unused-function -Werror -std=gnu11 -MMD
 +CFLAGS += -Wall -Wno-trigraphs -Wno-unused-function -std=gnu11 -MMD
  CFLAGS += $(CPUFLAGS)
++CFLAGS += -DUSE_CRT_MALLOC
  ifneq ($(DEBUG),0)
  DFLAGS += -D_DEBUG
-@@ -59,7 +59,6 @@ CFLAGS += -g
+ CFLAGS += -g
  do_strip=
  else
  DFLAGS += -DNDEBUG



Non-standard allocations in games/vkquake

2023-03-08 Thread Ali Farzanrad
Hi,

I installed vkquake on my x13s laptop (arm64) but it didn't work.
After a short debug I found it is a memory allocation error (actually
NULL-dereferencing after a failed allocation).

It seems that this port is using it's own memory allocation (mimalloc)
and after I forced it to use standard allocation functions it didn't
showed those memory problem again.

Isn't it old enough that works fast enough without those optimizations?

Index: patches/patch-Quake_Makefile
===
RCS file: /home/cvs/ports/games/vkquake/patches/patch-Quake_Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 patch-Quake_Makefile
--- patches/patch-Quake_Makefile23 Oct 2022 14:59:26 -  1.7
+++ patches/patch-Quake_Makefile9 Mar 2023 06:49:13 -
@@ -1,27 +1,20 @@
 remove hardcoded optimization flag
+use standard library for allocation
 
 Index: Quake/Makefile
 --- Quake/Makefile.orig
 +++ Quake/Makefile
-@@ -29,7 +29,7 @@ VORBISLIB=vorbis
- # Helper functions
- # ---
- 
--check_gcc = $(shell if echo | $(CC) $(1) -Werror -S -o /dev/null -xc - > 
/dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;)
-+check_gcc = $(shell if echo | $(CC) $(1) -S -o /dev/null -xc - > /dev/null 
2>&1; then echo "$(1)"; else echo "$(2)"; fi;)
- 
- # ---
- 
-@@ -51,7 +51,7 @@ LDFLAGS ?=
+@@ -51,15 +51,15 @@ LDFLAGS ?=
  DFLAGS ?=
  CFLAGS ?=
  
 -CFLAGS += -Wall -Wno-trigraphs -Wno-unused-function -Werror -std=gnu11 -MMD
 +CFLAGS += -Wall -Wno-trigraphs -Wno-unused-function -std=gnu11 -MMD
  CFLAGS += $(CPUFLAGS)
++CFLAGS += -DUSE_CRT_ALLOC
  ifneq ($(DEBUG),0)
  DFLAGS += -D_DEBUG
-@@ -59,7 +59,6 @@ CFLAGS += -g
+ CFLAGS += -g
  do_strip=
  else
  DFLAGS += -DNDEBUG