Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions cosmwasm-optimizer/1539cd8-1.93.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/Dockerfile b/Dockerfile
index b78751a..f0acf5f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM rust:1.86.0-alpine AS targetarch
+FROM rust:1.93.1-alpine AS targetarch

ARG BUILDPLATFORM
ARG TARGETPLATFORM
@@ -31,7 +31,7 @@ RUN apk update && apk add build-base cmake git python3 clang ninja
RUN tar -xf /tmp/binaryen.tar.gz
RUN cd binaryen-version_*/ \
&& git clone --depth 1 https://github.com/google/googletest.git ./third_party/googletest \
- && cmake . -G Ninja -DCMAKE_CXX_FLAGS="-static" -DCMAKE_C_FLAGS="-static" -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC_LIB=ON \
+ && cmake . -G Ninja -DCMAKE_CXX_FLAGS="-static -Wno-error=maybe-uninitialized" -DCMAKE_C_FLAGS="-static" -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC_LIB=ON \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for:

-Wno-error=maybe-uninitialized

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build was failing with this error:

34.85 ninja: job failed: /usr/bin/c++  -I/binaryen-version_116/src -I/binaryen-version_116/third_party/llvm-project/include -I/binaryen-version_116 -static -DBUILD_LLVM_DWARF -Wall -Werro
r -Wextra -Wno-unused-parameter -fno-omit-frame-pointer -fno-rtti -Wno-implicit-int-float-conversion -Wno-unknown-warning-option -Wswitch -Wimplicit-fallthrough -Wnon-virtual-dtor -fPIC -
fdiagnostics-color=always -O3 -DNDEBUG -UNDEBUG -std=c++17 -MD -MT src/passes/CMakeFiles/passes.dir/Strip.cpp.o -MF src/passes/CMakeFiles/passes.dir/Strip.cpp.o.d -o src/passes/CMakeFiles
/passes.dir/Strip.cpp.o -c /binaryen-version_116/src/passes/Strip.cpp                                                                                                                      
34.85 In file included from /usr/include/c++/15.2.0/functional:61,                                                                                                                         
34.85                  from /binaryen-version_116/src/passes/Strip.cpp:22:                                                                                                                 
34.85 In copy constructor 'std::function<_Res(_ArgTypes ...)>::function(const std::function<_Res(_ArgTypes ...)>&) [with _Res = bool; _ArgTypes = {wasm::CustomSection&}]',                
34.85     inlined from 'wasm::Strip::Strip(Decider)' at /binaryen-version_116/src/passes/Strip.cpp:37:28,                                                                                  
34.85     inlined from 'wasm::Pass* wasm::createStripDebugPass()' at /binaryen-version_116/src/passes/Strip.cpp:62:4:                                                                      
34.85 /usr/include/c++/15.2.0/bits/std_function.h:393:17: error: '<anonymous>' may be used uninitialized [-Werror=maybe-uninitialized]                                                     
34.85   393 |             __x._M_manager(_M_functor, __x._M_functor, __clone_functor);                                                                                                     
34.85       |             ~~~~^~~~~~~~~~                                                                                                                                                   
34.85 /usr/include/c++/15.2.0/bits/std_function.h: In function 'wasm::Pass* wasm::createStripDebugPass()':                                                                                 
34.85 /usr/include/c++/15.2.0/bits/std_function.h:269:7: note: by argument 2 of type 'const std::_Any_data&' to 'static bool std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_mana
ger(std::_Any_data&, const std::_Any_data&, std::_Manager_operation) [with _Res = bool; _Functor = wasm::createStripDebugPass()::<lambda(const wasm::CustomSection&)>; _ArgTypes = {wasm::C
ustomSection&}]' declared here                                                                                                                                                             
34.85   269 |       _M_manager(_Any_data& __dest, const _Any_data& __source,                                                                                                               
34.85       |       ^~~~~~~~~~                                                                                                                                                             
34.85 /binaryen-version_116/src/passes/Strip.cpp:58:20: note: '<anonymous>' declared here                                                                                                  
34.85    58 |   return new Strip([&](const CustomSection& curr) {                                                                                                                          
34.85       |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                          
34.85    59 |     return curr.name == BinaryConsts::CustomSections::Name ||                                                                                                                
34.85       |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                
34.85    60 |            curr.name == BinaryConsts::CustomSections::SourceMapUrl ||                                                                                                        
34.85       |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                        
34.85    61 |            curr.name.find(".debug") == 0 || curr.name.find("reloc..debug") == 0;                                                                                             
34.85       |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                             
34.85    62 |   });                                                                                                                                                                        
34.85       |   ~    

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It suppresses a warning that is treated like an error by compiler flags. I did not want to go deeper into fixing the code I'm not familiar with. I'm also not feeling great about ignoring a compiler warning, but since its not our product, as long as it works - should be ok, I think?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, I believe we will know once we run the tests against kolme. :-)

&& ninja wasm-opt

# Run tests
@@ -74,7 +74,7 @@ RUN cd bob_the_builder && \
#
# rust-optimizer target
#
-FROM rust:1.86.0-alpine AS rust-optimizer
+FROM rust:1.93.1-alpine AS rust-optimizer

# Download the crates.io index using the new sparse protocol to improve performance
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
7 changes: 5 additions & 2 deletions cosmwasm-optimizer/build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ IMAGE_NAME=ghcr.io/fpco/cosmos-images/cosmwasm-optimizer:"$GIT_SHA"
WORK_DIR=$(mktemp -d -p /tmp)

git clone https://github.com/CosmWasm/optimizer "$WORK_DIR"

patch_path="$(realpath 1539cd8-1.93.1.patch)"
cd "$WORK_DIR"
git checkout 4dedb39736d34f27cd799f222a30a4f1b230fb12 # v0.16.1
git checkout 1539cd865630d618df5246c35064078552194560 # v0.17.0

git apply "${patch_path}"

sed -i 's/1\.81/1.84/g' Dockerfile
docker build -t "$IMAGE_NAME" .