cppagent: `v2.2.0.3`: ERROR: /root/agent/conanfile.py: option 'build_tests' doesn't exist
I wanted to build a Docker image for v2.2.0.3
with the same instructions I used to build an image for v2.1.0.6
, however, the build fails with the following error:
# docker buildx build --no-cache \
# -f "$repo_path/Dockerfile" \
# --platform linux/amd64,linux/arm64 \
# -t ladder99/agent:v2.2.0.3 \
# -t ladder99/agent:latest \
# "$repo_path"
0.982 ************************* WARNING: GCC OLD ABI COMPATIBILITY ***********************
0.982
0.982 Conan detected a GCC version > 5 but has adjusted the 'compiler.libcxx' setting to
0.982 'libstdc++' for backwards compatibility.
0.982 Your compiler is likely using the new CXX11 ABI by default (libstdc++11).
0.982
0.982 If you want Conan to use the new ABI for the default profile, run:
0.982
0.982 $ conan profile update settings.compiler.libcxx=libstdc++11 default
0.982
0.982 Or edit '/root/.conan/profiles/default' and set compiler.libcxx=libstdc++11
0.982
0.982 ************************************************************************************
0.982
0.982
0.982
0.982 Default settings
0.982 os=Linux
0.982 os_build=Linux
0.982 arch=x86_64
0.982 arch_build=x86_64
0.982 compiler=gcc
0.982 compiler.version=11
0.982 compiler.libcxx=libstdc++
0.982 build_type=Release
0.982 *** You can change them in /root/.conan/profiles/default ***
0.982 *** Or override with -s compiler='other' -s ...s***
0.982
0.982
1.036 Configuration:
1.036 [settings]
1.036 arch=x86_64
1.036 arch_build=x86_64
1.036 build_type=Release
1.036 compiler=gcc
1.036 compiler.libcxx=libstdc++11
1.036 compiler.version=11
1.036 os=Linux
1.036 os_build=Linux
1.036 [options]
1.036 build_tests=False
1.036 run_tests=False
1.036 with_ruby=True
1.036 without_ipv6=True
1.036 [build_requires]
1.036 [env]
1.036
1.038 ERROR: /root/agent/conanfile.py: option 'build_tests' doesn't exist
1.038 Possible options are ['without_ipv6', 'with_ruby', 'development', 'shared', 'winver', 'with_docs', 'cpack', 'agent_prefix', 'fPIC']
------
Dockerfile:64
--------------------
63 | # make installer
64 | >>> RUN conan export conan/mqtt_cpp \
65 | >>> && conan export conan/mruby \
66 | >>> && conan install . -if build --build=missing \
67 | >>> -pr $CONAN_PROFILE \
68 | >>> -o build_tests=$WITH_TESTS \
69 | >>> -o run_tests=$WITH_TESTS \
70 | >>> -o with_ruby=$WITH_RUBY
71 |
--------------------
ERROR: failed to solve: process "/bin/sh -c conan export conan/mqtt_cpp && conan export conan/mruby && conan install . -if build --build=missing -pr $CONAN_PROFILE -o build_tests=$WITH_TESTS -o run_tests=$WITH_TESTS -o with_ruby=$WITH_RUBY" did not complete successfully: exit code: 1
Now, the issue seems to stem from the changes (see esp changes on these lines) in conanfile.py
between v2.1.0.6
and v2.2.0.3
, as there is no such command (or how do you call it) as build_tests
(it seems to be removed). If build_tests
option should be removed, then the Dockerfile
and Dockerfile.alpine
files should be updated accordingly:
Dockerfile
:- remove line 56 and lines 68-69;
Dockerfile.alpine
:- remove line 62 and lines 75-76.
I have tried to build AMD64 and ARM64 multiarch image using Dockerfile
(but not using Dockerfile.alpine
) with the changes listed above, however, the build fails with TypeError: ConanFile.run() got an unexpected keyword argument 'stdout'
in conan/mruby/conanfile.py
(L187). FYI, ubuntu:22.04
currently installs the following ruby
version: ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux-gnu]
.
Build error after removing the lines
# docker buildx build --no-cache \
# -f "$repo_path/Dockerfile" \
# --platform linux/amd64,linux/arm64 \
# -t ladder99/agent:v2.2.0.3 \
# -t ladder99/agent:latest \
# "$repo_path"
545.6 Build summary:
545.6
545.6 ================================================
545.6 Config Name: host
545.6 Output Directory: ../build-release/host
545.6 Binaries: mruby-config, mrbc
545.6 Included Gems:
545.6 mruby-array-ext - Array class extension
545.6 mruby-bigint - Integer class extension to multiple-precision
545.6 mruby-bin-config - mruby-config command
545.6 mruby-bin-mrbc - mruby compiler executable
545.6 mruby-bin-mruby - mruby command
545.6 - Binaries: mruby
545.6 mruby-bin-strip - irep dump debug section remover command
545.6 - Binaries: mruby-strip
545.6 mruby-binding - Binding class
545.6 mruby-binding-core - Binding class (core features only)
545.6 mruby-catch - Catch / Throw non-local Jump
545.6 mruby-class-ext - class/module extension
545.6 mruby-cmath - standard Math module with complex
545.6 mruby-compar-ext - Comparable module extension
545.6 mruby-compiler - mruby compiler library
545.6 mruby-complex - Complex class
545.6 mruby-data - standard Data class
545.6 mruby-dir
545.6 mruby-enum-chain - Enumerator::Chain class
545.6 mruby-enum-ext - Enumerable module extension
545.6 mruby-enum-lazy - Enumerator::Lazy class
545.6 mruby-enumerator - Enumerator class
545.6 mruby-errno - Errno module and SystemCallError class
545.6 mruby-error - extensional error handling
545.6 mruby-eval - standard Kernel#eval method
545.6 mruby-exit - Kernel#exit method
545.6 mruby-fiber - Fiber class
545.6 mruby-hash-ext - Hash class extension
545.6 mruby-io - IO and File class
545.6 mruby-kernel-ext - extensional function-like methods
545.6 mruby-math - standard Math module
545.6 mruby-metaprog - Meta-programming features for mruby
545.6 mruby-method - Method and UnboundMethod class
545.6 mruby-numeric-ext - Numeric class extension
545.6 mruby-object-ext - extensional methods shared by all objects
545.6 mruby-objectspace - ObjectSpace class
545.6 mruby-onig-regexp
545.6 mruby-os-memsize - ObjectSpace memsize_of method
545.6 mruby-pack - Array#pack and String#unpack method
545.6 mruby-print - standard print/puts/p
545.6 mruby-proc-binding - Proc#binding method
545.6 mruby-proc-ext - Proc class extension
545.6 mruby-random - Random class
545.6 mruby-range-ext - Range class extension
545.6 mruby-rational - Rational class
545.6 mruby-require
545.6 mruby-set
545.6 mruby-sleep - Kernel#sleep and Kernel#usleep
545.6 mruby-socket - standard socket class
545.6 mruby-sprintf - standard Kernel#sprintf method
545.6 mruby-string-ext - String class extension
545.6 mruby-struct - standard Struct class
545.6 mruby-symbol-ext - Symbol class extension
545.6 mruby-test-inline-struct - inline structure
545.6 mruby-time - standard Time class
545.6 mruby-toplevel-ext - toplevel object (main) methods extension
545.6 ================================================
545.6
545.6 ================================================
545.6 Config Name: host/mrbc
545.6 Output Directory: ../build-release/host/mrbc
545.6 Binaries: mrbc
545.6 Included Gems:
545.6 mruby-bin-mrbc - mruby compiler executable
545.6 mruby-compiler - mruby compiler library
545.6 ================================================
545.6
545.6 mruby/3.2.0: Package 'f78302de80edd0f6a872b1440636d3069d3a5347' built
545.6 mruby/3.2.0: Build folder /root/.conan/data/mruby/3.2.0/_/_/build/f78302de80edd0f6a872b1440636d3069d3a5347/build-release
545.6 mruby/3.2.0: Generated conaninfo.txt
545.6 mruby/3.2.0: Generated conanbuildinfo.txt
545.6 mruby/3.2.0: Generating the package
545.6 mruby/3.2.0: Package folder /root/.conan/data/mruby/3.2.0/_/_/package/f78302de80edd0f6a872b1440636d3069d3a5347
545.6 mruby/3.2.0: Calling package()
545.7 mruby/3.2.0: Copied 4 files: mruby, mrbc, mruby-strip, mruby-config
545.7 mruby/3.2.0: Copied 2 '.a' files: libmruby.a, libmruby_core.a
545.7 mruby/3.2.0: Copied 1 '.mak' file: libmruby.flags.mak
545.7 mruby/3.2.0: Copied 2 '.h' files: table.h, id.h
545.7 mruby/3.2.0: Copied 36 '.h' files
545.7 mruby/3.2.0: Copied 11 '.h' files
545.8 mruby/3.2.0 package(): Packaged 2 '.a' files: libmruby.a, libmruby_core.a
545.8 mruby/3.2.0 package(): Packaged 1 '.mak' file: libmruby.flags.mak
545.8 mruby/3.2.0 package(): Packaged 4 files: mruby, mrbc, mruby-strip, mruby-config
545.8 mruby/3.2.0 package(): Packaged 49 '.h' files
545.8 mruby/3.2.0: Package 'f78302de80edd0f6a872b1440636d3069d3a5347' created
545.8 mruby/3.2.0: Created package revision 5e1ebc1caeaf88a5999859f118b63a78
545.8 ERROR: mruby/3.2.0: Error in package_info() method, line 187
545.8 self.run("{} --cflags".format(ruby), stdout=buf, shell=True)
545.8 TypeError: ConanFile.run() got an unexpected keyword argument 'stdout'
------
WARNING: No output specified with docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
Dockerfile:63
--------------------
62 | # make installer
63 | >>> RUN conan export conan/mqtt_cpp \
64 | >>> && conan export conan/mruby \
65 | >>> && conan install . -if build --build=missing \
66 | >>> -pr $CONAN_PROFILE \
67 | >>> -o with_ruby=$WITH_RUBY
68 |
--------------------
ERROR: failed to solve: process "/bin/sh -c conan export conan/mqtt_cpp && conan export conan/mruby && conan install . -if build --build=missing -pr $CONAN_PROFILE -o with_ruby=$WITH_RUBY" did not complete successfully: exit code: 1
I have found a similar conan
issue (conan-io/conan#5670), although that is about win_bash=True
instead of shell=True
, however, removing shell=True
didn’t help to work around the issue. Then I tried to change the line to self.run("{} --cflags".format(ruby), output=buf)
(based on the line version from v2.1.0.6
), but that failed too (self.run("{} --cflags".format(ruby), shell=True)
also failed). It fails in cppagent/conanfile.py
(L157) with ConanException: CMakePresets.json was not found in /root/agent/build/build/Release/generators folder. Check that you are using CMakeToolchain as generator to ensure its correct initialization.
.
Build error after removing the lines and changing a line in conan/mruby/conanfile.py
# docker buildx build \
# -f "$repo_path/Dockerfile" \
# --platform linux/amd64,linux/arm64 \
# -t ladder99/agent:v2.2.0.3 \
# -t ladder99/agent:latest \
# "$repo_path"
1.658 conanfile.py (mtconnect_agent/2.2): Calling build()
1.658 ERROR: conanfile.py (mtconnect_agent/2.2): Error in build() method, line 157
1.658 cmake = CMake(self)
1.658 ConanException: CMakePresets.json was not found in /root/agent/build/build/Release/generators folder. Check that you are using CMakeToolchain as generator to ensure its correct initialization.
------
WARNING: No output specified with docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
Dockerfile:70
--------------------
68 |
69 | # compile source (~20mins - 4hrs for qemu)
70 | >>> RUN conan build . -bf build
71 |
72 | # ---------------------------------------------------------------------
--------------------
ERROR: failed to solve: process "/bin/sh -c conan build . -bf build" did not complete successfully: exit code: 1
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 19 (9 by maintainers)
Sounds good. We can move this work to your branch since the current branch I was working on was originally for CI/CD
Just completed a new version of the Dockerfile for ubuntu. It now works. Also using the demo scripts. Still need to get the twin demo working through docker. The rest works perfectly.
I tested the ARM build and is running fine.
MTConnect Agent Version 2.2.0.2 (_RC5) - built on Wed Aug 2 16:15:24 2023
@wsobel, I think I have fixed
Dockerfile
; at least it builds successfully a multiarch image, I am able to create a container and openlocalhost:5000
(I haven’t tested it with real machine, only the built-in simulator which does not reason generate any data, just waits for data on port7878
).Now, I’d like to review my changes and tell me if you’d like me to change anything (configuration-wise). Tell me your opinion. Then I could open a PR with the changes—or do you want to do it yourself? 🤔
Anyway, building the multiarch image on my mobile workstation laptop with 12-core CPU and 46 GB RAM took
1h 51m
(withCONAN_CPU_COUNT=10
). WithCONAN_CPU_COUNT=2
, building the image took me2h 1m
.Dockerfile
diffEntire
Dockerfile
And here’s the script using which I have built the image (OFC, I didn’t push the image anywhere, therefore I have actually used
docker_build_options='--no-cache --load'
). It could serve as the basis for building the images via GitLab CI.MTConnect Agent build script
Update
At the request of @MRIIOT, I have push the image built from
Dockerfile
toladder99/agent
at Docker Hub.I have not worked on the docker build file yet. I was working on the GitHub workflow to transition to actions. This was next once I resolved all the CI/CD issues.
We should also do the CD directly to docker hub once we have everything working.
Best, W