Take the 2-minute tour ×

I am packaging a deb file and the configure script is not checking if -fPIC is needed. Thus builds on amd64 fails (as PIC is mandatory).

How can I determine in the Makefile or better in the debian/rules, if -fPIC is needed?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

uname --hardware-platform probably isn't what you want, since it may very well be different from the architecture of your installed libraries and executables (think an i386 kernel and runtime installed on x86_64 hardware), and also because hardware-platform will often end up being "unknown" under Linux.

A well-packaged deb should probably use dpkg-architecture -qDEB_HOST_ARCH for this (example outputs: "amd64", "i386", "armel", etc), so that it gets properly overridden if someone wants to cross-compile.

share|improve this answer
Thanks again! ;) –  Dennis Jul 23 '13 at 20:32
add comment

It is uname --hardware-platform:

ifeq ($(shell uname --hardware-platform), 86_64)
   CFLAGS += -fPIC
share|improve this answer
add comment

Your Answer


