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

build: get binary build info from debug/buildinfo #170

Merged
merged 3 commits into from
Oct 20, 2022
Merged

build: get binary build info from debug/buildinfo #170

merged 3 commits into from
Oct 20, 2022

Conversation

positiveblue
Copy link
Contributor

@positiveblue positiveblue commented Oct 17, 2022

By using the debug/buildinfo package we do not have to rely on setting custom ldflags.

Unfortunately, there is no vcs.tags settings so we need to still pass the output of git describe --tags --dirty as an ldflag.

Note: this change was already merged in LND and the lnd package need to be updated in go.mod for this to work.


install:
@$(call print, "Installing tarod and tarocli.")
$(GOINSTALL) -tags="${tags}" $(LDFLAGS) $(PKG)/cmd/tarod
$(GOINSTALL) -tags="${tags}" $(LDFLAGS) $(PKG)/cmd/tarocli
$(GOINSTALL) -tags="${tags}" $(RELEASE_LDFLAGS) $(PKG)/cmd/tarod
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things, when I run make install I get:

$ make install
fatal: No names found, cannot describe anything.
 Installing tarod and tarocli.
GO111MODULE=on go install -v -tags=""  -s -w -buildid= -X github.com/lightninglabs/taro/build.Commit= github.com/lightninglabs/taro/cmd/tarod
flag provided but not defined: -s
usage: go install [build flags] [packages]
Run 'go help install' for details.
make: *** [Makefile:95: install] Error 2

And also when I just make the ./tarod-debug --version command doesn't anymore have the commit set.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you were right, I forgot the -ldflags in front of $(RELEASE_LDFLAGS) same here

Thank you for noticing @bhandras 🙏

Bump lnd to `609cc8b883c7e6186e447e8d7e6349688d78d4fd` in master, which
already includes the change for including the build tags info without
using `-ldflags`.

This is needed for running the itests, which build lnd and won't have
the build tags replicated a `-ldflags`.
By using the `debug/buildinfo` package we do not have to relay on
setting custom ldflags.

Unfortunately, there is no `vcs.tags` settings so we need to still pass
the output of `git describe --tags --dirty` as an ldflag.
@positiveblue
Copy link
Contributor Author

positiveblue commented Oct 17, 2022

I updated lnd to ensure that it had the latest changes in master. However, I am not sure if there is anything that is incompatible with the project yet 🤔

Copy link
Member

@bhandras bhandras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK! 🎉

@Roasbeef Roasbeef merged commit 72c2ab6 into lightninglabs:main Oct 20, 2022
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 this pull request may close these issues.

None yet

3 participants