Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imp: allow cgo while disabling libwasmvm linking #527

Merged
merged 6 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
20 changes: 20 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,25 @@ jobs:
- run:
name: Test package "cosmwasm" without cgo
command: CGO_ENABLED=0 go test .

# Build types and cosmwasm with libwasmvm linking disabled
nolink_libwasmvm:
docker:
- image: cimg/go:1.21.4
steps:
- checkout
- run:
name: Build package "types" without cgo
command: go build -tags "nolink_libwasmvm" ./types
- run:
name: Build package "cosmwasm" without cgo
command: go build -tags "nolink_libwasmvm" .
- run:
name: Test package "types" without cgo
damiannolan marked this conversation as resolved.
Show resolved Hide resolved
command: go test -tags "nolink_libwasmvm" ./types
- run:
name: Test package "cosmwasm" with libwasmvm linking disabled
command: go test -tags "nolink_libwasmvm" .

tidy-go:
docker:
Expand Down Expand Up @@ -433,6 +452,7 @@ workflows:
- libwasmvm_audit
- format-go
- wasmvm_no_cgo
- nolink_libwasmvm
- tidy-go
- format-scripts
- lint-scripts
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ go build .
CGO_ENABLED=0 go build .
```

In the case that it may be desirable to compile with cgo, but with libwasmvm linking disabled an additional build tag is available.

```sh
# Build with CGO, but with libwasmvm linking disabled
go build -tags "nolink_libwasmvm"
```

## Supported Platforms

See [COMPILER_VERSIONS.md](docs/COMPILER_VERSIONS.md) for information on Go and
Expand Down
2 changes: 1 addition & 1 deletion ibc_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build cgo
//go:build cgo && !nolink_libwasmvm

package cosmwasm

Expand Down
2 changes: 1 addition & 1 deletion lib.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build cgo
//go:build cgo && !nolink_libwasmvm

// This file contains the part of the API that is exposed when cgo is enabled.

Expand Down
2 changes: 1 addition & 1 deletion lib_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build cgo
//go:build cgo && !nolink_libwasmvm

package cosmwasm

Expand Down
2 changes: 1 addition & 1 deletion version_cgo.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build cgo
//go:build cgo && !nolink_libwasmvm

package cosmwasm

Expand Down
2 changes: 1 addition & 1 deletion version_no_cgo.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !cgo
//go:build !cgo || nolink_libwasmvm

package cosmwasm

Expand Down
Loading