Giter Site home page Giter Site logo

Comments (2)

a-agmon avatar a-agmon commented on July 24, 2024 1

Thanks @begelundmuller ,
My code compiles on ARM, and is a lambda function that is executed by AWS lambda. Lambda runtime can also be ARM so that was resolved.
Im adding here the code for the Dockerfile I used to build it with DuckDB dynamically linked for the common good as it was not very easy to figure out.

# ==== build stage ====
FROM golang:1.19.4-bullseye as build
WORKDIR /app
COPY . .
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential wget unzip
ENV GOARCH=arm64
ENV GOOS=linux
RUN wget -qO /app/libduckdb.zip https://github.com/duckdb/duckdb/releases/download/v0.8.0/libduckdb-linux-aarch64.zip \
    && unzip -o /app/libduckdb.zip -d /app \
    && rm /app/libduckdb.zip
RUN CGO_ENABLED=1 CGO_LDFLAGS="-L/app" go build -tags=duckdb_use_lib -o mylambda mylambda.go

# ==== final stage ====
FROM debian:bullseye-slim
WORKDIR /var/task
COPY --from=build /app/mylambda ./
COPY --from=build /app/libduckdb.so /lib/
# Set the library search path
ENV LD_LIBRARY_PATH=/lib
# set the home directory
ENV HOME=/tmp
ENTRYPOINT ["/var/task/mylambda"]

from go-duckdb.

begelundmuller avatar begelundmuller commented on July 24, 2024

Sadly your approach won't work because Go's cross-compilation (where you just set GOOS and GOARCH) only works for pure Go apps, not Go apps that use CGO. DuckDB is written in C++, so CGO is required.

Cross-compiling Go apps that use CGO is possible, but more complicated. Google is your friend for resources. It's usually simplest just to build on the native OS and architecture (you can use a Github workflow to run builds on different runners).

from go-duckdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.