-
-
Notifications
You must be signed in to change notification settings - Fork 43
Only link object files in add_openmp_flags_if_available #374
Conversation
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.
af71938
to
4d48a6e
Compare
@@ -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]) |
There was a problem hiding this comment.
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
)
There was a problem hiding this comment.
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 .
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. |
Only link object files in add_openmp_flags_if_available
Only link object files in add_openmp_flags_if_available
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: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.