or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

exceptions.mdindex.mdinstallation.mdlegacy-compilation.mdstandard-json-compilation.md

installation.mddocs/

0

# Solc Installation

1

2

Experimental functionality for installing specific versions of the solc compiler binary across different platforms. This feature allows you to manage multiple solc versions and ensures consistent compilation environments.

3

4

## Capabilities

5

6

### Install Solc Binary

7

8

Installs a specified version of the solc compiler binary for the current or specified platform.

9

10

```python { .api }

11

def install_solc(identifier, platform=None):

12

"""

13

Install specified version of solc compiler.

14

15

Args:

16

identifier (str): Version identifier (e.g., 'v0.4.24', 'v0.4.1')

17

platform (str): Target platform ('linux', 'darwin', 'win32').

18

If None, auto-detected from current system

19

20

Returns:

21

None: Installation is performed, binary installed to ~/.py-solc/

22

23

Raises:

24

ValueError: When identifier or platform is invalid

25

OSError: When installation fails due to system issues

26

27

Note:

28

This is experimental functionality. Installed binary location:

29

$HOME/.py-solc/solc-{version}/bin/solc

30

31

For older Linux installs, may require setting:

32

LD_LIBRARY_PATH=$HOME/.py-solc/solc-{version}/bin

33

"""

34

```

35

36

## Supported Versions and Platforms

37

38

### Version Constants

39

40

```python { .api }

41

# Available version identifiers

42

V0_4_1 = 'v0.4.1'

43

V0_4_2 = 'v0.4.2'

44

V0_4_6 = 'v0.4.6'

45

V0_4_7 = 'v0.4.7'

46

V0_4_8 = 'v0.4.8'

47

V0_4_9 = 'v0.4.9'

48

V0_4_11 = 'v0.4.11'

49

V0_4_12 = 'v0.4.12'

50

V0_4_13 = 'v0.4.13'

51

V0_4_14 = 'v0.4.14'

52

V0_4_15 = 'v0.4.15'

53

V0_4_16 = 'v0.4.16'

54

V0_4_17 = 'v0.4.17'

55

V0_4_18 = 'v0.4.18'

56

V0_4_19 = 'v0.4.19'

57

V0_4_20 = 'v0.4.20'

58

V0_4_21 = 'v0.4.21'

59

V0_4_22 = 'v0.4.22'

60

V0_4_23 = 'v0.4.23'

61

V0_4_24 = 'v0.4.24'

62

```

63

64

### Platform Constants

65

66

```python { .api }

67

LINUX = 'linux'

68

OSX = 'darwin'

69

WINDOWS = 'win32'

70

```

71

72

### Supported Version/Platform Matrix

73

74

| Version | Linux | macOS (OSX) | Windows |

75

|---------|-------|-------------|---------|

76

| v0.4.1 ||||

77

| v0.4.2 ||||

78

| v0.4.6 ||||

79

| v0.4.7 ||||

80

| v0.4.8 ||||

81

| v0.4.9 ||||

82

| v0.4.11+||||

83

84

Note: Windows support is not available through this installation system.

85

86

## Usage Examples

87

88

### Basic Installation

89

90

```python

91

from solc import install_solc

92

93

# Install latest supported version

94

install_solc('v0.4.24')

95

96

# Install specific version

97

install_solc('v0.4.11')

98

```

99

100

### Install for Specific Platform

101

102

```python

103

from solc import install_solc, LINUX, OSX

104

105

# Install for Linux (useful when cross-compiling)

106

install_solc('v0.4.24', platform=LINUX)

107

108

# Install for macOS

109

install_solc('v0.4.24', platform=OSX)

110

```

111

112

### Using Version Constants

113

114

```python

115

from solc import install_solc, V0_4_24, V0_4_11

116

117

# Using constants for type safety

118

install_solc(V0_4_24)

119

install_solc(V0_4_11)

120

```

121

122

### Command Line Installation

123

124

You can also install solc versions from the command line:

125

126

```bash

127

# Install using Python module

128

python -m solc.install v0.4.24

129

130

# Or using the main module

131

python -m solc.install v0.4.11

132

```

133

134

### Error Handling

135

136

```python

137

from solc import install_solc

138

139

try:

140

install_solc('v0.5.0') # Unsupported version

141

except ValueError as e:

142

print(f"Installation failed: {e}")

143

144

try:

145

install_solc('v0.4.24', platform='unsupported_platform')

146

except ValueError as e:

147

print(f"Unsupported platform: {e}")

148

149

try:

150

install_solc('v0.4.24')

151

except OSError as e:

152

print(f"System error during installation: {e}")

153

```

154

155

## Installation Process

156

157

### Linux Installation Methods

158

159

**Static Binary (v0.4.11+):**

160

- Downloads pre-compiled static binary from GitHub releases

161

- No dependencies required

162

- Fastest installation method

163

164

**Ubuntu Release Package (v0.4.1-v0.4.9):**

165

- Downloads and extracts Ubuntu release zip

166

- May require additional system libraries

167

- Requires `LD_LIBRARY_PATH` environment variable

168

169

### macOS Installation Method

170

171

**Source Compilation:**

172

- Clones Solidity repository from GitHub

173

- Compiles from source using cmake and make

174

- Requires development tools (Xcode Command Line Tools)

175

- Takes longer but ensures compatibility

176

177

## Post-Installation Configuration

178

179

### Binary Location

180

181

Installed binaries are located at:

182

```

183

$HOME/.py-solc/solc-{version}/bin/solc

184

```

185

186

### Environment Variables

187

188

For older Linux installations, you may need to set:

189

```bash

190

export LD_LIBRARY_PATH=$HOME/.py-solc/solc-v0.4.24/bin:$LD_LIBRARY_PATH

191

```

192

193

### Using Installed Binary

194

195

```python

196

import os

197

from solc import compile_source

198

199

# Set environment variable to use specific installed version

200

os.environ['SOLC_BINARY'] = os.path.expanduser('~/.py-solc/solc-v0.4.24/bin/solc')

201

202

# Now compilation will use the installed version

203

result = compile_source(source_code)

204

```

205

206

### Verification

207

208

After installation, verify the binary works:

209

210

```python

211

from solc import get_solc_version_string

212

import os

213

214

# Point to installed binary

215

os.environ['SOLC_BINARY'] = os.path.expanduser('~/.py-solc/solc-v0.4.24/bin/solc')

216

217

# Check version

218

version = get_solc_version_string()

219

print(f"Installed solc version: {version}")

220

```

221

222

## System Requirements

223

224

### Linux Requirements

225

226

- `wget` (for downloading releases)

227

- `git` (for source compilation on older versions)

228

- Basic system libraries (glibc, etc.)

229

230

### macOS Requirements

231

232

- Xcode Command Line Tools (`xcode-select --install`)

233

- `git` (usually included with Command Line Tools)

234

- `cmake` and `make` (for source compilation)

235

236

### Disk Space

237

238

- Static binary installations: ~10-20 MB per version

239

- Source compilations: ~100-200 MB per version (includes source and build artifacts)

240

241

## Troubleshooting

242

243

### Common Issues

244

245

**Permission Denied:**

246

```bash

247

chmod +x ~/.py-solc/solc-v0.4.24/bin/solc

248

```

249

250

**Library Path Issues (Linux):**

251

```bash

252

export LD_LIBRARY_PATH=~/.py-solc/solc-v0.4.24/bin:$LD_LIBRARY_PATH

253

```

254

255

**Missing Dependencies (macOS):**

256

```bash

257

xcode-select --install

258

brew install cmake # if using Homebrew

259

```

260

261

### Manual Verification

262

263

Test installed binary manually:

264

```bash

265

~/.py-solc/solc-v0.4.24/bin/solc --version

266

```

267

268

### Cleanup

269

270

Remove installed versions:

271

```bash

272

rm -rf ~/.py-solc/solc-v0.4.24/

273

```