From 2a67ba4663277cee0fe454dceda80d67a7d69043 Mon Sep 17 00:00:00 2001 From: Yurii Rashkovskii Date: Tue, 14 Aug 2018 09:21:58 +0000 Subject: [PATCH] Problem: Linking duktape on NixOS with musl This is a little bit of a subtle issue. The way NixOS/Nixpkgs work, they typically wrap binaries (such as the compiler) with more complicated wrappers to handle the paths established in Nixpkgs store and other features. In this case, the feature that's interfering with normal flow is hardening. Without going into too much detail, there's no way to disable _FORTIFY_SOURCE as it is always passed after any passed arguments. Something like `gcc -D_FORTIFY_SOURCE`. However, this doesn't play well with musl (see https://wiki.musl-libc.org/future-ideas.html) Solution: disable `_FORTIFY_SOURCE` if glibc is not present --- src-input/duktape.h.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src-input/duktape.h.in b/src-input/duktape.h.in index 445b03128d..e4b995dd08 100644 --- a/src-input/duktape.h.in +++ b/src-input/duktape.h.in @@ -24,6 +24,10 @@ @DUK_SINGLE_FILE@ +#ifndef __GLIBC__ +#undef _FORTIFY_SOURCE +#endif + /* * BEGIN PUBLIC API */