Bug 242083 - graphics/libheif failes to build after lang/go-devel upgrade
Summary: graphics/libheif failes to build after lang/go-devel upgrade
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Dmitri Goutnik
URL:
Keywords: buildisok
Depends on:
Blocks:
 
Reported: 2019-11-19 17:01 UTC by gja822
Modified: 2019-11-22 17:01 UTC (History)
3 users (show)

See Also:
freebsd: maintainer-feedback+


Attachments
libheif-1.6.0_1.patch (598 bytes, patch)
2019-11-19 18:33 UTC, Dmitri Goutnik
freebsd: maintainer-approval-
Details | Diff
libheif-1.6.0.log (59.28 KB, text/plain)
2019-11-19 23:00 UTC, Dmitri Goutnik
no flags Details
libheif-1.6.0_1.patch suppress go example build (563 bytes, patch)
2019-11-20 21:41 UTC, Sebastian Steinmetz
freebsd: maintainer-approval+
Details | Diff
Disable build examples for go (250 bytes, patch)
2019-11-21 23:03 UTC, Vladimir Druzenko
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description gja822 2019-11-19 17:01:55 UTC
graphics/libheif failes to build for me. (amd64 FreeBSD-11 stable)
I suppose, it is after lang/go-devel upgrade. The error is:


--- heif-test-go ---
heif-test.go:39:2: cannot find package "github.com/strukturag/libheif/go/heif" in any of:
	/usr/local/go/src/github.com/strukturag/libheif/go/heif (from $GOROOT)
	/usr/ports/graphics/libheif/work/go/src/github.com/strukturag/libheif/go/heif (from $GOPATH)
*** [heif-test-go] Error code 1

make[6]: stopped in /usr/ports/graphics/libheif/work/libheif-1.6.0/examples
Comment 1 gja822 2019-11-19 17:03:16 UTC
(Unsuccessful try from libheif-1.3.2_5 to  1.6.0)
Comment 2 Dmitri Goutnik freebsd_committer freebsd_triage 2019-11-19 18:33:14 UTC
Created attachment 209256 [details]
libheif-1.6.0_1.patch

(In reply to gja822 from comment #0)
Hi,

First of all, please don't use lang/go-devel for building Go ports - it's too early in release cycle for it to be cleared for ports building. If you need current development Go version, just build it out-of-tree from the source checkout as described in [1]

Regarding the build issue, graphics/libheif seems to require go for building examples but doesn't declare it as a build dependency. With EXAMPLES=on it also needs USES=gmake due to gnuisms in examples's Makefile.am (${CURDIR}).

Attached patch fixes both issues, making the build pass with both lang/go and lang/go-devel.

[1] https://golang.org/doc/install/source
Comment 3 Vladimir Druzenko freebsd_committer freebsd_triage 2019-11-19 22:03:45 UTC
(In reply to Dmitri Goutnik from comment #2)
> don't use lang/go-devel for building Go ports
graphics/libheif failes to build with lang/go and lang/go14 installed too.
Comment 4 Sebastian Steinmetz 2019-11-19 22:23:18 UTC
Hi,

I've built this using my poudriere setup in a 12.1-RELEASE jail and had no issue with the patch. From my perspective it's fine to accept this. 

Never the less I did not see any problem before with my setup and without the "USES = gmake go:no_targets". Can you share a build log from your system documenting the compilation failure?
Comment 5 Sebastian Steinmetz 2019-11-19 22:24:50 UTC
Comment on attachment 209256 [details]
libheif-1.6.0_1.patch

Approved
Comment 6 Automation User 2019-11-19 22:42:13 UTC
Build info is available at https://gitlab.com/swills/freebsd-ports/pipelines/97111046
Comment 7 Dmitri Goutnik freebsd_committer freebsd_triage 2019-11-19 23:00:00 UTC
(In reply to Sebastian Steinmetz from comment #4)
Hi Sebastian,

You won't see a failure in poudriere unless you add a build dependency on go. This is because libheif detects go presence during configure stage and wraps building go  examples in "if HAVE_GO ... endif". This port needs either a build dependency on go when EXAMPLES knob is checked or go examples disabled with --disable-go.

The error I was getting in poudriere was

mkdir: /src: Permission denied

and it was caused by ${CURDIR} resolving to an empty string because CURDIR is not defined in bmake. The OP was getting a different error but I bet it's because they're building as root outside of poudriere and if they look at their /, they'll find /src/github.com/strukturag created by the port build.
Comment 8 Dmitri Goutnik freebsd_committer freebsd_triage 2019-11-19 23:00:46 UTC
Created attachment 209259 [details]
libheif-1.6.0.log
Comment 9 gja822 2019-11-20 06:46:39 UTC
(In reply to Dmitri Goutnik from comment #2)
So, you recommend not to install lang/go-devel from ports' tree at all, don't you? Actually, I do not use go widely in any way. But it was used as a dependency.

(And concerning go-devel, somehow it now uses bundled bootstrap, even if go14 is installed (and previous go-devel could be used also).)
Comment 10 Sebastian Steinmetz 2019-11-20 21:41:38 UTC
Created attachment 209292 [details]
libheif-1.6.0_1.patch suppress go example build

After staring a little bit more on the code and how the package builds, I think this dependency on go is nonsense.

Yes, there is an example go program in the package, but libheifs make script does not consider it worth installing (rather than the executables it installs to the stage dir in usr/local/bin).

So this is really an example go code for go developers to study how to use the library.

My idea would be to suppress the go build all together (via configure option --disable-go). What is your opinion on this?
Comment 11 Dmitri Goutnik freebsd_committer freebsd_triage 2019-11-20 22:36:58 UTC
(In reply to gja822 from comment #9)
I'm saying that using lang/go-devel instead of lang/go for regular port building is not recommended. Port maintainers probably do not test with it, some upstreams may not yet support it. Things may break in confusing ways, YMMV etc. As to why it now uses prebuilt bootstrap and not lang/go14, see https://svnweb.freebsd.org/ports?view=revision&revision=517703

(In reply to Sebastian Steinmetz from comment #10)
If this question was for me - I agree that bringing in Go and gmake just to build a few examples that aren't even installed is probably a bit excessive and adding --disable-go would be a better option.
Comment 12 gja822 2019-11-21 05:38:45 UTC
(In reply to Dmitri Goutnik from comment #11)
And what about not to bootstrap, if I already have go-devel, but use already installed one? Is it possible at all?
Comment 13 Sebastian Steinmetz 2019-11-21 21:51:27 UTC
(In reply to Dmitri Goutnik from comment #11)

thank you for your opinion. Given that feedback I would favour the other patch with --disable-go. Do you mind having a look if it works for your setup as well?
Thank you!
Comment 14 Vladimir Druzenko freebsd_committer freebsd_triage 2019-11-21 23:03:55 UTC
Created attachment 209332 [details]
Disable build examples for go

Something like this?
Comment 15 commit-hook freebsd_committer freebsd_triage 2019-11-22 17:00:15 UTC
A commit references this bug:

Author: dmgk
Date: Fri Nov 22 16:59:39 UTC 2019
New revision: 518153
URL: https://svnweb.freebsd.org/changeset/ports/518153

Log:
  graphics/libheif: Disable building of Go example

  Disable building of Go example code to avoid adding build dependency on go and
  gmake.

  PR:		242083
  Submitted by:	Sebastian Steinmetz <freebsd@sebastiansteinmetz.ch> (maintainer)
  Reported by:	gja822@narod.ru

Changes:
  head/graphics/libheif/Makefile
Comment 16 Dmitri Goutnik freebsd_committer freebsd_triage 2019-11-22 17:01:46 UTC
Committed maintainer approved patch, thanks everyone.