Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nknorg/nkn-tunnel
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c8841833fad2510400400fe030a2c95d6dc220ab
Choose a base ref
..
head repository: nknorg/nkn-tunnel
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 720ea2030f0ce5c635d2baf4da8911d33e9d9955
Choose a head ref
Showing with 95 additions and 0 deletions.
  1. +95 −0 README.md
95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -106,3 +106,98 @@ git commit -s
- [Telegram](https://t.me/nknorg)
- [Reddit](https://www.reddit.com/r/nknblockchain/)
- [Twitter](https://twitter.com/NKN_ORG)

## Building Dynamic and Static Libraries

```shell
make lib
```

### Build Targets

The `make lib` target builds shared libraries (dynamic libraries) and static libraries for the following platforms:

* macOS: `.dylib` and `.a`
* Windows: `.dll`
* Linux: `.so`
* iOS: `.a`

All generated files are stored in the `build/lib` directory.

### Prerequisites

1. Required Tools
Ensure the following tools are installed on your system:

* go (version >= 1.20)
* clang (for macOS and iOS builds)
* x86_64-w64-mingw32-gcc (for Windows builds)
* x86_64-linux-musl-gcc (for Linux builds)
* lipo (for merging iOS static libraries)

2. Environment Setup

* Ensure make and related tools are in your PATH.
* Set GOPATH and GOROOT environment variables appropriately.

> Builds shared libraries (c-shared) for the following platforms:
* macOS (arm64): .dylib
* Windows (amd64): .dll
* Linux (amd64): .so

> Builds static libraries (c-archive) for the following platforms:
* iOS (arm64 and amd64): .a

### Generated File Structure

After a successful build, the output files are organized as follows:

```
build/lib/
├── darwin-arm64/
│ ├── libnkntunnel.dylib
│ └── libnkntunnel.h
├── ios/
│ ├── libnkntunnel.a
│ └── libnkntunnel.h
├── ios-arm64/
│ ├── libnkntunnel.a
│ └── libnkntunnel.h
├── ios-amd64/
│ ├── libnkntunnel.a
│ └── libnkntunnel.h
├── linux-amd64/
│ ├── libnkntunnel.so
│ └── libnkntunnel.h
├── win-amd64/
│ ├── libnkntunnel.dll
│ └── libnkntunnel.h
└── ...
```

## Common Issues and Solutions

1. Build Fails: Missing Compiler

* Ensure the following compilers are installed:
* clang (for macOS and iOS builds)
* x86_64-w64-mingw32-gcc (for Windows builds)
* x86_64-linux-musl-gcc (for Linux builds)

2. Error: library not found

* Ensure all Go module dependencies are installed:

```shell
go mod tidy
```

3. `lipo` Command Not Found

* On macOS, ensure Xcode is installed, and the correct developer tools are selected:

```shell
xcode-select --install
```