Pergunta

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?

Foi útil?

Solução

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.

Outras dicas

It is uname --hardware-platform. This returns x86_64:

ifeq ($(shell uname --hardware-platform), x86_64)
   CFLAGS += -fPIC
   CXXFLAGS += -fPIC
endif
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top