jgbit / vuda

VUDA is a header-only library based on Vulkan that provides a CUDA Runtime API interface for writing GPU-accelerated applications.
MIT License
867 stars 35 forks source link

Compilation warning: sys_errlist and sys_nerr are deprecated #11

Closed antoniotorresm closed 4 years ago

antoniotorresm commented 5 years ago

When compiling VUDA (GCC 9.2.0) the following warnings appear:

/usr/bin/ld: CMakeFiles/vuda-reduction.dir/main.cpp.o: in function `vuda::detail::get_errno[abi:cxx11]()':
main.cpp:(.text._ZN4vuda6detail9get_errnoB5cxx11Ev[_ZN4vuda6detail9get_errnoB5cxx11Ev]+0x52): warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead
/usr/bin/ld: main.cpp:(.text._ZN4vuda6detail9get_errnoB5cxx11Ev[_ZN4vuda6detail9get_errnoB5cxx11Ev]+0x36): warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead

I've read there's no trivial fix for this because strerror and strerror_r are not fork safe so I don't know what is the best way to fix this in VUDA.

jgbit commented 5 years ago

Hi, thanks for reporting back. This is a known “issue” which was introduced with https://github.com/jgbit/vuda/pull/7 It is a compromise for now, following http://www.club.cc.cmu.edu/~cmccabe/blog_strerror.html

On a different note, VirtAlloc should probably cause the the process to be killed gracefully if it fails.

EmbersArc commented 4 years ago

Hi, I just ran into a similar issue. It says that sys_nerr and sys_errlist are not defined. I'm on Linux, tried clang 10.0.1 and g++ 10.2.0. Am I missing something or did they finally remove it?

Edit: Found this note in the glibc repository:

* The deprecated symbols sys_errlist, _sys_errlist, sys_nerr, and _sys_nerr
  are no longer available to newly linked binaries, and their declarations
  have been removed from from <stdio.h>.  They are exported solely as
  compatibility symbols to support old binaries.  All programs should use
  strerror or strerror_r instead.
antoniotorresm commented 4 years ago

Looks like it was removed in newer versions of GCC. A fix would be needed for this, otherwise VUDA can't compile.

jgbit commented 4 years ago

Thanks for reporting back, I removed the dependencies on sys_nerr and sys_errlist. While this might not be the ideal solution, their functionality have been used in a very limited scope. Until there is a better alternative I will leave it out of the code base.