Print

Print


Hi,

At FNAL, we build the XRootD client for binary distribution and use by 
several experiments with our ecosystem which usually involves a specific 
compiler which is different to that native to the system. We are 
currently refreshing our software stack to support clang 5.0.0 at C++17 
on Linux (and MacOS, but that's not the point of this query).

We are building XRootD 2.7.0 on (e.g. SL7), configured as follows:

CC=clang \
CXX=clang++ \
CXXFLAGS='-fno-omit-frame-pointer -std=c++17' \
CFLAGS=-fno-omit-frame-pointer \
cmake /home/greenc/work/cet-is/test-products/xrootd/v4_7_0/source/xrootd-4.7.0 \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DPYTHON_LIBRARY=/home/greenc/work/cet-is/test-products/python/v2_7_14/Linux64bit+3.10-2.17/lib/python2.7 \
-DPYTHON_INCLUDE_DIR=/home/greenc/work/cet-is/test-products/python/v2_7_14/Linux64bit+3.10-2.17/include/python2.7 \
-DCMAKE_INSTALL_PREFIX=/home/greenc/work/cet-is/test-products/xrootd/v4_7_0/Linux64bit+3.10-2.17-c1-prof \
-DENABLE_LIBEVENT=FALSE

Unfortunately, CC and CXX do not appear to be propagated to the 
compilation commands used to produce the library for the python 
bindings, so I patched setup.py, viz:

diff -Naur xrootd-4.7.0/bindings/python/setup.py.in xrootd-4.7.0-new/bindings/python/setup.py.in
--- xrootd-4.7.0/bindings/python/setup.py.in	2017-08-25 09:16:16.000000000 -0500
+++ xrootd-4.7.0-new/bindings/python/setup.py.in	2017-09-19 08:49:59.271173898 -0500
@@ -16,7 +16,13 @@
  py_cflags = cfg_vars["PY_CFLAGS"]
  cfg_vars["PY_CFLAGS"] = " ".join( flag for flag in py_cflags.split() if flag not in ['-Wstrict-prototypes' ${CLANG_PROHIBITED} ] )
  
+ccl=cfg_vars["CC"].split()
+ccl[0]="${CMAKE_C_COMPILER}"
+cfg_vars["CC"] = " ".join(ccl)
+cxxl=cfg_vars["CXX"].split()
+cxxl[0]="${CMAKE_CXX_COMPILER}"
+cfg_vars["CXX"] = " ".join(cxxl)
+cfg_vars["PY_CXXFLAGS"] = "${CMAKE_CXX_FLAGS}"
  
  sources = list()
  depends = list()

This appears to get the compiler series correct, but based on verbose 
log entries, C++ source code files appear to be being compiled with the 
C compiler executable, viz:

/home/greenc/work/cet-is/test-products/clang/v5_0_0/Linux64bit+3.10-2.17/bin/clang \
-pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -fPIC \
-I/home/greenc/work/cet-is/test-products/xrootd/v4_7_0/source/xrootd-4.7.0/src \
-I/home/greenc/work/cet-is/test-products/xrootd/v4_7_0/build/Linux64bit+3.10-2.17-c1-prof/src \
-I/home/greenc/work/cet-is/test-products/python/v2_7_14/Linux64bit+3.10-2.17/include/python2.7 \
-c /home/greenc/work/cet-is/test-products/xrootd/v4_7_0/source/xrootd-4.7.0/bindings/python/src/PyXRootDFile.cc \
-o build/temp.linux-x86_64-2.7/home/greenc/work/cet-is/test-products/xrootd/v4_7_0/source/xrootd-4.7.0/bindings/python/src/PyXRootDFile.o -g

although clang++ is invoked as expected for the final link step:

/home/greenc/work/cet-is/test-products/clang/v5_0_0/Linux64bit+3.10-2.17/bin/clang++ \
-pthread -shared \
-L/home/greenc/work/cet-is/test-products/sqlite/v3_20_01_00/Linux64bit+3.10-2.17/lib \
build/temp.linux-x86_64-2.7/home/greenc/work/cet-is/test-products/xrootd/v4_7_0/source/xrootd-4.7.0/bindings/python/src/PyXRootDFile.o \
build/temp.linux-x86_64-2.7/home/greenc/work/cet-is/test-products/xrootd/v4_7_0/source/xrootd-4.7.0/bindings/python/src/PyXRootDModule.o \
build/temp.linux-x86_64-2.7/home/greenc/work/cet-is/test-products/xrootd/v4_7_0/source/xrootd-4.7.0/bindings/python/src/PyXRootDCopyProcess.o \
build/temp.linux-x86_64-2.7/home/greenc/work/cet-is/test-products/xrootd/v4_7_0/source/xrootd-4.7.0/bindings/python/src/PyXRootDCopyProgressHandler.o \
build/temp.linux-x86_64-2.7/home/greenc/work/cet-is/test-products/xrootd/v4_7_0/source/xrootd-4.7.0/bindings/python/src/PyXRootDFileSystem.o \
build/temp.linux-x86_64-2.7/home/greenc/work/cet-is/test-products/xrootd/v4_7_0/source/xrootd-4.7.0/bindings/python/src/Utils.o \
build/temp.linux-x86_64-2.7/home/greenc/work/cet-is/test-products/xrootd/v4_7_0/source/xrootd-4.7.0/bindings/python/src/PyXRootDURL.o \
-L/home/greenc/work/cet-is/test-products/xrootd/v4_7_0/build/Linux64bit+3.10-2.17-c1-prof/src \
-L/home/greenc/work/cet-is/test-products/xrootd/v4_7_0/build/Linux64bit+3.10-2.17-c1-prof/src/XrdCl \
-L/home/greenc/work/cet-is/test-products/python/v2_7_14/Linux64bit+3.10-2.17/lib \
-lXrdCl -lXrdUtils -ldl -lpython2.7 -o \
build/lib.linux-x86_64-2.7/pyxrootd/client.so \

I am somewhat ignorant of compiling extensions for Python bindings, but 
PY_CXXFLAGS is obviously not being passed to the compilation of the C++ 
code because the C front end is apparently being invoked instead. I've 
even tried renaming the .cc files to .cpp just in case setuptools is 
confused by the .cc file extension, but no joy there either.

By way of further information, this is with Python 2.7.14 and setuptools 
36.5.0.

Is there someone out there to tell me what I should be doing to get what 
I need (or perhaps, to tell me authoritatively that I don't need it 
after all)?

Thanks for any help,

Chris Green.

########################################################################
Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-L list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-L&A=1