-
-
Notifications
You must be signed in to change notification settings - Fork 98
Closed
Description
Arch Linux defines hardened default flags for compiling, including _FORTIFY_SOURCE=3. This causes node-argon2 to fail building.
To reproduce:
git clone --recursive https://github.com/ranisalt/node-argon2/
cd node-argon2
CPPFLAGS="-D _FORTIFY_SOURCE=3" npm install
Output:
make: Entering directory '/tmp/node-argon2/build'
CC(target) Release/obj.target/libargon2/argon2/src/opt.o
<command-line>: warning: "_FORTIFY_SOURCE" redefined
<command-line>: note: this is the location of the previous definition
CC(target) Release/obj.target/libargon2/argon2/src/argon2.o
<command-line>: warning: "_FORTIFY_SOURCE" redefined
<command-line>: note: this is the location of the previous definition
CC(target) Release/obj.target/libargon2/argon2/src/blake2/blake2b.o
<command-line>: warning: "_FORTIFY_SOURCE" redefined
<command-line>: note: this is the location of the previous definition
CC(target) Release/obj.target/libargon2/argon2/src/core.o
<command-line>: warning: "_FORTIFY_SOURCE" redefined
<command-line>: note: this is the location of the previous definition
CC(target) Release/obj.target/libargon2/argon2/src/encoding.o
<command-line>: warning: "_FORTIFY_SOURCE" redefined
<command-line>: note: this is the location of the previous definition
CC(target) Release/obj.target/libargon2/argon2/src/thread.o
<command-line>: warning: "_FORTIFY_SOURCE" redefined
<command-line>: note: this is the location of the previous definition
rm -f Release/obj.target/argon2.a Release/obj.target/argon2.a.ar-file-list; mkdir -p `dirname Release/obj.target/argon2.a`
ar crs Release/obj.target/argon2.a @Release/obj.target/argon2.a.ar-file-list
COPY Release/argon2.a
CXX(target) Release/obj.target/argon2/argon2.o
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<command-line>: note: this is the location of the previous definition
cc1plus: all warnings being treated as errors
make: *** [argon2.target.mk:138: Release/obj.target/argon2/argon2.o] Error 1
make: Leaving directory '/tmp/node-argon2/build'
In general, an application should not override _FORTIFY_SOURCE if it's already set.
The Kitty terminal also had this issue: kovidgoyal/kitty#7310 They solved it by checking env variables first.
I tried this with binding.gyp as well (adding a condition that only succeeds if CFLAGS or CPPFLAGS doesn't contain -D _FORTIFY_SOURCE=), but failed so far to find a cross-platform compatible solution.
Is there a way to fix this in gyp? Alternatively, would it be acceptable to drop the flag, and rely on the environment to set it?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels