Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Only link object files in add_openmp_flags_if_available #374

Merged
merged 1 commit into from
Feb 9, 2018

Conversation

lpsinger
Copy link
Contributor

@lpsinger lpsinger commented Feb 8, 2018

Restrict the OpenMP test to attempting to link files that end in the compiler's object file extension as determined by ccompiler.obj_extension.

The OpenMP test was yielding a false negative if the user had set the environment variable CFLAGS='-coverage' to measure code coverage with GCC. The error message was:

/usr/bin/ld:objects/test_openmp.gcno: file format not recognized; treating as linker script
/usr/bin/ld:objects/test_openmp.gcno:1: syntax error

When GCC is called with the -coverage option, it emits extra data files, which should not be passed to the linker because they are not object files.

@astropy-bot
Copy link

astropy-bot bot commented Feb 8, 2018

Hi there @lpsinger 👋 - thanks for the pull request! I'm just a friendly 🤖 that checks for issues related to the changelog and making sure that this pull request is milestoned and labeled correctly. This is mainly intended for the maintainers, so if you are not a maintainer you can ignore this, and a maintainer will let you know if any action is required on your part 😃.

Everything looks good from my point of view! 👍

If there are any issues with this message, please report them here.

Restrict the OpenMP test to attempting to link files that
end in the compiler's object file extension as determined
by `ccompiler.obj_extension`.

The OpenMP test was yielding a false negative if the user had
set the environment variable `CFLAGS='-coverage'` to measure
code coverage with GCC. The error message was:

    /usr/bin/ld:objects/test_openmp.gcno: file format not
    recognized; treating as linker script
    /usr/bin/ld:objects/test_openmp.gcno:1: syntax error

When GCC is called with the `-coverage` option, it emits extra
data files, which should *not* be passed to the linker because
they are not object files.
@lpsinger lpsinger force-pushed the openmp-objfiles-only branch from af71938 to 4d48a6e Compare February 8, 2018 22:37
@astrofrog astrofrog added this to the v2.0.5 milestone Feb 9, 2018
@@ -73,7 +73,7 @@ def add_openmp_flags_if_available(extension):

# Compile, link, and run test program
ccompiler.compile(['test_openmp.c'], output_dir='objects', extra_postargs=[compile_flag])
ccompiler.link_executable(glob.glob(os.path.join('objects', '*')), 'test_openmp', extra_postargs=[link_flag])
ccompiler.link_executable(glob.glob(os.path.join('objects', '*' + ccompiler.obj_extension)), 'test_openmp', extra_postargs=[link_flag])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be '*.' + ccompiler.obj_extension or is the dot already included? (thinking of files that might end in c but not .c)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore me, it includes the .

@astrofrog
Copy link
Member

I think it might be too late for 2.0.4 as @bsipocz has already set the wheels in motion for that release, so I think this will need to go in 2.0.5.

@astrofrog astrofrog modified the milestones: v2.0.5, v2.0.4 Feb 9, 2018
@bsipocz bsipocz merged commit 3f0eaba into astropy:master Feb 9, 2018
bsipocz added a commit that referenced this pull request Feb 9, 2018
Only link object files in add_openmp_flags_if_available
bsipocz added a commit that referenced this pull request Feb 9, 2018
Only link object files in add_openmp_flags_if_available
@lpsinger lpsinger deleted the openmp-objfiles-only branch February 9, 2018 14:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants