[sheepdog] [PATCH 2/2] sheep: fix building with --enable-trace when compiler uses -pie by default

Marcin Mirosław marcin at mejor.pl
Sun May 24 23:04:05 CEST 2015


When compiler uses -pie by default (e.g. on Gentoo Hardened) compilation fails with
error like below:
libtool: link: x86_64-pc-linux-gnu-gcc -O2 -O0 -pg -Wall -Wshadow -Wmissing-prototypes -Wmissing-declarations
-Wstrict-prototypes -Wpointer-arith -Wwrite-strings -Wbad-function-cast -Wmissing-format-attribute -Wformat=2
-Wformat-security -Wformat-nonliteral -Wno-long-long -Wno-strict-aliasing -Wcast-align -DENABLE_LTTNG_UST
-D_GNU_SOURCE -D_LGPL_SOURCE -std=gnu99 -Wl,-O1 -Wl,--as-needed -Wl,--sort-common -o sheep sheep.o group.o request.o
gateway.o vdi.o journal.o ops.o recovery.o cluster/local.o object_cache.o object_list_cache.o store/common.o
store/md.o store/plain_store.o store/tree_store.o config.o migrate.o http/http.o http/kv.o http/s3.o http/swift.o
http/oalloc.o nfs/nfsd.o nfs/nfs.o nfs/xdr.o nfs/mount.o nfs/fs.o cluster/corosync.o cluster/shepherd.o trace/trace.o
trace/mcount.o trace/graph.o trace/checker.o tracepoint/request_tp.o  ../lib/libsd.a -lm -lisa-l -lcpg -lcfg
-L/usr/lib64 /usr/lib64/libfcgi.so -lnsl -lcurl -lbfd /usr/lib64/liblttng-ust.so
/usr/lib64/liblttng-ust-tracepoint.so -lrt -lurcu-cds -lpthread -lurcu-bp -ldl -pthread
x86_64-pc-linux-gnu-gcc: error: -pie and -pg|p|profile are incompatible when linking
Makefile:562: recipe for target 'sheep' failed

This change fixes it by adding -nopie beside -pg.

Signed-off-by: Marcin Mirosław <marcin at mejor.pl>
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 70b216b..82cb405 100644
--- a/configure.ac
+++ b/configure.ac
@@ -488,7 +488,7 @@ fi
 if test "x${enable_trace}" = xyes && \
 		cc_supports_flag -pg ; then
 	AC_MSG_NOTICE([Enabling trace (-pg)])
-	TRACE_CFLAGS="-pg"
+	TRACE_CFLAGS="-pg -nopie"
 else
 	TRACE_CFLAGS=""
 fi
-- 
2.3.6



More information about the sheepdog mailing list