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

Linker error when using ld.gold #94

Closed
hofbi opened this issue Jul 24, 2024 · 9 comments · Fixed by #98
Closed

Linker error when using ld.gold #94

hofbi opened this issue Jul 24, 2024 · 9 comments · Fixed by #98

Comments

@hofbi
Copy link
Contributor

hofbi commented Jul 24, 2024

The new flags introduced with #90 result in a linker error for the examples:

/usr/bin/ld.gold: undefs: unknown -z option
copybara-service bot pushed a commit to pybind/pybind11_abseil that referenced this issue Aug 2, 2024
…otobuf.

Leave it for later to resolve the `ubuntu-latest bazel` failure:

* pybind/pybind11_bazel#94

```
ERROR: /home/runner/work/pybind11_abseil/pybind11_abseil/pybind11_abseil/tests/BUILD:92:17: Linking pybind11_abseil/tests/missing_import.so failed: (Exit 1): gcc failed: error executing CppLink command (from target //pybind11_abseil/tests:missing_import.so) /usr/bin/gcc @bazel-out/k8-fastbuild/bin/pybind11_abseil/tests/missing_import.so-2.params

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
/usr/bin/ld.gold: undefs: unknown -z option
```

PiperOrigin-RevId: 658835571
copybara-service bot pushed a commit to pybind/pybind11_abseil that referenced this issue Aug 2, 2024
…otobuf.

Leave it for later to resolve the `ubuntu-latest bazel` failure:

* pybind/pybind11_bazel#94

```
ERROR: /home/runner/work/pybind11_abseil/pybind11_abseil/pybind11_abseil/tests/BUILD:92:17: Linking pybind11_abseil/tests/missing_import.so failed: (Exit 1): gcc failed: error executing CppLink command (from target //pybind11_abseil/tests:missing_import.so) /usr/bin/gcc @bazel-out/k8-fastbuild/bin/pybind11_abseil/tests/missing_import.so-2.params

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
/usr/bin/ld.gold: undefs: unknown -z option
```

PiperOrigin-RevId: 658835571
copybara-service bot pushed a commit to pybind/pybind11_abseil that referenced this issue Aug 5, 2024
…otobuf.

Leave it for later to resolve the `ubuntu-latest bazel` failure:

* pybind/pybind11_bazel#94

```
ERROR: /home/runner/work/pybind11_abseil/pybind11_abseil/pybind11_abseil/tests/BUILD:92:17: Linking pybind11_abseil/tests/missing_import.so failed: (Exit 1): gcc failed: error executing CppLink command (from target //pybind11_abseil/tests:missing_import.so) /usr/bin/gcc @bazel-out/k8-fastbuild/bin/pybind11_abseil/tests/missing_import.so-2.params

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
/usr/bin/ld.gold: undefs: unknown -z option
```

PiperOrigin-RevId: 658835571
copybara-service bot pushed a commit to pybind/pybind11_abseil that referenced this issue Aug 5, 2024
…otobuf.

Leave it for later to resolve the `ubuntu-latest bazel` failure:

* pybind/pybind11_bazel#94

```
ERROR: /home/runner/work/pybind11_abseil/pybind11_abseil/pybind11_abseil/tests/BUILD:92:17: Linking pybind11_abseil/tests/missing_import.so failed: (Exit 1): gcc failed: error executing CppLink command (from target //pybind11_abseil/tests:missing_import.so) /usr/bin/gcc @bazel-out/k8-fastbuild/bin/pybind11_abseil/tests/missing_import.so-2.params

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
/usr/bin/ld.gold: undefs: unknown -z option
```

PiperOrigin-RevId: 659560021
@hofbi
Copy link
Contributor Author

hofbi commented Aug 6, 2024

@rwgk I can see this issue is mentioned in several commits in https://github.com/pybind/pybind11_abseil. Does this mean you are able to reporduce it there?

@rwgk
Copy link
Collaborator

rwgk commented Aug 6, 2024

Yes, but I took a shortcut and simply pinned the pybind11_bazel version:

pybind/pybind11_abseil@d25d7b3

What crossed my mind (but I will not have a chance to work on myself for sure, unfortunately):

It would be great if there was

  • a GitHub Action here in pybind11_bazel that
  • git clones pybind11_abseil (which should always be in working condition, because we have pre-submit testing Google-internally, including pybind11_abseil GitHub actions),
  • then runs the same bazel test commands as we're running in the pybind11_abseil GitHub Actions,
  • except that the pybind11_bazel version is unpinned.

Which is essentially what you'd have to do now (just locally) to reproduce the issue.

Ideally repeat with pybind11_protobuf.

@hofbi
Copy link
Contributor Author

hofbi commented Aug 6, 2024

Sounds good. This information is super helpful for #96.

Should we revert #90 since it introduced this issue?

@hofbi
Copy link
Contributor Author

hofbi commented Aug 8, 2024

@rwgk I created #98 revertig the issue introduced by #90.

@jiawen
Copy link
Collaborator

jiawen commented Aug 8, 2024

Agreed on all points. @rwgk I've never set up GitHub Actions before but I'd like to give it a go. pybind11_abseil, pybind11_bazel, and pybind11_protobuf are all mutually related and it'd be good have CI for them.

@rwgk
Copy link
Collaborator

rwgk commented Aug 8, 2024

Agreed on all points. @rwgk I've never set up GitHub Actions before but I'd like to give it a go. pybind11_abseil, pybind11_bazel, and pybind11_protobuf are all mutually related and it'd be good have CI for them.

I only know a little bit myself, about GitHub actions. There isn't much to it getting started: simply add a file with some name, e.g. .github/workflows/ci.yml. You could start by copying a pybind11_abseil or pybind11_protobuf .yml file. Often I also look at the upstream pybind11 .yml files, those are very well maintained.

I found this quite useful:

https://github.github.io/actions-cheat-sheet/actions-cheat-sheet.pdf

There is more documentation that's pretty good. Spending half an hour or so just to look around and know where things are is probably a productivity booster.

@hofbi
Copy link
Contributor Author

hofbi commented Aug 8, 2024

https://github.com/bazel-contrib/rules_oci/blob/main/.github/workflows/ci.yaml or similar repos in this group are also good examples.

@jiawen
Copy link
Collaborator

jiawen commented Aug 27, 2024

@hofbi: type in the issue title? lg.gold -> ld.gold?

@hofbi hofbi changed the title Linker error when using lg.gold Linker error when using ld.gold Aug 27, 2024
@hofbi
Copy link
Contributor Author

hofbi commented Aug 27, 2024

Good catch, thanks

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

Successfully merging a pull request may close this issue.

3 participants