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

Usage of sys/sysctl.h #479

Closed
umlaeute opened this issue Aug 13, 2020 · 11 comments
Closed

Usage of sys/sysctl.h #479

umlaeute opened this issue Aug 13, 2020 · 11 comments

Comments

@umlaeute
Copy link
Contributor

Forwarding a bug that was reported against the Debian package, but which i believe is of general concern:

Version 2.32 of glibc will not ship the sysctl() function and the <sys/sysctl.h> header any more.
sysctl itself has been deprecated in Linux and will be removed.
faust is using it, so will start FTBFS when distributions switch to glibc-2.32.

glibc-2.32 was released last week, so i guess problems will start to appear sooner rather than later.

@sletz
Copy link
Member

sletz commented Aug 24, 2020

Thanks. Can you point out which usage of <sys/sysctl.h> causes problems?

@umlaeute
Copy link
Contributor Author

afaik, the entire file sys/sysctl.h will not be available if you have glibc>=2.32 installed.

so any use will just result in a FTBFS.

@sletz
Copy link
Member

sletz commented Aug 24, 2020

I don't see really problematic cases here: that https://github.com/grame-cncm/faust/search?q=sysctl.h&unscoped_q=sysctl.h

Do you see any?

@umlaeute
Copy link
Contributor Author

well:

#include <sys/sysctl.h>

and

#include <sys/sysctl.h>

this seems to be an unconditional include (not protected by an HAVE_SYS_SYSCTL_H guard) on linux systems.
if the file is not there i expect this to fail. (but haven't tested)

@umlaeute
Copy link
Contributor Author

but if course i don't really know which files are actually used in which contexts.
if i remove sys/sysctl.h from my filesystem, i can still compile faust itself.

but i have no idea if using faust might trigger the inclusion of (e.g.) scheduler.cpp (with whatever options)

@umlaeute
Copy link
Contributor Author

a well, here goes:

$ sudo find /usr/include/ -path "*sys/sysctl.h" -delete
$ faust2jackconsole --scheduler lowCut.dsp
lowCut.dsp.cpp:17567:10: fatal error: sys/sysctl.h: No such file or directory
17567 | #include <sys/sysctl.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.

if i remove the #include <sys/sysctl.h> line form scheduler.cpp, the compilation succeeds.

i guess the include is really only needed on __APPLE__, where you call sysctlbyname().

i don't know about llvm-dsp-multi.h (and won't investigate further, as i think you know the code better than me)

@sletz
Copy link
Member

sletz commented Aug 24, 2020

Right. Should be fixed in 1b90710

@sletz sletz closed this as completed Aug 25, 2020
@umlaeute
Copy link
Contributor Author

just noticed that faust doesn't even compile on GNU/Hurd, because of this line:

#else
#warning Unrecognized platform
#include <sys/sysctl.h>
size_t cache_line_size()

is there any specific reason to include sys/sysctl.h here? it doesn't seem to be used at all.

@sletz should i open a separate (new) ticket?

@sletz
Copy link
Member

sletz commented Jan 27, 2021

Probably a typo,#include <sys/sysctl.h> removed on my local version. Will push soon.

@umlaeute
Copy link
Contributor Author

actually you will need to include a header file for the definition of size_t.

so you could just replace the includes:

--- faust-2.30.5.orig/compiler/generator/tools.cpp
+++ faust-2.30.5/compiler/generator/tools.cpp
@@ -87,7 +87,7 @@ size_t cache_line_size()
 
 #else
 #warning Unrecognized platform
-#include <sys/sysctl.h>
+#include <cstddef>
 size_t cache_line_size()
 {
     return 0;

@sletz
Copy link
Member

sletz commented Jan 27, 2021

OK, thanks.

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

No branches or pull requests

2 participants