Skip to content

build failure on FreeBSD w/o optimization #305

Open
@hajimehoshi

Description

@hajimehoshi

PureGo Version

009f4b0

Operating System

  • Windows
  • macOS
  • Linux
  • FreeBSD
  • NetBSD
  • Android
  • iOS

Go Version (go version)

go1.22.12 (but also other versions)

What steps will reproduce the problem?

Run the test CGO_ENABLED=0 w/o optimization

What is the expected result?

The test passes

What happens instead?

The test fails

https://github.com/hajimehoshi/purego/actions/runs/13751525916/job/38453081556

  => go test CGO_ENABLED=0 w/o optimization
  # github.com/ebitengine/purego/internal/fakecgo
  internal/fakecgo/freebsd.go:23:3: //go:cgo_export_dynamic environ only allowed in cgo-generated code
  internal/fakecgo/freebsd.go:24:3: //go:cgo_export_dynamic __progname only allowed in cgo-generated code
  FAIL	github.com/ebitengine/purego [build failed]
  FAIL	github.com/ebitengine/purego/examples/libc [build failed]
  ?   	github.com/ebitengine/purego/internal/cgo	[no test files]
  FAIL	github.com/ebitengine/purego/internal/fakecgo [build failed]
  FAIL	github.com/ebitengine/purego/internal/load [build failed]
  ?   	github.com/ebitengine/purego/internal/strings	[no test files]
  FAIL

Anything else you feel useful to add?

We should add -e to the shebang #!/bin/sh.

I don't think this is happening in the stable branch, where the test is not executed in a shell script.

EDIT: This might happen in the stable branch, as the test didn't include building w/o optimization. See

echo "=> go test CGO_ENABLED=0"
env CGO_ENABLED=0 go test -gcflags="github.com/ebitengine/purego/internal/fakecgo=-std" -shuffle=on -v -count=10 ./...
echo "=> go test CGO_ENABLED=1"
env CGO_ENABLED=1 go test -shuffle=on -v -count=10 ./...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions