automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is the Uniform Name to build program with PIC?


From: Sam Varshavchik
Subject: Re: What is the Uniform Name to build program with PIC?
Date: Sun, 19 May 2019 09:18:30 -0400

Jeffrey Walton writes:

I'm having this problem on 32-bit ARM:
https://stackoverflow.com/q/33474070/608639

That describes a different problem than the one you are describing here.

Our bin_* recipe looks like this:

bin_PROGRAMS = cryptest

cryptest_CXXFLAGS = $(AM_CXXFLAGS)
cryptest_SOURCES = \
    test.cpp bench1.cpp bench2.cpp \
    validat1.cpp validat2.cpp validat3.cpp

cryptest_LDADD = $(lib_LTLIBRARIES)

I think I need one of those uniform names that tell the machinery to
build the program with PIC like the library (lib_LTLIBRARIES). I don't
see the option at
https://www.gnu.org/software/automake/manual/automake.html#Uniform .

What is the Uniform Name to build a program with PIC?

Have you actually verified your theory. You can manually add -fPIC, and any other options, to CXXFLAGS and see if it solves your linking problem. If it does, only then you can worry about how to correctly specify it. -fPIC is provided by the libtool script. If you search your Makefile you won't find it anywhere. The build rule for .lo invokes $(LTCOMPILE), which runs libtool, which adds -fPIC, and perhaps some other flags, before running the compiler.

But if adding -fPIC manually doesn't solve your linking problem, then you can focus on figuring out what the real problem is.

But, presuming that you do need to get the PIC flags in some reasonable way, the only way I see is to extract it out in the configure ac, after libtool is initialized:

PIC_FLAGS="`($srcdir/libtool --config; echo echo \$pic_flag) | sh`"
AC_SUBST(PIC_FLAGS)

Attachment: pgpb2hBVglyuv.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]