Bug#1068708: Building with EPICS fails because the compiler cannot find `compilerSpecific.h`.

Andrius Merkys merkys at debian.org
Wed Apr 10 14:59:26 BST 2024


Hi Florian,

On 2024-04-10 16:40, Florian Forster wrote:
> pkg-config references paths (/build/reproducible-path/…) that likely 
> exist on the build system, but are not provided by the package:
> 
> ```
> # pkg-config epics-base --cflags | sed -e 's/  */\n/g'
> -I/build/reproducible-path/epics-base-7.0.8+dfsg1/include
> -I/build/reproducible-path/epics-base-7.0.8+dfsg1/include/os/Linux
> -I/build/reproducible-path/epics-base-7.0.8+dfsg1/include/compiler/gcc
> -D_GNU_SOURCE
> -D_DEFAULT_SOURCE
> -D_X86_64_
> -DUNIX
> -Dlinux
> -ffile-prefix-map=/build/reproducible-path/epics-base-7.0.8+dfsg1=.
> -D_FORTIFY_SOURCE=2
> -ffile-prefix-map=/build/reproducible-path/epics-base-7.0.8+dfsg1=.
> -fstack-protector-strong
> -fstack-clash-protection
> -fcf-protection
> -D_FORTIFY_SOURCE=2
> -mtune=generic
> -m64
> # dpkg -L epics-dev | grep /build; echo $?
> 1
> ```

You are right - this has been reported as bug #1059706 and marked as 
fixed since, although incorrect paths apparently were left in 
epics-base.pc. I have reopened #1059706 to deal with that.

> Unrelated to this bug: my recommendation would be to keep the CPP flags 
> (`-I`, `-D`) and remove the C flags (`-f`, `-m`).

It seems that EPICS straightforwardly puts its build flags to 
epics-base.pc. Many of these flags are specific to EPICS build and 
should not be used for reverse-dependencies.

>> What compiler do you use?
> 
> We test our project with GCC and clang.

OK, thanks.

>> Does this patch work for you?
> 
> Kind of. It fixes the compiler specific include described in the initial 
> report, but fails to find an OS specific include:
> 
> ```
> In file included from /usr/include/epics/cadef.h:35,
>                   from src/epics.c:26:
> /usr/include/epics/epicsThread.h:468:10: fatal error: osdThread.h: No 
> such file or directory
>    468 | #include "osdThread.h"
>        |          ^~~~~~~~~~~~~
> ```
> 
>> Can you as well try to add /usr/include/compiler/gcc to your compiler's include path?
> 
> That path alone is not enough, but this works:
> 
> ```
> make CPPFLAGS="-I/usr/include/epics -I/usr/include/epics/compiler/gcc 
> -I/usr/include/epics/os/Linux"
> ```

I guess that both /usr/include/epics/os/Linux/ and 
/usr/include/epics/compiler/gcc/ should be in the include path. Thus the 
following should work on GCC without patching EPICS code:

make CPPFLAGS="-I/usr/include/epics -I/usr/include/epics/compiler/gcc 
-I/usr/include/epics/os/Linux"

I wonder why clang cannot work with compilerSpecific.h. Most likely it 
contains GCC-specific instructions.

I think a viable solution for clang would be to create an empty file in 
/usr/include/epics/compiler/clang/compilerSpecific.h (no compiler 
specific settings for clang) and use include paths to indicate the used 
compiler, for clang:

make CPPFLAGS="-I/usr/include/epics -I/usr/include/epics/compiler/clang 
-I/usr/include/epics/os/Linux"

However, this should better be discussed with the upstream. They may 
want to automatically identify the compiler using __GNUC__ and similar 
checks.

> Thanks for your time and effort maintaining this package, I appreciate it!

Thank you for the report!

Best wishes,
Andrius



More information about the debian-science-maintainers mailing list