45
45
# ##libomp-dev \
46
46
# Other "our" apt installs (development and testing)
47
47
build-essential \
48
+ # FIXME: Update to clang-17 once available in apt repository (expected with next LTS version of Ubuntu April 2024)
49
+ # to be use a consistent version of clang throughout
50
+ clang-15 \
48
51
git \
49
52
nano-tiny \
50
53
less \
54
57
# cuda \
55
58
$([ -n "$_CUDA_" ] && echo nvidia-cuda-toolkit) \
56
59
&& \
57
- apt-get clean && rm -rf /var/lib/apt/lists/* && \
60
+ apt-get clean && \
61
+ apt-get autoremove && \
62
+ rm -rf /var/lib/apt/lists/* && \
58
63
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
59
64
locale-gen
60
65
@@ -130,13 +135,16 @@ RUN \
130
135
# Other "our" conda installs
131
136
cmake \
132
137
# "clangdev=$LLVM_REQUIRED_VERSION" \
133
- 'xeus>=2.0,<3.0' \
138
+ 'xeus>=2.0' \
139
+ xeus-zmq \
134
140
'nlohmann_json>=3.9.1,<3.10' \
135
141
'cppzmq>=4.6.0,<5' \
136
142
'xtl>=0.7,<0.8' \
137
- 'openssl<2 ' \
143
+ 'openssl<4 ' \
138
144
ipykernel \
139
145
pugixml \
146
+ zlib \
147
+ libxml2 \
140
148
'cxxopts>=2.2.1,<2.3' \
141
149
libuuid \
142
150
# Test dependencies
@@ -159,6 +167,9 @@ RUN \
159
167
set -x && \
160
168
source /home/jovyan/.conda.init && \
161
169
conda activate .venv && \
170
+ export ARCHITECHURE=$(uname -m) && \
171
+ if [ "$ARCHITECHURE" == "x86_64" ] ; \
172
+ then \
162
173
#
163
174
artifact_name="clang-dev" && \
164
175
#
@@ -167,9 +178,10 @@ RUN \
167
178
echo $PWD && git_remote_origin_url=$(git config --get remote.origin.url) && \
168
179
echo "Debug: Remote origin url: $git_remote_origin_url" && \
169
180
arr=(${git_remote_origin_url//\/ / }) && \
170
- gh_repo_owner=${arr[2]} && \
181
+ arr2=(${arr[0]//:/ }) && \
182
+ gh_repo_owner=${arr2[1]} && \
171
183
gh_f_repo_owner="compiler-research" && \
172
- arr=(${arr[3 ]//./ }) && \
184
+ arr=(${arr[1 ]//./ }) && \
173
185
gh_repo_name=${arr[0]} && \
174
186
gh_repo="${gh_repo_owner}/${gh_repo_name}" && \
175
187
gh_f_repo_name=${gh_repo_name} && \
@@ -193,7 +205,6 @@ RUN \
193
205
pushd /home/runner/work/xeus-clang-repl/xeus-clang-repl && \
194
206
# repo
195
207
echo "Debug: Repo owner/name: ${gh_repo_owner} / ${gh_repo_name}" && \
196
-
197
208
# RUN \
198
209
# set -x && \
199
210
source /home/jovyan/.conda.init && \
@@ -231,26 +242,48 @@ RUN \
231
242
popd && \
232
243
#
233
244
echo "Debug clang path: $PATH_TO_CLANG_DEV" && \
234
- export PATH_TO_LLVM_BUILD=$PATH_TO_CLANG_DEV/inst && \
245
+ export PATH_TO_LLVM_BUILD=$PATH_TO_CLANG_DEV/inst/ && \
246
+ export PATH_TO_LLVM_CONFIG=$PATH_TO_CLANG_DEV/inst/lib/cmake/llvm/ && \
247
+ export PATH_TO_CLANG_CONFIG=$PATH_TO_CLANG_DEV/inst/lib/cmake/clang/ ; \
248
+ fi && \
235
249
export VENV=${CONDA_DIR}/envs/.venv && \
236
- export PATH=${VENV}/bin:${CONDA_DIR}/bin:$PATH_TO_LLVM_BUILD/bin:$PATH && \
237
- export LD_LIBRARY_PATH=$PATH_TO_LLVM_BUILD/lib:$LD_LIBRARY_PATH && \
238
250
echo "export VENV=$VENV" >> ~/.profile && \
239
- echo "export PATH=$PATH" >> ~/.profile && \
240
251
echo "export EDITOR=emacs" >> ~/.profile && \
241
252
#
242
- # Build CppInterOp
243
- #
253
+ # Build LLVM (if on arm) & CppInterOp
254
+ #
244
255
sys_incs=$(LC_ALL=C c++ -xc++ -E -v /dev/null 2>&1 | LC_ALL=C sed -ne '/starts here/,/End of/p' | LC_ALL=C sed '/^ /!d' | cut -c2- | tr '\n ' ':' ) && \
245
256
export CPLUS_INCLUDE_PATH="${PATH_TO_LLVM_BUILD}/include/llvm:${PATH_TO_LLVM_BUILD}/include/clange:$CPLUS_INCLUDE_PATH:${sys_incs%:}" && \
246
257
git clone https://github.com/compiler-research/CppInterOp.git && \
258
+ if [ "$ARCHITECHURE" == "aarch64" ] ; \
259
+ then \
260
+ # FIXME: Update to clang-17 once clang-17 is available in apt repository (expected with next LTS version of Ubuntu
261
+ # around April 2024)
262
+ export CC=/usr/bin/clang-15 && \
263
+ export CXX=/usr/bin/clang++-15 && \
264
+ # FIXME: Currently build with version 16.x on arm due to issue mentioned here https://github.com/compiler-research/xeus-clang-repl/issues/78
265
+ git clone --depth=1 --branch release/16.x https://github.com/llvm/llvm-project.git && \
266
+ cd ./llvm-project/ && \
267
+ mkdir build && \
268
+ export LLVM_DIR=$(pwd) && \
269
+ compgen -G "../CppInterOp/patches/llvm/clang16-*.patch" > /dev/null && find ../CppInterOp/patches/llvm/clang16-*.patch -printf "%f\n " && git apply ../CppInterOp/patches/llvm/clang16-*.patch && \
270
+ cd build && \
271
+ cmake -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD="host;NVPTX" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_USE_LINKER=gold -DCLANG_ENABLE_STATIC_ANALYZER=OFF -DCLANG_ENABLE_ARCMT=OFF -DCLANG_ENABLE_FORMAT=OFF -DCLANG_ENABLE_BOOTSTRAP=OFF ../llvm && \
272
+ cmake --build . --target clang clang-repl --parallel $(nproc --all) && \
273
+ export PATH_TO_LLVM_CONFIG=$LLVM_DIR/build/lib/cmake/llvm/ && \
274
+ export PATH_TO_CLANG_CONFIG=$LLVM_DIR/build/lib/cmake/clang/ && \
275
+ export PATH_TO_LLVM_BUILD=$LLVM_DIR/build && \
276
+ cd ../../ ; \
277
+ fi && \
278
+ export PATH=${VENV}/bin:${CONDA_DIR}/bin:$PATH_TO_LLVM_BUILD/bin:$PATH && \
279
+ export LD_LIBRARY_PATH=$PATH_TO_LLVM_BUILD/lib:$LD_LIBRARY_PATH && \
280
+ echo "export PATH=$PATH" >> ~/.profile && \
247
281
export CB_PYTHON_DIR="$PWD/cppyy-backend/python" && \
248
282
export CPPINTEROP_DIR="$CB_PYTHON_DIR/cppyy_backend" && \
249
- cd CppInterOp && \
250
- mkdir build && \
251
- cd build && \
283
+ mkdir CppInterOp/build && \
284
+ cd CppInterOp/build && \
252
285
export CPPINTEROP_BUILD_DIR=$PWD && \
253
- cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DUSE_CLING=OFF -DUSE_REPL=ON -DLLVM_DIR=$PATH_TO_LLVM_BUILD -DLLVM_USE_LINKER=gold -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR .. && \
286
+ cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DUSE_CLING=OFF -DUSE_REPL=ON -DLLVM_DIR=$PATH_TO_LLVM_CONFIG -DClang_DIR=$PATH_TO_CLANG_CONFIG -DLLVM_USE_LINKER=gold -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=$CPPINTEROP_DIR .. && \
254
287
cmake --build . --parallel $(nproc --all) && \
255
288
# make install -j$(nproc --all)
256
289
export CPLUS_INCLUDE_PATH="$CPPINTEROP_DIR/include:$CPLUS_INCLUDE_PATH" && \
@@ -260,9 +293,10 @@ RUN \
260
293
#
261
294
# Build and Install cppyy-backend
262
295
#
263
- git clone https://github.com/compiler-research/cppyy-backend.git && \
296
+ git clone --depth=1 https://github.com/compiler-research/cppyy-backend.git && \
264
297
cd cppyy-backend && \
265
- mkdir -p $CPPINTEROP_DIR/lib build && cd build && \
298
+ mkdir -p $CPPINTEROP_DIR/lib build && \
299
+ cd build && \
266
300
# Install CppInterOp
267
301
(cd $CPPINTEROP_BUILD_DIR && cmake --build . --target install --parallel $(nproc --all)) && \
268
302
# Build and Install cppyy-backend
@@ -274,9 +308,9 @@ RUN \
274
308
# Build and Install CPyCppyy
275
309
#
276
310
# Install CPyCppyy
277
- git clone https://github.com/compiler-research/CPyCppyy.git && \
278
- cd CPyCppyy && \
279
- mkdir build && cd build && \
311
+ git clone --depth=1 https://github.com/compiler-research/CPyCppyy.git && \
312
+ mkdir CPyCppyy/build && \
313
+ cd CPyCppyy/ build && \
280
314
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. && \
281
315
cmake --build . --parallel $(nproc --all) && \
282
316
export CPYCPPYY_DIR=$PWD && \
@@ -285,7 +319,7 @@ RUN \
285
319
# Build and Install cppyy
286
320
#
287
321
# Install cppyy
288
- git clone https://github.com/compiler-research/cppyy.git && \
322
+ git clone --depth=1 https://github.com/compiler-research/cppyy.git && \
289
323
cd cppyy && \
290
324
python -m pip install --upgrade . --no-deps && \
291
325
cd .. && \
@@ -294,9 +328,9 @@ RUN \
294
328
export PYTHONPATH=$PYTHONPATH:$CPYCPPYY_DIR:$CB_PYTHON_DIR:/home/jovyan && \
295
329
echo "export PYTHONPATH=$PYTHONPATH" >> ~/.profile && \
296
330
export CPLUS_INCLUDE_PATH="/home/jovyan/CPyCppyy/include/:$CPLUS_INCLUDE_PATH" && \
297
- # FIXME: Remove the hardcoded version of python here.
331
+ export PYTHON_VERSION=$(python --version | cut -c8- | cut -f1,2 -d '.' ) && \
298
332
export CPLUS_INCLUDE_PATH="/home/jovyan/clad/include:$CPLUS_INCLUDE_PATH" && \
299
- export CPLUS_INCLUDE_PATH="${VENV}/include:${VENV}/include/python3.10 :$CPLUS_INCLUDE_PATH" && \
333
+ export CPLUS_INCLUDE_PATH="${VENV}/include:${VENV}/include/python${PYTHON_VERSION} :$CPLUS_INCLUDE_PATH" && \
300
334
python -c "import cppyy" && \
301
335
#
302
336
# Build and Install xeus-clang-repl
@@ -312,13 +346,11 @@ RUN \
312
346
# Build and Install Clad
313
347
#
314
348
git clone --depth=1 https://github.com/vgvassilev/clad.git && \
315
- cd clad && \
316
- mkdir build && \
317
- cd build && \
318
- cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. -DClang_DIR=${PATH_TO_LLVM_BUILD}/lib/cmake/clang/ -DLLVM_DIR=${PATH_TO_LLVM_BUILD}/lib/cmake/llvm/ -DCMAKE_INSTALL_PREFIX=${CONDA_DIR} -DLLVM_EXTERNAL_LIT="$(which lit)" && \
319
- # make -j$(nproc --all) && \
320
- make && \
321
- make install && \
349
+ mkdir clad/build && \
350
+ cd clad/build && \
351
+ cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. -DClang_DIR=$PATH_TO_CLANG_CONFIG -DLLVM_DIR=$PATH_TO_LLVM_CONFIG -DCMAKE_INSTALL_PREFIX=${CONDA_DIR} -DLLVM_EXTERNAL_LIT="$(which lit)" && \
352
+ make -j$(nproc --all) && \
353
+ make install -j$(nproc --all) && \
322
354
# ## install clad in all exist kernels
323
355
# #for i in "$KERNEL_PYTHON_PREFIX"/share/jupyter/kernels/*; do if [[ $i =~ .*/clad-xcpp.* ]]; then jq '.argv += ["-fplugin=$KERNEL_PYTHON_PREFIX/lib/clad.so"] | .display_name += " (with clad)"' "$i"/kernel.json > tmp.$$.json && mv tmp.$$.json "$i"/kernel.json; fi; done && \
324
356
# ##
@@ -339,8 +371,8 @@ RUN \
339
371
k="/opt/conda/share/jupyter/kernels/python3/kernel.json" && \
340
372
jq ".argv[0] = \" ${VENV}/bin/python\" " $k > $k.$$.tmp && mv $k.$$.tmp $k && \
341
373
# xtensor
342
- git clone https://github.com/xtensor-stack/xtensor.git && \
343
- cd xtensor && \
344
- mkdir build && cd build && \
374
+ git clone --depth=1 https://github.com/xtensor-stack/xtensor.git && \
375
+ mkdir xtensor/build && \
376
+ cd xtensor/ build && \
345
377
cmake -DCMAKE_INSTALL_PREFIX=$KERNEL_PYTHON_PREFIX .. && \
346
- make install
378
+ make install -j$(nproc --all)
0 commit comments