-
Notifications
You must be signed in to change notification settings - Fork 39
Add #define _GNU_SOURCE so that transaction.go can reference C.RTLD_NEXT #35
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
base: master
Are you sure you want to change the base?
Conversation
| #cgo CFLAGS: -Wall -Wno-unused-variable -std=c99 | ||
| #cgo LDFLAGS: -ldl -lpam | ||
| #define _GNU_SOURCE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be only in #ifdef __linux__ and other UNIX systems using glibc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise you can define _GNU_SOURCE for all, then you add an #ifndef RTLD_NEXT that sets it to 0 if unset? I'm not aware of platforms where that is not set, but it's safer to go this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or #if defined(__GLIBC__) maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delayed response
Not obvious what the best solution is here,
GLIBC is defined in features.h, which I could include to test the define, however features.h sets defines based on _GNU_SOURCE, so its not really correct.
I'll update the request with the second suggestion, define _GNU_SOURCE and add the ifndef, from the include file: -
define RTLD_NEXT ((void *) -1l)
I'm assuming this is what you mean (rather than set to zero).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, the define text being really large is a copy-paste error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran into this issue recently as well. May I suggest placing these changes into transaction_linux.go, and perhaps use #cgo CFLAGS: -D_GNU_SOURCE, which seems to be the preferred method.
RTLD_NEXT is inside a #ifdef __USE_GNU block in dlfcn.h, which causes the build to fail This in AlmaLinux release 8.10 (Cerulean Leopard), binary compatible with RHEL
8db7d3c to
da637a2
Compare
RTLD_NEXT is inside a #ifdef __USE_GNU block in dlfcn.h, which causes the build to fail
This in AlmaLinux release 8.10 (Cerulean Leopard), binary compatible with RHEL
fixes #34