Skip to content

Different C-compilers find different features during Configure #18940

@jkeenan

Description

@jkeenan

While I would expect that configuring with different C compilers would affect the decisions that ./Configure makes with respect to how to subsequently build perl, I would expect, cet. par., that the probes the different compilers use would find the same features present on a given machine.

Today, however, I configured on the same machine with clang10, gcc9 and g++9 and got different findings on each, some of which were unexpected. Here I present excerpts from diffs of the output of ./Configure on FreeBSD-12. For clarity, in each case I configured with sh ./Configure -des -Dusedevel, adding only the appropriate -Dcc=XXX for the respective compilers.

clang10 versus gcc9 (excerpts):

$ diff -w configure.simple.clang10.output.txt configure.simple.gcc9.output.txt
55c55
< Use which C compiler? [clang10]  
---
> Use which C compiler? [gcc9]  
...
530c529
< <quadmath.h> NOT found.
---
> <quadmath.h> found.
776c775
< You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE.
---
> Adding -D_FORTIFY_SOURCE=2 to ccflags...
...
  1. I would have expected either compiler to locate F<quadmath.h>; clang did not.
  2. The clang run tells me that I do not have "gcc 4.* or later", but I clearly have gcc 9. Does that not count?

gcc9 versus g++9 (excerpts):

$ diff -w configure.simple.gcc9.output.txt configure.simple.g++9.output.txt 
55c55
< Use which C compiler? [gcc9]  
---
> Use which C compiler? [g++9]  
136c136,139
< dlopen() found.
---
> dlopen() NOT found.
> Hmm.  Based on the hints in hints/freebsd.sh, 
> the recommended value for $d_dlopen on this machine was "define"!
>     Keep the recommended value? [y]  
140c143
...
282c285,286
< dlsym doesn't need a leading underscore.
---
> I can't compile and run the test program.
> I'm guessing that dlsym doesn't need a leading underscore.
...
  1. Why should gcc find dl_open() while g++ does not?
  2. Why should g++ be unable to compile the test program for dlsym?

clang10 versus g++9 (excerpts)

< Use which C compiler? [clang10]  
---
> Use which C compiler? [g++9]  
...
137c136,139
< dlopen() found.
---
> dlopen() NOT found.
> Hmm.  Based on the hints in hints/freebsd.sh, 
> the recommended value for $d_dlopen on this machine was "define"!
>     Keep the recommended value? [y]  
...
283c285,286
< dlsym doesn't need a leading underscore.
---
> I can't compile and run the test program.
> I'm guessing that dlsym doesn't need a leading underscore.
...
530c530
< <quadmath.h> NOT found.
---
> <quadmath.h> found.
...
776c777
< You seem not to have gcc 4.* or later, not adding -D_FORTIFY_SOURCE.
---
> Adding -D_FORTIFY_SOURCE=2 to ccflags...
...

[Same questions as in each of the two other comparisons above.]

  1. Why should gcc find dl_open() while g++ does not?
  2. Why should g++ be unable to compile the test program for dlsym?
  3. I would have expected either compiler to locate F<quadmath.h>; clang did not.
  4. The clang run tells me that I do not have "gcc 4.* or later", but I clearly have gcc 9. Does that not count?

While I doubt these anomalies are important with such simple config_args, they may be more significant with more complex configurations.

Any thoughts?

Thank you very much.
Jim Keenan

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions