planetis-m / raylib-examples

MIT License
28 stars 2 forks source link

GCC error compiling custom_logging.nim #5

Closed SpotlightKid closed 2 months ago

SpotlightKid commented 2 months ago
$ uname -a
Linux pulstar 6.10.8-lqx1-1-lqx #1 ZEN SMP PREEMPT Wed, 04 Sep 2024 16:31:40 +0000 x86_64 GNU/Linux

$ nim -v
Nim Compiler Version 2.0.8 [Linux: amd64]
Compiled at 2024-07-03
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 5935c3bfa9fec6505394867b23510eb5cbab3dbf
active boot switches: -d:release

$ LC_ALL=C gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.2.1 20240805 (GCC) 
$ LC_ALL=C nimble test
  Verifying dependencies for raylib_examples@1.2.3
     Info:  Dependency on naylib@any version already satisfied
  Verifying dependencies for naylib@5.1.6
  Executing task test in /home/chris/work/nim/raylib-examples/raylib_examples.nimble
[...]
Compiling example: /home/chris/work/nim/raylib-examples/core/custom_logging.nim
/home/chris/.cache/nim/custom_logging_r/@m..@s..@s..@s..@s.nimble@spkgs2@snaylib-5.1.6-b7577f887fb085b1079f79be4aa11a62564d982d@sraylib.nim.c: In function 'setTraceLogCallback__OOZOOZOOZOOZOnimbleZpkgs50Znaylib4553O49O5445b55535555f565655fb485653b49485557f5557be52aa4949a5450535452d575650dZraylib_u2816':
/home/chris/.cache/nim/custom_logging_r/@m..@s..@s..@s..@s.nimble@spkgs2@snaylib-5.1.6-b7577f887fb085b1079f79be4aa11a62564d982d@sraylib.nim.c:186:29: error: passing argument 1 of 'SetTraceLogCallback' from incompatible pointer type [-Wincompatible-pointer-types]
  186 |         SetTraceLogCallback(wrapperTraceLogCallback__OOZOOZOOZOOZOnimbleZpkgs50Znaylib4553O49O5445b55535555f565655fb485653b49485557f5557be52aa4949a5450535452d575650dZraylib_u2792);
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                             |
      |                             void (*)(int,  char *, __va_list_tag *)
In file included from /home/chris/.cache/nim/custom_logging_r/@m..@s..@s..@s..@s.nimble@spkgs2@snaylib-5.1.6-b7577f887fb085b1079f79be4aa11a62564d982d@sraylib.nim.c:8:
/home/chris/.nimble/pkgs2/naylib-5.1.6-b7577f887fb085b1079f79be4aa11a62564d982d/raylib/raylib.h:1097:49: note: expected 'TraceLogCallback' {aka 'void (*)(int,  const char *, __va_list_tag *)'} but argument is of type 'void (*)(int,  char *, __va_list_tag *)'
 1097 | RLAPI void SetTraceLogCallback(TraceLogCallback callback);         // Set custom trace log
      |                                ~~~~~~~~~~~~~~~~~^~~~~~~~
Error: execution of an external compiler program 'gcc -c  -w -fmax-errors=3 -pthread -I/home/chris/.nimble/pkgs2/naylib-5.1.6-b7577f887fb085b1079f79be4aa11a62564d982d/raylib -I/home/chris/.nimble/pkgs2/naylib-5.1.6-b7577f887fb085b1079f79be4aa11a62564d982d/raylib/external/glfw/include -I/home/chris/.nimble/pkgs2/naylib-5.1.6-b7577f887fb085b1079f79be4aa11a62564d982d/raylib/external/glfw/deps/mingw -Wall -D_GNU_SOURCE -Wno-missing-braces -Werror=pointer-arith -DPLATFORM_DESKTOP_GLFW -DGRAPHICS_API_OPENGL_33 -fPIC -D_GLFW_X11 -O3 -fno-strict-aliasing -fno-ident -fno-math-errno   -I/home/chris/.choosenim/toolchains/nim-2.0.8/lib -I/home/chris/work/nim/raylib-examples/core -o /home/chris/.cache/nim/custom_logging_r/@m..@s..@s..@s..@s.nimble@spkgs2@snaylib-5.1.6-b7577f887fb085b1079f79be4aa11a62564d982d@sraylib.nim.c.o /home/chris/.cache/nim/custom_logging_r/@m..@s..@s..@s..@s.nimble@spkgs2@snaylib-5.1.6-b7577f887fb085b1079f79be4aa11a62564d982d@sraylib.nim.c' failed with exit code: 1

stack trace: (most recent call last)
/home/chris/tmp/nimblecache-1369200236/nimscriptapi_3931930332.nim(212, 16)
/home/chris/work/nim/raylib-examples/raylib_examples.nimble(21, 9) testTask
/home/chris/.choosenim/toolchains/nim-2.0.8/lib/system/nimscript.nim(265, 7) exec
/home/chris/.choosenim/toolchains/nim-2.0.8/lib/system/nimscript.nim(265, 7) Error: unhandled exception: FAILED: nim c -d:release --verbosity:0 --hints:off /home/chris/work/nim/raylib-examples/core/custom_logging.nim [OSError]
       Tip: 3 messages have been suppressed, use --verbose to show them.
nimscriptwrapper.nim(161) execScript

    Error:  Exception raised during nimble script execution
SpotlightKid commented 2 months ago

incompatible pointer type error happening in embedded_files_loading.nim as well:

Compiling example: /home/chris/work/nim/raylib-examples/others/embedded_files_loading.nim
/home/chris/.cache/nim/embedded_files_loading_r/@membedded_files_loading.nim.c: In function 'toWeakWave__OOZOOZOOZOOZOnimbleZpkgs50Znaylib4553O49O5445b55535555f565655fb485653b49485557f5557be52aa4949a5450535452d575650dZraylib_u2890':
/home/chris/.cache/nim/embedded_files_loading_r/@membedded_files_loading.nim.c:294173:20: error: assignment to 'tyOpenArray__UMVJID9bgFAzHOc9bt5jE4PA *' from incompatible pointer type 'NU8 *' {aka 'unsigned char *'} [-Wincompatible-pointer-types]
294173 |         colontmpD_ = data_p0;
       |                    ^
/home/chris/.cache/nim/embedded_files_loading_r/@membedded_files_loading.nim.c: In function 'toWeakImage__OOZOOZOOZOOZOnimbleZpkgs50Znaylib4553O49O5445b55535555f565655fb485653b49485557f5557be52aa4949a5450535452d575650dZraylib_u2837':
/home/chris/.cache/nim/embedded_files_loading_r/@membedded_files_loading.nim.c:294195:20: error: assignment to 'tyOpenArray__UMVJID9bgFAzHOc9bt5jE4PA *' from incompatible pointer type 'NU8 *' {aka 'unsigned char *'} [-Wincompatible-pointer-types]
294195 |         colontmpD_ = data_p0;
       |                    ^
Error: execution of an external compiler program 'gcc -c  -w -fmax-errors=3 -pthread -I/home/chris/.nimble/pkgs2/naylib-5.1.6-b7577f887fb085b1079f79be4aa11a62564d982d/raylib -I/home/chris/.nimble/pkgs2/naylib-5.1.6-b7577f887fb085b1079f79be4aa11a62564d982d/raylib/external/glfw/include -I/home/chris/.nimble/pkgs2/naylib-5.1.6-b7577f887fb085b1079f79be4aa11a62564d982d/raylib/external/glfw/deps/mingw -Wall -D_GNU_SOURCE -Wno-missing-braces -Werror=pointer-arith -DPLATFORM_DESKTOP_GLFW -DGRAPHICS_API_OPENGL_33 -fPIC -D_GLFW_X11 -O3 -fno-strict-aliasing -fno-ident -fno-math-errno   -I/home/chris/.choosenim/toolchains/nim-2.0.8/lib -I/home/chris/work/nim/raylib-examples/others -o /home/chris/.cache/nim/embedded_files_loading_r/@membedded_files_loading.nim.c.o /home/chris/.cache/nim/embedded_files_loading_r/@membedded_files_loading.nim.c' failed with exit code: 1

stack trace: (most recent call last)
/home/chris/tmp/nimblecache-1369200236/nimscriptapi_3931930332.nim(212, 16)
/home/chris/work/nim/raylib-examples/raylib_examples.nimble(22, 9) testTask
/home/chris/.choosenim/toolchains/nim-2.0.8/lib/system/nimscript.nim(265, 7) exec
/home/chris/.choosenim/toolchains/nim-2.0.8/lib/system/nimscript.nim(265, 7) Error: unhandled exception: FAILED: nim c -d:release --verbosity:0 --hints:off /home/chris/work/nim/raylib-examples/others/embedded_files_loading.nim [OSError]
       Tip: 4 messages have been suppressed, use --verbose to show them.
nimscriptwrapper.nim(161) execScript

    Error:  Exception raised during nimble script execution
SpotlightKid commented 2 months ago

And while I'm at it: compiling particles.nim gives this warning:

/home/chris/work/nim/raylib-examples/personal/particles.nim(23, 1) Warning: A custom '=destroy' hook which takes a 'var T' parameter is deprecated; it should take a 'T' parameter [Deprecated]
planetis-m commented 2 months ago

Thanks for the report!

SpotlightKid commented 2 months ago

core/custom_logging.nim still has the error. The parameter type of setTraceLogCallback seems problematic.

planetis-m commented 2 months ago

core/custom_logging.nim still has the error. The parameter type of setTraceLogCallback seems problematic.

That was fixed in https://github.com/planetis-m/naylib/commit/613a64ddf39b908775989dc4d7cb313d9a8c5591 afaik it now compiles.

SpotlightKid commented 2 months ago

Sorry, I still get the same error:

 LC_ALL=C nim c -d:release core/custom_logging.nim 
/home/chris/.cache/nim/custom_logging_r/@m..@s..@s..@s..@s.nimble@spkgs2@snaylib-5.1.6-48ba48ddc8000cd0c2230a70e7865709cec4c83e@sraylib.nim.c: In function 'setTraceLogCallback__OOZOOZOOZOOZOnimbleZpkgs50Znaylib4553O49O54455256ba5256ddc56484848cd48c50505148a5548e55565453554857cec52c5651eZraylib_u2817':
/home/chris/.cache/nim/custom_logging_r/@m..@s..@s..@s..@s.nimble@spkgs2@snaylib-5.1.6-48ba48ddc8000cd0c2230a70e7865709cec4c83e@sraylib.nim.c:186:29: error: passing argument 1 of 'SetTraceLogCallback' from incompatible pointer type [-Wincompatible-pointer-types]
  186 |         SetTraceLogCallback(wrapperTraceLogCallback__OOZOOZOOZOOZOnimbleZpkgs50Znaylib4553O49O54455256ba5256ddc56484848cd48c50505148a5548e55565453554857cec52c5651eZraylib_u2793);
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                             |
      |                             void (*)(int,  char *, __va_list_tag *)
In file included from /home/chris/.cache/nim/custom_logging_r/@m..@s..@s..@s..@s.nimble@spkgs2@snaylib-5.1.6-48ba48ddc8000cd0c2230a70e7865709cec4c83e@sraylib.nim.c:8:
/home/chris/.nimble/pkgs2/naylib-5.1.6-48ba48ddc8000cd0c2230a70e7865709cec4c83e/raylib/raylib.h:1097:49: note: expected 'TraceLogCallback' {aka 'void (*)(int,  const char *, __va_list_tag *)'} but argument is of type 'void (*)(int,  char *, __va_list_tag *)'
 1097 | RLAPI void SetTraceLogCallback(TraceLogCallback callback);         // Set custom trace log
      |                                ~~~~~~~~~~~~~~~~~^~~~~~~~
Error: execution of an external compiler program 'gcc -c  -w -fmax-errors=3 -pthread -I/home/chris/.nimble/pkgs2/naylib-5.1.6-48ba48ddc8000cd0c2230a70e7865709cec4c83e/raylib -I/home/chris/.nimble/pkgs2/naylib-5.1.6-48ba48ddc8000cd0c2230a70e7865709cec4c83e/raylib/external/glfw/include -I/home/chris/.nimble/pkgs2/naylib-5.1.6-48ba48ddc8000cd0c2230a70e7865709cec4c83e/raylib/external/glfw/deps/mingw -Wall -D_GNU_SOURCE -Wno-missing-braces -Werror=pointer-arith -DPLATFORM_DESKTOP_GLFW -DGRAPHICS_API_OPENGL_33 -fPIC -D_GLFW_X11 -O3 -fno-strict-aliasing -fno-ident -fno-math-errno   -I/home/chris/.choosenim/toolchains/nim-2.0.8/lib -I/home/chris/work/nim/raylib-examples/core -o /home/chris/.cache/nim/custom_logging_r/@m..@s..@s..@s..@s.nimble@spkgs2@snaylib-5.1.6-48ba48ddc8000cd0c2230a70e7865709cec4c83e@sraylib.nim.c.o /home/chris/.cache/nim/custom_logging_r/@m..@s..@s..@s..@s.nimble@spkgs2@snaylib-5.1.6-48ba48ddc8000cd0c2230a70e7865709cec4c83e@sraylib.nim.c' failed with exit code: 1

I made sure that I installed naylib from the Git HEAD and de-installed every other version and deleted the nim compiler cache.

planetis-m commented 2 months ago

I tried again (removed nimcache, etc) and it still works for me. We have the same gcc version, but you use an older nim version. I think the bug is in nim and it's fixed in devel.

SpotlightKid commented 2 months ago

Confirmed that it works with Nim devel:

$ nim -v
Nim Compiler Version 2.1.99 [Linux: amd64]
Compiled at 2024-09-06
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: d91297a330a4cccc4d82c06d4c33b16544b0c1bb
active boot switches: -d:release