Added install step to static libgit2 build. #408

Closed
buddhike wants to merge 1 commits from fix-build into master
buddhike commented 2017-09-25 13:32:32 -05:00 (Migrated from github.com)
No description provided.
carlosmn commented 2017-10-07 04:22:53 -05:00 (Migrated from github.com)

What problem are you trying to solve? We tell the linker to look for the static library in the build directory, so this would just copy it over to where nobody is looking for it.

What problem are you trying to solve? We tell the linker to look for the static library in the build directory, so this would just copy it over to where nobody is looking for it.
buddhike commented 2017-10-07 16:54:34 -05:00 (Migrated from github.com)

If you look at the generated libgit2.pc file in build directory, you will see that it's pointing the linker to lib and headers in install directory. this content is not produced if you don't run install target. To see this behaviour locally, you can rm -rf build install in libgit2 dir and try building again.

If you look at the generated `libgit2.pc` file in build directory, you will see that it's pointing the linker to lib and headers in install directory. this content is not produced if you don't run `install` target. To see this behaviour locally, you can `rm -rf build install` in libgit2 dir and try building again.
carlosmn commented 2017-10-08 14:55:28 -05:00 (Migrated from github.com)

We don't need those paths to be accurate, as we tell cgo and the linker where to find the headers and archive. We in fact point to the libgit2.pc in the build directory, and only need it on order to figure out which other libraries libgit2 ended up depending on.

I don't recall if older (c)go versions needed us to perform the install, but the ones we test against do let us specify CFLAGS and LDFLAGS so we know where to find it. At this point, the install location serves as a way to avoid accidentally installing this internal detail into system paths.

We don't need those paths to be accurate, as we tell cgo and the linker where to find the headers and archive. We in fact point to the `libgit2.pc` in the build directory, and only need it on order to figure out which other libraries libgit2 ended up depending on. I don't recall if older (c)go versions needed us to perform the install, but the ones we test against do let us specify `CFLAGS` and `LDFLAGS` so we know where to find it. At this point, the install location serves as a way to avoid accidentally installing this internal detail into system paths.
buddhike commented 2017-10-08 17:26:18 -05:00 (Migrated from github.com)

Thanks @carlosmn. I will retract this PR. Static linking on master did not work for me for some reason without this step (on multiple machines with go 1.9).
I found this while crawling https://github.com/libgit2/libgit2/blob/master/script/cibuild.sh#L24 ;-).

Thanks @carlosmn. I will retract this PR. Static linking on master did not work for me for some reason without this step (on multiple machines with go 1.9). I found this while crawling https://github.com/libgit2/libgit2/blob/master/script/cibuild.sh#L24 ;-).
carlosmn commented 2017-10-09 05:01:50 -05:00 (Migrated from github.com)

Hm, it definitely should. This is exactly what we do on Travis and how I test locally so if it's not working, it should be worth investigating.

Hm, it definitely should. This is exactly what we do on Travis and how I test locally so if it's not working, it should be worth investigating.
buddhike commented 2017-10-09 05:09:19 -05:00 (Migrated from github.com)

Thanks again. Let me see if I can send you something reproducible.

Thanks again. Let me see if I can send you something reproducible.

Pull request closed

Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: jcarr/git2go#408
No description provided.