Skip to content

Commit 9245a2c

Browse files
committed
Try to make build more robust
Mixing Python and EPICS build systems has become a rather tangled web. Here we take two precautions: first, sanitise our #defines before including Python.h, and second, only using the flags we absolutely need from `python-config --cflags`.
1 parent 21d360d commit 9245a2c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

softIocApp/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ PYTHON_LIB_DIR := $(shell $(PYTHON) -c \
2828

2929
USR_CFLAGS += -std=gnu99 -Werror
3030

31-
USR_CFLAGS += $(shell $(PYTHON_CONFIG) --cflags)
31+
# We just want the include path for the python library, that should be enough.
32+
# There are a lot of other settings which may conflict with EPICS build
33+
# settings, so we omit them.
34+
USR_CFLAGS += $(shell $(PYTHON_CONFIG) --cflags | tr ' ' '\n' | grep '^-I')
3235

3336
# This tells the compiler to ignore errors generated by EPICS includes. We need
3437
# this because the EPICS headers have non strict prototypes in places.

softIocApp/PythonSupport.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/* See note in softMain.c about these #undefs. */
2+
#undef _POSIX_C_SOURCE
3+
#undef _XOPEN_SOURCE
14
#include <Python.h>
25
#include <string.h>
36

0 commit comments

Comments
 (0)