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

Fails to build with go mod vendor #77

Open
doug-galvanick opened this issue Feb 22, 2023 · 5 comments
Open

Fails to build with go mod vendor #77

doug-galvanick opened this issue Feb 22, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@doug-galvanick
Copy link

/scratch/duckdb$ go build
/scratch/duckdb$ go mod vendor
/scratch/duckdb$ go build
/usr/local/go/pkg/tool/linux_amd64/link: running g++ failed: exit status 1
/usr/bin/ld: cannot find -lduckdb: No such file or directory
collect2: error: ld returned 1 exit status

/scratch/duckdb$ rm -rf vendor/
/scratch/duckdb$ go build

Sorry for the drive by issue. I just solved it by not using vendor. Might break my Docker build but it works for now. Will follow up if I find a solution.

@doug-galvanick
Copy link
Author

Perhaps something like this - https://github.com/pganalyze/pg_query_go#usage-with-go-modules

When integrating this library using Go modules, and using a vendor/ directory, you will need to explicitly copy over some of the C build files, since Go does not copy files in subfolders without .go files whilst vendoring.

@marcboeker
Copy link
Owner

Thanks for reporting this. I've done some testing to include the deps directory in the vendoring process, but had no success. It seems that go mod vendor only supports Go source files that are imported.

@oleksandr
Copy link

perhaps, as a interim solution, the binaries could be placed elsewhere and their location could be provided with an env variable (during the build process), that doesn't conflict with others?

@marcboeker marcboeker added the bug Something isn't working label May 19, 2023
@MathiasGr
Copy link
Contributor

What has worked for me is to add these steps to our CI pipeline, using modvendor to vendor the non-go items.

          # Install and run github.com/goware/modvendor to vendor C dependencies.
          - go install github.com/goware/modvendor@latest
          - modvendor -copy="**/*.a" -v

@taniabogatsch taniabogatsch mentioned this issue Mar 6, 2024
@james-lawrence
Copy link

james-lawrence commented Jul 17, 2024

just add an empty deps.go file to the directory containing the c files and it'll fix itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants