Skip to content

OpenMP detection broken when building with -coverage #1

@lpsinger

Description

@lpsinger

Detection of OpenMP support when building with the -coverage option (see astropy/astropy-helpers#374) is broken again because the CFLAGS environment variable is propagated to the compiler invocation but not the linker invocation. The environment variable CFLAGS=-coverage normally tells the build process to add the -coverage option to both compiler AND linker commands for C binaries, but as shown below it is only passed to the compiler. As a result, the executable fails to run.

gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -coverage -fPIC -c test_openmp.c -o objects/test_openmp.o -fopenmp
gcc -pthread objects/test_openmp.o -o test_openmp -fopenmp
objects/test_openmp.o: In function `_GLOBAL__sub_I_65535_0_test_openmp.c':
test_openmp.c:(.text.startup+0x38): undefined reference to `__gcov_init'
objects/test_openmp.o:(.data.rel+0x20): undefined reference to `__gcov_merge_add'
collect2: error: ld returned 1 exit status

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions