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

Issue with ld flags being generated #5

Closed
deepjyoti30 opened this issue Jan 20, 2023 · 1 comment
Closed

Issue with ld flags being generated #5

deepjyoti30 opened this issue Jan 20, 2023 · 1 comment

Comments

@deepjyoti30
Copy link

Hi there, this is a great project and I just stumbled across it while I was looking into a goreleaser issue (this one).

I have a similar use-case like you had, I want to build darwin binaries on a linux machine.

I have setup a separate goreleaser config for darwin builds and I am running into the following issue:

⨯ release failed after 8s                  error=failed to build for darwin_arm64: exit status 2: # command-line-arguments
/usr/lib/go/pkg/tool/linux_amd64/link: running /home/deepjyoti30/git/osxcross-target/bin/o64-clang failed: exit status 1
/usr/bin/ld: unrecognized option '-dynamic'
/usr/bin/ld: use the --help option for usage information
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)

As it seems, the -dynamic flag is not supported by ld anymore. I am assuming that the cause here is that a flag is being generated by osxcross that is not supported anymore by ld.

Following are the versions of ld, clang and gcc that I have:

GNU ld (GNU Binutils) 2.39.0
Copyright (C) 2022 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
clang version 14.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
gcc (GCC) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Can you shed some light on this and let me know if I am missing something here? I am trying to run the build on an amd64 machine and my OS is Arch Linux.

@jimafisk
Copy link
Member

Sorry for not responding here @deepjyoti30, hopefully you were able to find a solution.

I think this might be similar to the issue I ran into here: #6 (comment). It looks like CI is using your system's /usr/bin/ld instead of the one provided by the target. You can add the correct bin to your $PATH in a GitHub Action like this: https://github.com/plentico/plenti/blob/41d16dac87a452f547dc02edbf75b89dd7c8b277/.github/workflows/release.yml#L36

@jimafisk jimafisk closed this as completed Nov 5, 2024
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