Skip to content

Commit

Permalink
Patch solc to support boost 1.69
Browse files Browse the repository at this point in the history
Patches taken from upstream:

ethereum/solidity#4772
ethereum/solidity#5223
ethereum/solidity#5226

It also requires a change to the arguments for the unit tests, since
boost changed how the options are parsed.

Update oldNixpkgs to the latest working version.

This revision has a `flake.nix` file so it no longer needs the input
config to specify `flake = false;`.

It also prints a warning about deprecated `stdenv.lib`.
  • Loading branch information
resonant-riches committed Feb 21, 2024
1 parent 8bdcee8 commit 2b12f77
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 8 deletions.
9 changes: 4 additions & 5 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

# Old revision of nixos-unstable to get a specific version (0.4.24)
# of the Solidity compiler, required for building azimuth-solidity.
inputs.oldNixpkgs.url = "nixpkgs/d688c7cd05b155e223e478b6e6bda97737d1441b";
inputs.oldNixpkgs.flake = false; # The revision is so old that the repo does not contain a flake.nix
inputs.oldNixpkgs.url = "nixpkgs/51d9ad94384f21ecfa17bd9e0b01dfef3d416ab1";

# The old revision of nixpkgs needed for solc is broken on many other systems
inputs.systems.url = "github:nix-systems/x86_64-linux";
Expand Down
3 changes: 2 additions & 1 deletion solc_0_4_24/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ stdenv.mkDerivation {
patches = [
./patches/shared-libs-install.patch
./patches/gcc8.patch
./patches/boost169.patch
];

postPatch = ''
Expand All @@ -44,7 +45,7 @@ stdenv.mkDerivation {

doCheck = stdenv.hostPlatform.isLinux && stdenv.hostPlatform == stdenv.buildPlatform;
checkPhase = "LD_LIBRARY_PATH=./libsolc:./libsolidity:./liblll:./libevmasm:./libdevcore:$LD_LIBRARY_PATH " +
"./test/soltest -p -- --no-ipc --no-smt --testpath ../test";
"./test/soltest --show-progress=true -- --no-ipc --no-smt --testpath ../test";

nativeBuildInputs = [ cmake ];
buildInputs = [ boost z3 ];
Expand Down
69 changes: 69 additions & 0 deletions solc_0_4_24/patches/boost169.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
commit d3c3fd20796dd18b7213938bd0ce89e8aeb9d6f3
Author: Alex Beregszaszi <[email protected]>
Date: Wed Aug 8 20:46:28 2018 +0100

Use dev::toString() in Assembly instead of misusing string{} for u256

diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp
index b71bc80cb..28ae95777 100644
--- a/libevmasm/Assembly.cpp
+++ b/libevmasm/Assembly.cpp
@@ -264,7 +264,7 @@ Json::Value Assembly::assemblyJSON(StringMap const& _sourceCodes) const
createJsonValue("PUSH [ErrorTag]", i.location().start, i.location().end, ""));
else
collection.append(
- createJsonValue("PUSH [tag]", i.location().start, i.location().end, string(i.data())));
+ createJsonValue("PUSH [tag]", i.location().start, i.location().end, dev::toString(i.data())));
break;
case PushSub:
collection.append(
@@ -290,7 +290,7 @@ Json::Value Assembly::assemblyJSON(StringMap const& _sourceCodes) const
break;
case Tag:
collection.append(
- createJsonValue("tag", i.location().start, i.location().end, string(i.data())));
+ createJsonValue("tag", i.location().start, i.location().end, dev::toString(i.data())));
collection.append(
createJsonValue("JUMPDEST", i.location().start, i.location().end));
break;

commit 55d91d5f9cdc176c771b6038948d5dacba383e34
Author: Bhargava Shastry <[email protected]>
Date: Mon Oct 15 17:14:22 2018 +0200

Bug fix: Add missing include in test/Options.h; otherwise compiler does not recognise the boost object that Options subclasses

diff --git a/test/Options.h b/test/Options.h
index 9bc698762..cbaa0dd1a 100644
--- a/test/Options.h
+++ b/test/Options.h
@@ -24,7 +24,7 @@
#include <boost/test/unit_test.hpp>
#include <boost/filesystem.hpp>
#include <boost/version.hpp>
-
+#include <boost/core/noncopyable.hpp>
#include <functional>

namespace dev

commit 3d4e5f30e1696bee8482058b5ec4adb51f9f1387
Author: chriseth <[email protected]>
Date: Mon Oct 15 18:08:41 2018 +0200

Correct include path

diff --git a/test/Options.h b/test/Options.h
index cbaa0dd1a..0e8a51dad 100644
--- a/test/Options.h
+++ b/test/Options.h
@@ -24,7 +24,8 @@
#include <boost/test/unit_test.hpp>
#include <boost/filesystem.hpp>
#include <boost/version.hpp>
-#include <boost/core/noncopyable.hpp>
+#include <boost/noncopyable.hpp>
+
#include <functional>

namespace dev

0 comments on commit 2b12f77

Please sign in to comment.