Skip to content

Commit

Permalink
Try to build k8 from sources
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
  • Loading branch information
martin-g committed Mar 19, 2024
1 parent 031c35f commit f95cc0b
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ executors:
linux-aarch64:
machine:
image: ubuntu-2204:current
resource_class: arm.medium
resource_class: arm.large

jobs: # a basic unit of work in a run
build_and_test:
Expand Down
30 changes: 27 additions & 3 deletions recipes/k8/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
#!/bin/bash
#!/usr/bin/env bash

set -x

DEFAULT_LINUX_VERSION="cos7"
NODE_VERSION="18.19.1"

wget -O- https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}.tar.gz | tar -zxf -
pushd node-v${NODE_VERSION}

# Workaround the following error that happens only on Azure build for Linux x86_64
# 2024-03-19T13:32:27.9240276Z 13:32:25 BIOCONDA INFO (OUT) ../src/debug_utils.cc:479:11: error: ignoring return value of 'size_t fwrite(const void*, size_t, size_t, FILE*)' declared with attribute 'warn_unused_result' [-Werror=unused-result]
# 2024-03-19T13:32:27.9240731Z 13:32:25 BIOCONDA INFO (OUT) 479 | fwrite(str.data(), str.size(), 1, file);
# 2024-03-19T13:32:27.9241079Z 13:32:25 BIOCONDA INFO (OUT) | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 2024-03-19T13:32:27.9241412Z 13:32:27 BIOCONDA INFO (OUT) cc1plus: some warnings being treated as errors
patch -p0 < ${RECIPE_DIR}/nodejs-x86_64.patch

./configure --without-node-snapshot --without-etw --without-npm --without-inspector --without-dtrace
make -j3
popd

# make it possible to point to the Node sources
sed -i.bak 's/NODE_SRC=../NODE_SRC?=../' Makefile

# Then compile k8
NODE_SRC=node-v${NODE_VERSION} make -j

ls -laR
mkdir -p $PREFIX/bin
# cp k8-$(uname -m)-$(uname -s) $PREFIX/bin/k8
cp k8 $PREFIX/bin/k8
3 changes: 3 additions & 0 deletions recipes/k8/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
c_stdlib_version: # [unix]
- 2.17 # [linux and x86_64]
- 2.17 # [linux and not x86_64]
5 changes: 3 additions & 2 deletions recipes/k8/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ package:
version: {{ version }}

source:
url: https://github.com/attractivechaos/k8/releases/download/v{{ version }}/k8-{{ version }}.tar.bz2
sha256: 61504dad2d63404bf523d3f8d0a8bfd72ec78aa7bd79bdf9291a4f629cfb9c02
url: https://github.com/attractivechaos/k8/archive/refs/tags/v{{ version }}.tar.gz
sha256: 1dbbe50de06f0ae71500d88ed3318d5a2884aeec0b43eda905f5cca5c01a5f72

build:
number: 0
Expand All @@ -18,6 +18,7 @@ requirements:
- {{ compiler('cxx') }}
- make
host:
- python =>3.8
- zlib
- wget
- tar
Expand Down
14 changes: 14 additions & 0 deletions recipes/k8/nodejs-x86_64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--- src/debug_utils.cc.orig 2024-03-19 15:40:50.492023297 +0200
+++ src/debug_utils.cc 2024-03-19 15:44:34.032276878 +0200
@@ -476,7 +476,10 @@
void FWrite(FILE* file, const std::string& str) {
auto simple_fwrite = [&]() {
// The return value is ignored because there's no good way to handle it.
- fwrite(str.data(), str.size(), 1, file);
+ size_t ret = fwrite(str.data(), str.size(), 1, file);
+ if (ret != str.size()) {
+ fprintf(stderr, "fwrite returned error : %lu\n", ret);
+ }
};

if (file != stderr && file != stdout) {

0 comments on commit f95cc0b

Please sign in to comment.