configure: error: Sorry, the current implemenation requires mmap. due to empty CFLAGS (missing -fPIC)
Closed, ResolvedPublic

Description

Patch to fix attached.

Update patch to cover libraries search (e.g. iconv).

werner added a subscriber: werner.Aug 2 2016, 7:04 PM

Please describe the bug and your patch here. A long title is not a sufficient
description. tia.

@werner, have you looked into the patch?

AC_CHECK_FUNCS([mmap]) on Fedora fails to find mmap() due to missing -fPIC.
/usr/bin/ld: /tmp/ccvNyAcN.o: relocation R_X86_64_PC32 against undefined symbol
`mmap@@GLIBC_2.2.5' can not be used when making a shared object; recompile with
-fPIC

We have -fPIC somewhere in default CFLAGS, so just resotre user CFLAGS
before making checks for functions.

That seems to be a regression due to commit 02eb9fc9d5863abcfed6af704e618f8cac7cc2e8

    If the user's CFLAGS include -Werror, then some configure tests fail.
    To avoid this, we only add the user's CFLAGS after all of the
    configure tests have run.

That patch was obviously wrong because configure now has a different picture on
the build system than make. A better solution to the -Werrror problem would be
to pass -Werror only to the make invocation - or more robust to add an
--enable-werror configure flag.

werner assigned this task to neal.Dec 21 2016, 6:54 PM
werner added a subscriber: neal.
werner raised the priority of this task from Low to Normal.Jan 6 2017, 5:26 PM
werner added a project: gnupg (gpg22).
justus closed this task as Resolved.Mar 7 2017, 3:28 PM
justus claimed this task.
justus reassigned this task from justus to neal.Mar 7 2017, 3:35 PM
justus reopened this task as Open.

Note that simply reverting 02eb9fc9d5863abcfed6af704e618f8cac7cc2e8 will make
our sanitizer build miscompile, likely because -fsanitize=x breaks some test.
This would be easy to fix with my approach, but Werner does not like it.

Justus, I mentioned several solutions on Jabber which do not affect the rule not
to modify CFLAGS.

justus moved this task from Backlog to Blocker on the gnupg (gpg22) board.May 24 2017, 1:23 PM
justus claimed this task.

@werner, can you please quickly outline how you imagine this to be fixed? Our jabber discussion is gone from my memory, and my client does not keep logs for MUCs for some reason.

I can't remember either. We should swicth back to mailing lists for such things.

One obvious thing is to figure the test which bails on -Werror and fix that test.

justus removed justus as the assignee of this task.Jul 18 2017, 12:15 PM
werner moved this task from Blocker to Backlog on the gnupg (gpg22) board.Jul 31 2017, 10:32 AM
werner closed this task as Resolved.Oct 26 2017, 1:09 PM
werner claimed this task.

I close this for now. If you run into problems with 2.2.2 again, please re-open this bug.