Skip to content

Commit 82da326

Browse files
committed
fix: disable AL2 build due to GCC 7.3.1 C++17 limitations
- Comment out AL2 layer and test functions in CDK integration - AL2's GCC 7.3.1 lacks <filesystem> header required by Tesseract 5.5.2 - Keep AL2023 build which works with modern GCC - AL2 users can build locally with Tesseract 5.4.x or earlier - Update documentation with AL2 technical limitation note - CI now only builds and tests AL2023 (Python 3.12, Node.js 20) - AL2 Dockerfile remains available for local builds
1 parent 3952dd7 commit 82da326

6 files changed

Lines changed: 100 additions & 129 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projen/tasks.json

Lines changed: 0 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projenrc.ts

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -115,26 +115,27 @@ class BinaryPatchComponent extends Component {
115115

116116
new BinaryPatchComponent(project);
117117

118-
project.addTask(`test:integration:python`, {
119-
steps: [
120-
{
121-
spawn: `synth:silent`,
122-
},
123-
{
124-
exec: `sam local invoke -t cdk.out/tesseract-lambda-ci.template.json python --no-event > py-test-output.txt && cat py-test-output.txt | grep -Eiv \"(fail|error|exception)\"`,
125-
},
126-
],
127-
});
128-
project.addTask(`test:integration:node`, {
129-
steps: [
130-
{
131-
spawn: `synth:silent`,
132-
},
133-
{
134-
exec: `sam local invoke -t cdk.out/tesseract-lambda-ci.template.json node --no-event > node-test-output.txt && cat node-test-output.txt | grep -Eiv \"(fail|error|exception)\"`,
135-
},
136-
],
137-
});
118+
// AL2 integration tests temporarily disabled (AL2 deprecated, GCC 7.3.1 incompatible with Tesseract 5.5.2)
119+
// project.addTask(`test:integration:python`, {
120+
// steps: [
121+
// {
122+
// spawn: `synth:silent`,
123+
// },
124+
// {
125+
// exec: `sam local invoke -t cdk.out/tesseract-lambda-ci.template.json python --no-event > py-test-output.txt && cat py-test-output.txt | grep -Eiv \"(fail|error|exception)\"`,
126+
// },
127+
// ],
128+
// });
129+
// project.addTask(`test:integration:node`, {
130+
// steps: [
131+
// {
132+
// spawn: `synth:silent`,
133+
// },
134+
// {
135+
// exec: `sam local invoke -t cdk.out/tesseract-lambda-ci.template.json node --no-event > node-test-output.txt && cat node-test-output.txt | grep -Eiv \"(fail|error|exception)\"`,
136+
// },
137+
// ],
138+
// });
138139
project.addTask(`test:integration:python312`, {
139140
steps: [
140141
{
@@ -167,12 +168,13 @@ project.addTask(`test:integration:al2023`, {
167168
});
168169
const testIntegration = project.addTask(`test:integration`, {
169170
steps: [
170-
{
171-
spawn: `test:integration:python`,
172-
},
173-
{
174-
spawn: `test:integration:node`,
175-
},
171+
// AL2 tests disabled (see note about AL2 build issue in continous-integration/main.ts)
172+
// {
173+
// spawn: `test:integration:python`,
174+
// },
175+
// {
176+
// spawn: `test:integration:node`,
177+
// },
176178
{
177179
spawn: `test:integration:al2023`,
178180
},
@@ -183,13 +185,14 @@ const bundle = project.addTask(`bundle:binary`, {
183185
{
184186
spawn: `synth:silent`,
185187
},
186-
// AL2 bundling
187-
{
188-
exec: `rm -rf ./ready-to-use/amazonlinux-2/*`,
189-
},
190-
{
191-
exec: `cp -r cdk.out/$(cat cdk.out/tesseract-lambda-ci.template.json | jq -r '.Resources.al2layer.Metadata.\"aws:asset:path\"')/. ./ready-to-use/amazonlinux-2`,
192-
},
188+
// AL2 bundling disabled (see note about AL2 build issue in continous-integration/main.ts)
189+
// AL2 users can build locally with older Tesseract if needed
190+
// {
191+
// exec: `rm -rf ./ready-to-use/amazonlinux-2/*`,
192+
// },
193+
// {
194+
// exec: `cp -r cdk.out/$(cat cdk.out/tesseract-lambda-ci.template.json | jq -r '.Resources.al2layer.Metadata.\"aws:asset:path\"')/. ./ready-to-use/amazonlinux-2`,
195+
// },
193196
// AL2023 bundling
194197
{
195198
exec: `mkdir -p ./ready-to-use/amazonlinux-2023`,
@@ -205,7 +208,8 @@ const bundle = project.addTask(`bundle:binary`, {
205208
project.packageTask.prependSpawn(testIntegration);
206209
project.packageTask.prependSpawn(bundle);
207210
project.packageTask.prependExec(`mkdir -p ./dist`);
208-
project.packageTask.exec(`zip -r ../../dist/tesseract-al2-x86.zip .`, { cwd: './ready-to-use/amazonlinux-2' });
211+
// AL2 packaging disabled (see note about AL2 build issue in continous-integration/main.ts)
212+
// project.packageTask.exec(`zip -r ../../dist/tesseract-al2-x86.zip .`, { cwd: './ready-to-use/amazonlinux-2' });
209213
project.packageTask.exec(`zip -r ../../dist/tesseract-al2023-x86.zip .`, { cwd: './ready-to-use/amazonlinux-2023' });
210214
project.addTask('upgrade:ci:py', {
211215
steps: [
@@ -254,7 +258,7 @@ project.release?.addJobs({
254258
GITHUB_REPOSITORY: '${{ github.repository }}',
255259
GITHUB_REF: '${{ github.ref }}',
256260
},
257-
run: 'errout=$(mktemp); gh release upload $(cat dist/releasetag.txt) --clobber -R $GITHUB_REPOSITORY dist/tesseract-al2-x86.zip dist/tesseract-al2023-x86.zip 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q "Release.tag_name already exists" $errout; then cat $errout; exit $exitcode; fi',
261+
run: 'errout=$(mktemp); gh release upload $(cat dist/releasetag.txt) --clobber -R $GITHUB_REPOSITORY dist/tesseract-al2023-x86.zip 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q "Release.tag_name already exists" $errout; then cat $errout; exit $exitcode; fi',
258262
},
259263
],
260264
},

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Tesseract OCR Lambda Layer
1515
> :warning: **DEPRECATION NOTICE**:
1616
> - **Amazon Linux 1 (AL1)**: Removed. No longer supported.
1717
> - **Amazon Linux 2 (AL2)**: **Deprecated**. Will be removed after 6 months. New projects should use Amazon Linux 2023 (AL2023).
18+
> - **Note**: AL2 with Tesseract 5.5+ is not supported in CI due to GCC 7.3.1 lacking C++17 filesystem support. Users can build locally with Tesseract 5.4.x or earlier if AL2 is required.
1819
> - **Recommended**: Use Amazon Linux 2023 (AL2023) for all new projects.
1920
2021
<!-- TOC -->

continous-integration/main.ts

Lines changed: 59 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,22 @@ const stack = new Stack(app, 'tesseract-lambda-ci');
99
const pathToLayerSource = path.resolve(__dirname, '..');
1010
/**
1111
* Test setup and artifacts for AL 2
12+
*
13+
* NOTE: AL2 build temporarily disabled due to GCC 7.3.1 lacking <filesystem> header.
14+
* Tesseract 5.5.2 requires GCC 8+ for C++17 filesystem support.
15+
* AL2 is deprecated (6-month sunset) - use AL2023 instead.
16+
* Users can build AL2 locally with older Tesseract versions if needed.
1217
*/
13-
const al2Layer = new lambda.LayerVersion(stack, 'al2-layer', {
14-
code: Code.fromAsset(pathToLayerSource, {
15-
bundling: {
16-
image: DockerImage.fromBuild(pathToLayerSource, { file: 'Dockerfile.al2' }),
17-
command: ['/bin/bash', '-c', 'cp -r /opt/build-dist/. /asset-output/'],
18-
},
19-
}),
20-
description: 'AL2 Tesseract Layer',
21-
});
22-
stack.renameLogicalId(stack.getLogicalId(al2Layer.node.defaultChild as CfnLayerVersion), 'al2layer');
18+
// const al2Layer = new lambda.LayerVersion(stack, 'al2-layer', {
19+
// code: Code.fromAsset(pathToLayerSource, {
20+
// bundling: {
21+
// image: DockerImage.fromBuild(pathToLayerSource, { file: 'Dockerfile.al2' }),
22+
// command: ['/bin/bash', '-c', 'cp -r /opt/build-dist/. /asset-output/'],
23+
// },
24+
// }),
25+
// description: 'AL2 Tesseract Layer',
26+
// });
27+
// stack.renameLogicalId(stack.getLogicalId(al2Layer.node.defaultChild as CfnLayerVersion), 'al2layer');
2328

2429
/**
2530
* Test setup and artifacts for AL2023
@@ -35,50 +40,51 @@ const al2023Layer = new lambda.LayerVersion(stack, 'al2023-layer', {
3540
});
3641
stack.renameLogicalId(stack.getLogicalId(al2023Layer.node.defaultChild as CfnLayerVersion), 'al2023layer');
3742

38-
new lambda.Function(stack, 'python', {
39-
code: lambda.Code.fromAsset(path.resolve(__dirname, 'lambda-handlers/python'), {
40-
bundling: {
41-
image: DockerImage.fromRegistry('public.ecr.aws/sam/build-python3.10:latest'),
42-
command: [
43-
'/bin/bash',
44-
'-c',
45-
['pip install -r requirements.txt -t /asset-output/', 'cp faust.png /asset-output', 'cp handler.py /asset-output'].join(' && '),
46-
],
47-
},
48-
}),
49-
runtime: Runtime.PYTHON_3_10,
50-
layers: [al2Layer],
51-
functionName: `python`,
52-
memorySize: 512,
53-
timeout: Duration.seconds(30),
54-
handler: 'handler.main',
55-
});
56-
57-
new nodelambda.NodejsFunction(stack, 'node', {
58-
bundling: {
59-
nodeModules: ['tesseractocr'],
60-
commandHooks: {
61-
beforeInstall() {
62-
return [];
63-
},
64-
beforeBundling(inputDir: string, outputDir: string): string[] {
65-
return [`cp ${inputDir}/faust.png ${outputDir}`];
66-
},
67-
afterBundling(): string[] {
68-
return [];
69-
},
70-
},
71-
},
72-
depsLockFilePath: path.resolve(__dirname, 'lambda-handlers/node/yarn.lock'),
43+
// AL2-based test functions temporarily disabled (see note above about AL2 build issue)
44+
// new lambda.Function(stack, 'python', {
45+
// code: lambda.Code.fromAsset(path.resolve(__dirname, 'lambda-handlers/python'), {
46+
// bundling: {
47+
// image: DockerImage.fromRegistry('public.ecr.aws/sam/build-python3.10:latest'),
48+
// command: [
49+
// '/bin/bash',
50+
// '-c',
51+
// ['pip install -r requirements.txt -t /asset-output/', 'cp faust.png /asset-output', 'cp handler.py /asset-output'].join(' && '),
52+
// ],
53+
// },
54+
// }),
55+
// runtime: Runtime.PYTHON_3_10,
56+
// layers: [al2Layer],
57+
// functionName: `python`,
58+
// memorySize: 512,
59+
// timeout: Duration.seconds(30),
60+
// handler: 'handler.main',
61+
// });
7362

74-
runtime: Runtime.NODEJS_18_X,
75-
entry: path.resolve(__dirname, 'lambda-handlers/node/index.js'),
76-
layers: [al2Layer],
77-
functionName: `node`,
78-
memorySize: 512,
79-
timeout: Duration.seconds(30),
80-
handler: 'handler',
81-
});
63+
// new nodelambda.NodejsFunction(stack, 'node', {
64+
// bundling: {
65+
// nodeModules: ['tesseractocr'],
66+
// commandHooks: {
67+
// beforeInstall() {
68+
// return [];
69+
// },
70+
// beforeBundling(inputDir: string, outputDir: string): string[] {
71+
// return [`cp ${inputDir}/faust.png ${outputDir}`];
72+
// },
73+
// afterBundling(): string[] {
74+
// return [];
75+
// },
76+
// },
77+
// },
78+
// depsLockFilePath: path.resolve(__dirname, 'lambda-handlers/node/yarn.lock'),
79+
//
80+
// runtime: Runtime.NODEJS_18_X,
81+
// entry: path.resolve(__dirname, 'lambda-handlers/node/index.js'),
82+
// layers: [al2Layer],
83+
// functionName: `node`,
84+
// memorySize: 512,
85+
// timeout: Duration.seconds(30),
86+
// handler: 'handler',
87+
// });
8288

8389
new lambda.Function(stack, 'python312', {
8490
code: lambda.Code.fromAsset(path.resolve(__dirname, 'lambda-handlers/python'), {

package.json

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)