tinygo-org / tinygo

Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.
https://tinygo.org
Other
14.81k stars 872 forks source link

Build on linux/amd64 with dev version: "error: ROM segments are non-contiguous: /tmp/tinygo3340197797/main" #4149

Closed orsinium closed 5 months ago

orsinium commented 5 months ago

echo/echo.go:

package main

import (
    "net/http"
)

func main() {
    http.HandleFunc("/", nil)
}

go.mod:

module echo

go 1.21.3

Running tinygo build -o echo.bin ./echo produces the following output:

error: ROM segments are non-contiguous: /tmp/tinygo3340197797/main

System info

tinygo version:

tinygo version 0.31.0-dev-e9ca417 linux/amd64 (using go version go1.21.3 and LLVM version 17.0.1)

cat /etc/lsb-release:

DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=21.2
DISTRIB_CODENAME=victoria
DISTRIB_DESCRIPTION="Linux Mint 21.2 Victoria"

hostnamectl:

Operating System: Linux Mint 21.2                 
          Kernel: Linux 5.15.0-94-generic
    Architecture: x86-64
 Hardware Vendor: Acer
  Hardware Model: Aspire TC-1660
aykevl commented 5 months ago

What exactly are you trying to do? For which target are you building? Linux or baremetal? The .bin file extension means TinyGo will try to create a binary firmware file, which is not something that is possible for Linux executables.

orsinium commented 5 months ago

Thank you! You're right, now it works. I've added .bin to the binary file to avoid conflicts with the directory (the default binary name on Linux is "echo" and the directory is also called "echo"), I didn't know that the file extension matters. It certainly doesn't matter in the Go compiler.