Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross Compile fails with WebP support. #33

Open
etsxxx opened this issue Oct 7, 2019 · 1 comment
Open

Cross Compile fails with WebP support. #33

etsxxx opened this issue Oct 7, 2019 · 1 comment

Comments

@etsxxx
Copy link
Member

etsxxx commented Oct 7, 2019

Related

PR: #32

Overview

github.com/chai2010/webp has problem with cross compile. It makes fanlin's cross compile fail also.

--

github.com/chai2010/webpクロスコンパイルの問題 により、fanlinのクロスコンパイルも失敗します。

Workaround

I made Dockerfile and Makefile to produce binary for CentOS7. These are usable for replacement of cross compile, I share them.

--

CentOS7用のバイナリを作るため、DockerfileとMakefileを用意しました。こちらはクロスコンパイルの代わりとして便利ですので、シェアします。

Dockerfile

FROM rpmbuild/centos7
USER root

WORKDIR /usr/local

RUN yum install -y wget git mercurial
RUN wget https://storage.googleapis.com/golang/go1.13.1.linux-amd64.tar.gz
RUN tar xvzf go1.13.1.linux-amd64.tar.gz
RUN rm go1.13.1.linux-amd64.tar.gz

RUN yum install -y rpm-build redhat-rpm-config rpmdevtools glibc glibc-common glibc-headers glibc-dev

ENV PATH /root/go/bin:/usr/local/go/bin:$PATH

Makefile

NAME=fanlin-build
GOOS=linux
GOARCH=amd64
CGO_ENABLED=1

dockerbuild:
	docker build -t $(NAME) .

build:
	docker run --rm \
		-v "$(PWD):/go/src/github.com/livesense-inc/fanlin" \
		-w /go/src/github.com/livesense-inc/fanlin \
		-e GOOS=$(GOOS) \
		-e GOARCH=$(GOARCH) \
		-e CGO_ENABLED=$(CGO_ENABLED) \
		$(NAME) \
		go build -o bin/fanlin github.com/livesense-inc/fanlin/cmd/fanlin

clean:
	docker image rm -f $(NAME)
@mom0tomo
Copy link
Contributor

mom0tomo commented Dec 15, 2022

On Ubuntu, it also worked:

Dockerfile

FROM ubuntu:20.04
USER root

WORKDIR /usr/local

RUN apt-get update && apt upgrade &&  apt-get install -y wget git mercurial gcc
RUN wget https://go.dev/dl/go1.19.4.linux-amd64.tar.gz
RUN tar xvzf go1.19.4.linux-amd64.tar.gz
RUN rm go1.19.4.linux-amd64.tar.gz

ENV PATH /root/go/bin:/usr/local/go/bin:$PATH

command:

$ make dockerbuild
$ make build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants