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

Re: RFH for cross-building saclib



On 7/6/22 3:24 PM, IOhannes m zmölnig (Debian GNU|Linux) wrote:

On 7/6/22 11:36, Nilesh Patra wrote:

I took a look again after sometime, it seems to happen because libtool tries to compile
with 'gcc' and not the host compiler during link time.

| libtool: link: gcc -shared  -fPIC -DPIC  .libs/AADV.o .libs/ABS.o .libs/ACLOCK.o
| .libs/ADDTO.o .libs/ADV.o .libs/ADV2.o .libs/ADV3.o .......

Is there a way to change this to the host compiler instead?

the actual problem seems to be that you are bypassing any buildsystem (because there is none), and just build directly in d/rules.
and *there*, the CC variable seems to just evaluate to 'cc'.

now the quick fix is (i think) to just include '/usr/share/dpkg/buildtools.mk' at the beginning of d/rules.

That is what I precisely did (I wrote it in the part you snipped :))
It compiles with the right compiler (the host one)
But even then, libtool seems to link with build compiler instead of host compiler.

It compiles with host complier, but during mode=link it uses gcc (as in from build target) instead.
More precisely, it uses the right compiler while linking the static lib; but it changes to gcc while doing a shared linking.

From the logs:

| ...
| libtool: compile:  aarch64-linux-gnu-gcc -Iinclude -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -c src/external.c  -fPIC -DPIC -o .libs/external.o
| libtool: compile:  aarch64-linux-gnu-gcc -Iinclude -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -c src/external.c -o external.o >/dev/null 2>&1
| libtool: compile:  aarch64-linux-gnu-gcc -Iinclude -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -c src/main.c  -fPIC -DPIC -o .libs/main.o
| libtool: compile:  aarch64-linux-gnu-gcc -Iinclude -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -c src/VWRITE.c -o VWRITE.o >/dev/null 2>&1
| sed -e 's|@VERSION[@]|2.2.8|' \
|        -e 's|@MULTIARCH[@]|aarch64-linux-gnu|' debian/saclib.pc.in > debian/saclib.pc
| libtool: compile:  aarch64-linux-gnu-gcc -Iinclude -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -c src/main.c -o main.o >/dev/null 2>&1
| libtool --mode=link --tag=CC aarch64-linux-gnu-gcc -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-z,relro -Wl,-z,now -o libsaclib.la AADV.lo ABS.lo ACLOCK.lo [.. huge list ..]
| libtool: link: gcc -shared  -fPIC -DPIC  .libs/AADV.o .libs/ABS.o[.. huge list ..]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Is there a way to change that?


another possibility would be to provide a proper Makefile to perform the build (either by patching upstream; or by just dropping it into> debian/ and instruct 'dh' to use it) and let dh perform its magic. personally i think i would prefer this solution.

For sure this makes sense. I'll file a bug report for the maintainer to do so, maybe but for now I am seeking if some other
solution exists.

none of my suggestions have been tested in real life, so take them with a grain of salt.

Okay.

gfdmasr
curious: what does this mean?

--
Best,
Nilesh

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


Reply to: