-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
1.1.1 fails to build with MUSL libc due to missing linux/mman.h #7207
Comments
The header is being pulled in for |
/usr/include/linux/* are not part of libc, they are part of the
kernel headers. We're doing a direct linux kernel system call, so
we're using kernel headers. You should install the proper kernel
headers for the OS your building for.
Is seems that glibc now does have a wrapper for mlock2() since
2.27, and then also has things in <sys/mman.h>. I guess musl also
has the wrapper based on your comment.
We can add code to check the glibc version and use the glibc
wrapper. We can add the same time to do same thing if you can say
since which version musl supports that, and how to check that.
We have 1 other syscall we do directly when there isn't a glibc
wrapper, and that's getrandom(). Do you have any idea if musl
supports that, and since which version?
|
Ah, apparently this is due to some weirdness with Debian's musl-tools package: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=764335. It doesn't include /usr/include/linux in the header search path. MUSL does include wrappers for mlock2 and getrandom in the new 1.1.20 release: |
These comments in that bug report are quite enlightening: Notably:
and
|
A workaround for this issue to to change your configure line to this:
Using the above the compile succeeds but at the expense of not having the secure memory feature. All the tests pass with the exception of the secmem test. That's probably an OpenSSL bug...i.e. not detecting in the test that we've disabled secure memory. I'm also not sure why Obviously it's not recommended to compile things this way (its clearly better to have the secure memory feature). |
Thanks for the workaround! It's obviously not ideal but it'll unblock builds at least for now. This is a kind of weird issue since it's arguably not OpenSSL's problem, but it's still not great if the workflow to build a statically linked binary with OpenSSL goes from |
If your build pipeline for Linux runs under the Arch Linux OS, you can install |
On alpine I do an |
Does anyone know of a workaround to this issue for ubuntu? I've tried installing Any help would be greatly appreciated |
simplest answer is remove sec_mem from the Makefile. |
ahhh... I'm trying to build openssl as a dependency for a rust project in a CI pipeline. Is there really no way to compile it on ubuntu without needing to modify the openssl source? |
I didn't say that. I said this is a simple answer. I would quibble with saying "on Ubuntu" since you're using a different C library but shrug. Maybe someone else will have a more useful answer for you. |
To be clear, I also tried adding the |
That makes no sense, since all the |
apologies, i spoke too soon. The What I'm seeing now is actually a different issue:
|
@richsalz Thank you for your help. I apologize if my responses seem dismissive. I do appreciate your help, even if your answers are not what i want to hear hahaha |
I found a workaround on ubuntu, without needing to disable secure memory! I added For reference, here's the complete set of steps I used to build openssl against musl in a github actions ubuntu CI runner:
this compiled the openssl libraries and makes all the files available in the /musl directory. To make user of it as a dependency on another build (ie the rust openssl-sys create), i added the following env vars to that build:
Hope someone else finds this useful |
Special build targets are a new feature so -> Post 3.0.0. And of course PRs (against master branch) are welcome for this. |
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: https://github dot com/openssl/openssl/issues/7207#issuecomment-880121450
`linux-headers` package required to fix openssl builds to avoid: ``` ../crypto/mem_sec.c:60:13: fatal error: linux/mman.h: No such file or directory 60 | # include <linux/mman.h> | ^~~~~~~~~~~~~~ ``` Alternative workarounds: - disable 'secure-memory' feature with `no-secure-memory` `./Configure` option - CC="${CC} -static -idirafter /usr/include/ -idirafter /usr/include/$(uname -m)-linux-gnu/" Ref: openssl/openssl#7207 (comment)
@sfackler : can this issue be closed? |
Building OpenSSL 1.1.1 against MUSL libc fails to find the
linux/mman.h
header:The same build setup does work with 1.1.0. This is using the
musl-tools
package on Debian Stretch.The text was updated successfully, but these errors were encountered: