Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Building with gcc 13.1.0 #1100

Closed
smileaf419 opened this issue May 1, 2023 · 12 comments
Closed

Error Building with gcc 13.1.0 #1100

smileaf419 opened this issue May 1, 2023 · 12 comments

Comments

@smileaf419
Copy link

This is being built with:
make -j5 hiro=gtk3 build=release

Build log
20230501-132-1682953287.log

@LukeUsher
Copy link
Member

../thirdparty/libchdr/src/libchdr_chd.c:2917:6: error: call to undeclared function 'ftello'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
Compiling thirdparty/libchdr/deps/lzma-19.00/src/LzmaDec.c ...
        p = core_stdio_ftell_impl(fp);
            ^

Looks to be an issue with a third party library, libchdr; consider reporting upstream?

https://github.com/rtissera/libchdr

@smileaf419
Copy link
Author

I checked out the master made a build dir and ran:
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DWITH_SYSTEM_ZLIB=1 .. && make

Everything came out clean. Also ran it using the bundled zlib, same results.

@Mastergatto
Copy link
Contributor

Try ensure not having something like -Werror flag set during building.

On my system it just raises warnings instead of errors, and it builds successfully.

@smileaf419
Copy link
Author

No flags are set, ran commands manually.
$ env SHELL=/bin/bash XDG_CONFIG_DIRS=/etc/xdg/ PKG_CONFIG_PATH=/lib/pkgconfig:/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pkgconfig HISTSIZE=1000 LANGUAGE=en_US JAVA_HOME=/opt/jdk PWD=/home/smileaf/ares-132 LOGNAME=smileaf MANPATH=/usr/share/man:/opt/jdk/man HOME=/home/smileaf LANG=en_US.utf8 _PIP_STANDALONE_CERT=/etc/pki/tls/certs/ca-bundle.crt SSH_CONNECTION=192.168.1.158 52882 192.168.1.134 22 INFOPATH=/usr/share/info TERM=xterm USER=smileaf SHLVL=1 INPUTRC=/etc/inputrc CLASSPATH=. LD_LIBRARY_PATH=/lib:/lib64:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64 XDG_RUNTIME_DIR=/tmp/xdg-smileaf SSH_CLIENT=192.168.1.158 52882 22 LC_ALL=en_US XDG_DATA_DIRS=/usr/local/share:/usr/share/ PATH=/usr/local/bin:/bin:/usr/bin:/opt/bin:/opt/jdk/bin MAIL=/var/mail/smileaf SSH_TTY=/dev/pts/3 OLDPWD=/home/smileaf _=/bin/env

$ make hiro=gtk3 build=release make[1]: Entering directory '/srv/media/homes/smileaf/ares-132/desktop-ui' Compiling libco/libco.c ... Compiling thirdparty/sljit/sljit_src/sljitLir.c ... Compiling thirdparty/sljitAllocator.cpp ... Compiling thirdparty/libchdr/src/libchdr_bitstream.c ... Compiling thirdparty/libchdr/src/libchdr_cdrom.c ... Compiling thirdparty/libchdr/src/libchdr_chd.c ... ../thirdparty/libchdr/src/libchdr_chd.c:2917:6: error: call to undeclared function 'ftello'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] p = core_stdio_ftell_impl(fp); ^ ../thirdparty/libchdr/src/libchdr_chd.c:2911:32: note: expanded from macro 'core_stdio_ftell_impl' #define core_stdio_ftell_impl ftello ^ ../thirdparty/libchdr/src/libchdr_chd.c:2917:6: note: did you mean 'ftell'? ../thirdparty/libchdr/src/libchdr_chd.c:2911:32: note: expanded from macro 'core_stdio_ftell_impl' #define core_stdio_ftell_impl ftello ^ /usr/include/stdio.h:718:17: note: 'ftell' declared here extern long int ftell (FILE *__stream) __wur; ^ ../thirdparty/libchdr/src/libchdr_chd.c:2918:2: error: call to undeclared function 'fseeko'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] core_stdio_fseek_impl(fp, 0, SEEK_END); ^ ../thirdparty/libchdr/src/libchdr_chd.c:2910:32: note: expanded from macro 'core_stdio_fseek_impl' #define core_stdio_fseek_impl fseeko ^ ../thirdparty/libchdr/src/libchdr_chd.c:2918:2: note: did you mean 'fseek'? ../thirdparty/libchdr/src/libchdr_chd.c:2910:32: note: expanded from macro 'core_stdio_fseek_impl' #define core_stdio_fseek_impl fseeko ^ /usr/include/stdio.h:713:12: note: 'fseek' declared here extern int fseek (FILE *__stream, long int __off, int __whence); ^ ../thirdparty/libchdr/src/libchdr_chd.c:2955:9: error: call to undeclared function 'fseeko'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] return core_stdio_fseek_impl((FILE*)file->argp, offset, whence); ^ ../thirdparty/libchdr/src/libchdr_chd.c:2910:32: note: expanded from macro 'core_stdio_fseek_impl' #define core_stdio_fseek_impl fseeko ^ 3 errors generated. make[1]: *** [../nall/GNUmakefile:273: obj/libchdr_chd.o] Error 1 make[1]: Leaving directory '/srv/media/homes/smileaf/ares-132/desktop-ui' make: *** [GNUmakefile:4: all] Error 2

@smileaf419
Copy link
Author

Suppose its worth mentioning, I cd thirdparty/libchdr
And used the cmake && make from above, and it builds fine, same terminal ran directly after the error posted directly above.

@invertego
Copy link
Contributor

The ares makefile defaults to Clang if it is present. That error message is not from GCC; it's from Clang. -Wimplicit-function-declaration was promoted from a warning to an error by default in Clang 16 (https://releases.llvm.org/16.0.0/tools/clang/docs/ReleaseNotes.html). The CMake builds you did were actually using GCC which is why they did not reproduce in the issue. Try adding -D CMAKE_C_COMPILER=clang and you should see the same error.

In other words, just as Luke said, this is an issue with libchdr.

If you want to force ares to compile with GCC, you can add compiler=g++ to the invocation of make.

@smileaf419
Copy link
Author

Adding -DCMAKE_C_COMPILER=clang didn’t produce any errors still and built libchdr clean.

Going back to building ares like normal, but with compiler=g++ however allows it to build libchdr fine. However I now get a new error:

Compiling nall/nall.cpp ...
In file included from ../nall/arithmetic.hpp:37,
from ../nall/hash/hash.hpp:3,
from ../nall/hash/sha256.hpp:3,
from ../nall/file-buffer.hpp:12,
from ../nall/file.hpp:3,
from ../nall/directory.hpp:3,
from ../nall/directory.cpp:1,
from ../nall/nall.cpp:9:
../nall/arithmetic/natural.hpp: In function 'void nall::div(const u256&, const u256&, u256&, u256&)':
../nall/arithmetic/natural.hpp:239:23: error: 'runtime_error' is not a member of 'std'
239 | if(!rhs) throw std::runtime_error("division by zero");
| ^~~~~~~~~~~~~
../nall/arithmetic/natural.hpp:1:1: note: 'std::runtime_error' is defined in header ''; did you forget to '#include '?
+++ |+#include
1 | #define ConcatenateType(Size) u##Size
In file included from ../nall/arithmetic.hpp:45:
../nall/arithmetic/natural.hpp: In function 'void nall::div(const u512&, const u512&, u512&, u512&)':
../nall/arithmetic/natural.hpp:239:23: error: 'runtime_error' is not a member of 'std'
239 | if(!rhs) throw std::runtime_error("division by zero");
| ^~~~~~~~~~~~~
../nall/arithmetic/natural.hpp:239:23: note: 'std::runtime_error' is defined in header ''; did you forget to '#include '?
In file included from ../nall/arithmetic.hpp:53:
../nall/arithmetic/natural.hpp: In function 'void nall::div(const u1024&, const u1024&, u1024&, u1024&)':
../nall/arithmetic/natural.hpp:239:23: error: 'runtime_error' is not a member of 'std'
239 | if(!rhs) throw std::runtime_error("division by zero");
| ^~~~~~~~~~~~~
../nall/arithmetic/natural.hpp:239:23: note: 'std::runtime_error' is defined in header ''; did you forget to '#include '?
In file included from ../nall/arithmetic.hpp:61:
../nall/arithmetic/natural.hpp: In function 'void nall::div(const u2048&, const u2048&, u2048&, u2048&)':
../nall/arithmetic/natural.hpp:239:23: error: 'runtime_error' is not a member of 'std'
239 | if(!rhs) throw std::runtime_error("division by zero");
| ^~~~~~~~~~~~~
../nall/arithmetic/natural.hpp:239:23: note: 'std::runtime_error' is defined in header ''; did you forget to '#include '?
In file included from ../nall/arithmetic.hpp:69:
../nall/arithmetic/natural.hpp: In function 'void nall::div(const u4096&, const u4096&, u4096&, u4096&)':
../nall/arithmetic/natural.hpp:239:23: error: 'runtime_error' is not a member of 'std'
239 | if(!rhs) throw std::runtime_error("division by zero");
| ^~~~~~~~~~~~~
../nall/arithmetic/natural.hpp:239:23: note: 'std::runtime_error' is defined in header ''; did you forget to '#include '?
In file included from ../nall/arithmetic.hpp:77:
../nall/arithmetic/natural.hpp: In function 'void nall::div(const u8192&, const u8192&, u8192&, u8192&)':
../nall/arithmetic/natural.hpp:239:23: error: 'runtime_error' is not a member of 'std'
239 | if(!rhs) throw std::runtime_error("division by zero");
| ^~~~~~~~~~~~~
../nall/arithmetic/natural.hpp:239:23: note: 'std::runtime_error' is defined in header ''; did you forget to '#include '?
make[1]: *** [../nall/GNUmakefile:273: obj/nall.o] Error 1
make[1]: Leaving directory '/var/tmp/spkg/ares/ares-132/desktop-ui'

@invertego
Copy link
Contributor

That last one looks like a genuine compilation issue with GCC 13. Easy enough to fix: #1102

@invertego
Copy link
Contributor

Adding -DCMAKE_C_COMPILER=clang didn’t produce any errors still and built libchdr clean.

I just tried this myself, and it turns out you need a few more flags. ares builds C files with -std=c11 and to get that behavior from CMake additionally requires -D CMAKE_C_STANDARD=11 -D CMAKE_C_EXTENSIONS=0.

In my view this would still be most appropriate to address upstream, though this may explain why it wasn't already caught and fixed.

@smileaf419
Copy link
Author

I wanted to report it upstream. But I didn't want to until I could get the error in just their source. Else it's a works for me I worried. I'll mention this in a report later. Thanks!

@smileaf419
Copy link
Author

Bug reported upstream: rtissera/libchdr#92

@LukeUsher
Copy link
Member

Fixed in ares as of #1106

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants