Skip to content

Incompatible with clang 19.1.7 (at least) #371

Open
@connorbrinton

Description

@connorbrinton

Trying to create a simple package produces the following error on macOS with a newer version of Clang installed:

❯ gopy pkg example.com/hello       
go build -v example.com/hello

--- Processing package: example.com/hello ---
gopy: skipping 'main' package "example.com/hello/hello"

--- building package ---
gopy pkg example.com/hello
goimports -w hello.go
go build -mod=mod -buildmode=c-shared -o hello_go.so .
/Users/connor/Code/scratch/scratch013/.venv/bin/python build.py
CGO_CFLAGS="-I/Users/connor/.pyenv/versions/3.13.0/Library/Frameworks/Python.framework/Versions/3.13/include/python3.13" -fPIC -Ofast
CGO_LDFLAGS="-L/Users/connor/.pyenv/versions/3.13.0/lib" "-lpython3.13" -lintl -ldl -L/Users/connor/.pyenv/versions/3.13.0/lib -L/opt/homebrew/lib -Wl,-rpath,/opt/homebrew/lib -framework CoreFoundation
go build -mod=mod -buildmode=c-shared -o _hello.cpython-313-darwin.so .
cmd had error: exit status 1  output:
# runtime/cgo
clang: error: argument '-Ofast' is deprecated; use '-O3 -ffast-math' for the same behavior, or '-O3' to enable only conforming optimizations [-Werror,-Wdeprecated-ofast]

2025/04/30 11:04:07 error dispatching command: exit status 1

The Go package I'm trying to turn into a Python package consists of a single file, hello.go:

// hello is a simple package
package hello

import "fmt"

// Hello greets someone.
func Hello(name string) string {
	return fmt.Sprintf("hello %q from Go", name)
}

I believe that I'm using a newer version of Clang installed by Homebrew. This is my first time trying to use pygo, so I'm not sure which version of Clang introduced this incompatibility:

Homebrew clang version 19.1.7
Target: arm64-apple-darwin24.4.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/llvm/19.1.7_1/bin
Configuration file: /opt/homebrew/etc/clang/arm64-apple-darwin24.cfg

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions