문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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

ifeq ($(shell uname --hardware-platform), x86_64)
   CFLAGS += -fPIC
   CXXFLAGS += -fPIC
endif
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top