45
45
# ##libomp-dev \
46
46
# Other "our" apt installs (development and testing)
47
47
build-essential \
48
+ clang-15 \
48
49
git \
49
50
nano-tiny \
50
51
less \
54
55
# cuda \
55
56
$([ -n "$_CUDA_" ] && echo nvidia-cuda-toolkit) \
56
57
&& \
57
- apt-get clean && rm -rf /var/lib/apt/lists/* && \
58
+ apt-get clean && \
59
+ apt-get autoremove && \
60
+ rm -rf /var/lib/apt/lists/* && \
58
61
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
59
62
locale-gen
60
63
@@ -130,13 +133,16 @@ RUN \
130
133
# Other "our" conda installs
131
134
cmake \
132
135
# "clangdev=$LLVM_REQUIRED_VERSION" \
133
- 'xeus>=2.0,<3.0' \
136
+ 'xeus>=2.0' \
137
+ xeus-zmq \
134
138
'nlohmann_json>=3.9.1,<3.10' \
135
139
'cppzmq>=4.6.0,<5' \
136
140
'xtl>=0.7,<0.8' \
137
- 'openssl<2 ' \
141
+ 'openssl<4 ' \
138
142
ipykernel \
139
143
pugixml \
144
+ zlib \
145
+ libxml2 \
140
146
'cxxopts>=2.2.1,<2.3' \
141
147
libuuid \
142
148
# Test dependencies
@@ -159,6 +165,9 @@ RUN \
159
165
set -x && \
160
166
source /home/jovyan/.conda.init && \
161
167
conda activate .venv && \
168
+ export ARCHITECHURE=$(uname -m) && \
169
+ if [ "$ARCHITECHURE" == "x86_64" ] ; \
170
+ then \
162
171
#
163
172
artifact_name="clang-dev" && \
164
173
#
@@ -167,9 +176,10 @@ RUN \
167
176
echo $PWD && git_remote_origin_url=$(git config --get remote.origin.url) && \
168
177
echo "Debug: Remote origin url: $git_remote_origin_url" && \
169
178
arr=(${git_remote_origin_url//\/ / }) && \
170
- gh_repo_owner=${arr[2]} && \
179
+ arr2=(${arr[0]//:/ }) && \
180
+ gh_repo_owner=${arr2[1]} && \
171
181
gh_f_repo_owner="compiler-research" && \
172
- arr=(${arr[3 ]//./ }) && \
182
+ arr=(${arr[1 ]//./ }) && \
173
183
gh_repo_name=${arr[0]} && \
174
184
gh_repo="${gh_repo_owner}/${gh_repo_name}" && \
175
185
gh_f_repo_name=${gh_repo_name} && \
@@ -193,7 +203,6 @@ RUN \
193
203
pushd /home/runner/work/xeus-clang-repl/xeus-clang-repl && \
194
204
# repo
195
205
echo "Debug: Repo owner/name: ${gh_repo_owner} / ${gh_repo_name}" && \
196
-
197
206
# RUN \
198
207
# set -x && \
199
208
source /home/jovyan/.conda.init && \
@@ -231,26 +240,45 @@ RUN \
231
240
popd && \
232
241
#
233
242
echo "Debug clang path: $PATH_TO_CLANG_DEV" && \
234
- export PATH_TO_LLVM_BUILD=$PATH_TO_CLANG_DEV/inst && \
243
+ export PATH_TO_LLVM_BUILD=$PATH_TO_CLANG_DEV/inst/ && \
244
+ export PATH_TO_LLVM_CONFIG=$PATH_TO_CLANG_DEV/inst/lib/cmake/llvm/ && \
245
+ export PATH_TO_CLANG_CONFIG=$PATH_TO_CLANG_DEV/inst/lib/cmake/clang/ ; \
246
+ fi && \
235
247
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
248
echo "export VENV=$VENV" >> ~/.profile && \
239
- echo "export PATH=$PATH" >> ~/.profile && \
240
249
echo "export EDITOR=emacs" >> ~/.profile && \
241
250
#
242
- # Build CppInterOp
243
- #
251
+ # Build LLVM (if on arm) & CppInterOp
252
+ #
244
253
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
254
export CPLUS_INCLUDE_PATH="${PATH_TO_LLVM_BUILD}/include/llvm:${PATH_TO_LLVM_BUILD}/include/clange:$CPLUS_INCLUDE_PATH:${sys_incs%:}" && \
246
255
git clone https://github.com/compiler-research/CppInterOp.git && \
256
+ if [ "$ARCHITECHURE" == "aarch64" ] ; \
257
+ then \
258
+ export CC=/usr/bin/clang-15 && \
259
+ export CXX=/usr/bin/clang++-15 && \
260
+ git clone --depth=1 --branch release/16.x https://github.com/llvm/llvm-project.git && \
261
+ cd ./llvm-project/ && \
262
+ mkdir build && \
263
+ export LLVM_DIR=$(pwd) && \
264
+ 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 && \
265
+ cd build && \
266
+ 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 && \
267
+ cmake --build . --target clang clang-repl --parallel $(nproc --all) && \
268
+ export PATH_TO_LLVM_CONFIG=$LLVM_DIR/build/lib/cmake/llvm/ && \
269
+ export PATH_TO_CLANG_CONFIG=$LLVM_DIR/build/lib/cmake/clang/ && \
270
+ export PATH_TO_LLVM_BUILD=$LLVM_DIR/build && \
271
+ cd ../../ ; \
272
+ fi && \
273
+ export PATH=${VENV}/bin:${CONDA_DIR}/bin:$PATH_TO_LLVM_BUILD/bin:$PATH && \
274
+ export LD_LIBRARY_PATH=$PATH_TO_LLVM_BUILD/lib:$LD_LIBRARY_PATH && \
275
+ echo "export PATH=$PATH" >> ~/.profile && \
247
276
export CB_PYTHON_DIR="$PWD/cppyy-backend/python" && \
248
277
export CPPINTEROP_DIR="$CB_PYTHON_DIR/cppyy_backend" && \
249
- cd CppInterOp && \
250
- mkdir build && \
251
- cd build && \
278
+ mkdir CppInterOp/build && \
279
+ cd CppInterOp/build && \
252
280
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 .. && \
281
+ 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
282
cmake --build . --parallel $(nproc --all) && \
255
283
# make install -j$(nproc --all)
256
284
export CPLUS_INCLUDE_PATH="$CPPINTEROP_DIR/include:$CPLUS_INCLUDE_PATH" && \
@@ -260,9 +288,10 @@ RUN \
260
288
#
261
289
# Build and Install cppyy-backend
262
290
#
263
- git clone https://github.com/compiler-research/cppyy-backend.git && \
291
+ git clone --depth=1 https://github.com/compiler-research/cppyy-backend.git && \
264
292
cd cppyy-backend && \
265
- mkdir -p $CPPINTEROP_DIR/lib build && cd build && \
293
+ mkdir -p $CPPINTEROP_DIR/lib build && \
294
+ cd build && \
266
295
# Install CppInterOp
267
296
(cd $CPPINTEROP_BUILD_DIR && cmake --build . --target install --parallel $(nproc --all)) && \
268
297
# Build and Install cppyy-backend
@@ -274,9 +303,9 @@ RUN \
274
303
# Build and Install CPyCppyy
275
304
#
276
305
# Install CPyCppyy
277
- git clone https://github.com/compiler-research/CPyCppyy.git && \
278
- cd CPyCppyy && \
279
- mkdir build && cd build && \
306
+ git clone --depth=1 https://github.com/compiler-research/CPyCppyy.git && \
307
+ mkdir CPyCppyy/build && \
308
+ cd CPyCppyy/ build && \
280
309
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. && \
281
310
cmake --build . --parallel $(nproc --all) && \
282
311
export CPYCPPYY_DIR=$PWD && \
@@ -285,7 +314,7 @@ RUN \
285
314
# Build and Install cppyy
286
315
#
287
316
# Install cppyy
288
- git clone https://github.com/compiler-research/cppyy.git && \
317
+ git clone --depth=1 https://github.com/compiler-research/cppyy.git && \
289
318
cd cppyy && \
290
319
python -m pip install --upgrade . --no-deps && \
291
320
cd .. && \
@@ -294,9 +323,9 @@ RUN \
294
323
export PYTHONPATH=$PYTHONPATH:$CPYCPPYY_DIR:$CB_PYTHON_DIR:/home/jovyan && \
295
324
echo "export PYTHONPATH=$PYTHONPATH" >> ~/.profile && \
296
325
export CPLUS_INCLUDE_PATH="/home/jovyan/CPyCppyy/include/:$CPLUS_INCLUDE_PATH" && \
297
- # FIXME: Remove the hardcoded version of python here.
326
+ export PYTHON_VERSION=$(python --version | cut -c8- | cut -f1,2 -d '.' ) && \
298
327
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" && \
328
+ export CPLUS_INCLUDE_PATH="${VENV}/include:${VENV}/include/python${PYTHON_VERSION} :$CPLUS_INCLUDE_PATH" && \
300
329
python -c "import cppyy" && \
301
330
#
302
331
# Build and Install xeus-clang-repl
@@ -312,13 +341,11 @@ RUN \
312
341
# Build and Install Clad
313
342
#
314
343
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 && \
344
+ mkdir clad/build && \
345
+ cd clad/build && \
346
+ 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)" && \
347
+ make -j$(nproc --all) && \
348
+ make install -j$(nproc --all) && \
322
349
# ## install clad in all exist kernels
323
350
# #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
351
# ##
@@ -339,8 +366,8 @@ RUN \
339
366
k="/opt/conda/share/jupyter/kernels/python3/kernel.json" && \
340
367
jq ".argv[0] = \" ${VENV}/bin/python\" " $k > $k.$$.tmp && mv $k.$$.tmp $k && \
341
368
# xtensor
342
- git clone https://github.com/xtensor-stack/xtensor.git && \
343
- cd xtensor && \
344
- mkdir build && cd build && \
369
+ git clone --depth=1 https://github.com/xtensor-stack/xtensor.git && \
370
+ mkdir xtensor/build && \
371
+ cd xtensor/ build && \
345
372
cmake -DCMAKE_INSTALL_PREFIX=$KERNEL_PYTHON_PREFIX .. && \
346
- make install
373
+ make install -j$(nproc --all)
0 commit comments