cjdelisle/cjdns — Issue #6: "Hardening" and special build flags break Mac OS X compile
Author: fintler
Created: 2012-01-23 04:43:10+00:00
State: open

As noted in the title, the build flags for source code hardening break the compile on OS X.

Here's a temporary patch until a long term solution can be found:

```diff

index 4036045..fc62848 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,41 +20,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
${CMAKE_SOURCE_DIR}/cmake/modules)

# validation
-add_definitions(-Wall -std=c99 -Werror -pedantic)
-
-# taken from -Wextra
-add_definitions(
- -Wclobbered
- -Wempty-body
- -Wignored-qualifiers
- -Wmissing-field-initializers
- -Wmissing-parameter-type
- -Wold-style-declaration
- -Woverride-init
- -Wsign-compare
- -Wtype-limits
- -Wuninitialized
-# -Wunused-parameter messes up logging
-)
-
-# hardening
-add_definitions(
- -pie
- -fPIE
-
- # Broken GCC patch makes -fstack-protector-all not work
- # workaround is to give -fno-stack-protector first.
- # see: https://bugs.launchpad.net/ubuntu/+source/gcc-4.5/+bug/691722
- -fno-stack-protector
- -fstack-protector-all
-
- -Wstack-protector
- -D_FORTIFY_SOURCE=2
- -Wa,--noexecstack
- -Wl,-z,relro
- -Wl,-z,now
- -Wl,-z,noexecstack
-)
+add_definitions(-Wall -Wextra -std=c99 -Werror -pedantic)

# debugging
add_definitions(-g)
```