bimg icon indicating copy to clipboard operation
bimg copied to clipboard

Unable to build bimg in Go 1.9.4

Open ryanfowler opened this issue 7 years ago • 10 comments

System Go 1.9.4 on darwin amd64

vips vips-8.6.2-Wed Jan 31 20:39:14 UTC 2018

bimg v1.0.18 (02e621739c77c791d8c153f240b7a1f75b07816f)

When trying to build anything importing github.com/h2non/bimg, I receive the following error:

go build github.com/h2non/bimg: invalid flag in pkg-config --cflags: -Wl,-framework

This error is only present in Go 1.9.4 - building is successful with 1.9.3. Any ideas?

ryanfowler avatar Feb 12 '18 15:02 ryanfowler

Have same issue on Linux with 1.9.4 and 1.8.7. The problem seems caused because of this: https://go.googlesource.com/go/+/867fb18b6d5bc73266b68c9a695558a04e060a8a Issue is already reported: https://github.com/golang/go/issues/23749

illabo avatar Feb 14 '18 13:02 illabo

I just added a note stating that it is still not working, see: https://github.com/golang/go/issues/23749

I still cannot build anything that imports bimg since Go 1.10 and the problem still persists in Go 1.11

The error message I get is this:

# go build
go build gopkg.in/h2non/bimg.v1: invalid flag in pkg-config --libs: -Wl,--export-dynamic

tssajo avatar Sep 04 '18 17:09 tssajo

@tssajo strange, I'm able to build bimg (v1.0.18) in Go 1.10 without any issues.

ryanfowler avatar Sep 04 '18 18:09 ryanfowler

@ryanfowler Hmm... That's interesting! How do you import the bimg library? I do it this way:

package main

import (
	bimg "gopkg.in/h2non/bimg.v1"
)

Also, what OS are you on? I'm on Debian Linux (Jessie), see:

# lsb_release -a
Distributor ID: Debian
Description:    Debian GNU/Linux 8.11 (jessie)
Release:        8.11
Codename:       jessie

tssajo avatar Sep 04 '18 18:09 tssajo

@tssajo I'm using macOS 10.13.6.

The code snippet below compiles for me locally, as well as in a ubuntu:18.04 Docker container with Go 1.10 & 1.11.

package main

import (
	"gopkg.in/h2non/bimg.v1"
)

func main() {
	_ = bimg.NewImage([]byte("   "))
}

ryanfowler avatar Sep 04 '18 22:09 ryanfowler

export CGO_LDFLAGS_ALLOW='-Wl,-framework' https://github.com/golang/go/wiki/InvalidFlag

umatomba avatar May 15 '20 06:05 umatomba

I am getting similar error go build github.com/h2non/bimg: invalid flag in pkg-config --cflags: -Xpreprocessor

sahilpaudel-pe avatar Sep 04 '20 12:09 sahilpaudel-pe

@sahilpaudel-pe im getting the same issue, with no solution found. Have you found any? Here is my system's info:

# go version
go version go1.16 linux/amd64
# vips --version
vips-8.10.5-Fri Dec 18 10:14:09 UTC 2020
# github.com/h2non/bimg v1.1.15
# lsb_release -a
Distributor ID: Linuxmint
Description:    Linux Mint 20.1
Release:        20.1
Codename:       ulyssa

caquillo07 avatar Mar 02 '21 14:03 caquillo07

@caquillo07 See solution here: https://github.com/h2non/bimg/issues/280

tssajo avatar Mar 02 '21 16:03 tssajo

@tssajo thank you, that did the trick! not sure why that didn't come up on my search results.

Cheers 🎉

caquillo07 avatar Mar 02 '21 16:03 caquillo07