Bug 236750 - devel/librevisa - fix build error
Summary: devel/librevisa - fix build error
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Fernando Apesteguía
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-24 05:36 UTC by John Hein
Modified: 2019-04-03 16:44 UTC (History)
1 user (show)

See Also:


Attachments
[patch] remove obsolete cpp def that causes build error (425 bytes, patch)
2019-03-24 05:36 UTC, John Hein
no flags Details | Diff
[patch] fix non-default PREFIX (353 bytes, patch)
2019-04-03 01:17 UTC, John Hein
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Hein 2019-03-24 05:36:16 UTC
Created attachment 203094 [details]
[patch] remove obsolete cpp def that causes build error

On 10/stable & 11/stable, devel/librevisa fails during 'make build' like so:

=================
In file included from usb/usb_resource.cpp:25:
In file included from usb/usb_resource.h:24:
/usr/include/libusb.h:67:2: error: expected '}'
        LIBUSB_CLASS_APPLICATION = 0xfe,
        ^
<command line>:2:34: note: expanded from here
#define LIBUSB_CLASS_APPLICATION 0xfe
                                 ^
/usr/include/libusb.h:50:24: note: to match this '{'
enum libusb_class_code {
                       ^
1 error generated.
==================

libusb.h on 10 & 11 already defines LIBUSB_CLASS_APPLICATION, so the duplicate defined in the Makefile just confuses the compiler.

Fix attached.

QA:
 test build on 10/stable/amd64 and 11/stable/amd64 (ok)
 portlint (ok - patch adds a section separator for a portlint warning)
Comment 1 Fernando Apesteguía freebsd_committer 2019-03-26 17:37:55 UTC
Hi John,

Thanks for the patch. I'm curious however since I could build devel/librevisa fine in 11.2 and 12.0. Both define LIBUSB_CLASS_APPLICATION in /usr/include/libusb.h. It doesn't seem to be any conflict.

What am I missing?
Comment 2 John Hein 2019-04-02 15:14:50 UTC
Do you have pkgconf installed when you build?  On 11, if I don't have pkgconf installed, then when configure runs it does not detect libusb and usb_resource.cpp does not get built (usb_resource.cpp is what is dying from the error).

From the configure output, look for:

checking for libusb... yes
 or
checking for libusb... no


If you build in poudriere (e.g., with testport), then librevisa does not pull in pkgconf as a dependency (although it probably should since the configure script uses pkg-config quite a bit and the built library changes with vs. without it).  If, however, you build outside poudriere where pkgconf is likely installed, then the build is quite different.

To reproduce in poudriere, try this:

sudo poudriere testport -i -j <yourjail> -o devel/librevisa

It should build fine, but leave you in the jail.

Then do:

cd /usr/ports/devel/pkgconf
make install
cd /usr/ports/devel/librevisa
make clean build

If that's the difference between my build and yours, that should show the error for you.
Comment 3 commit-hook freebsd_committer 2019-04-02 21:02:52 UTC
A commit references this bug:

Author: fernape
Date: Tue Apr  2 21:02:35 UTC 2019
New revision: 497588
URL: https://svnweb.freebsd.org/changeset/ports/497588

Log:
  devel/librevisa: fix build error

  On FreeBSD versions where libusb.h defines LIBUSB_CLASS_APPLICATION, the extra
  definition from the Makefile prevents the port from building. Remove that extra
  definition.

  While here, add build dependency for pkg-config

  PR:	236750
  Submitted by:	jcfyecrayz@liamekaens.com

Changes:
  head/devel/librevisa/Makefile
Comment 4 Fernando Apesteguía freebsd_committer 2019-04-02 21:08:11 UTC
Thanks John for the patch and the thorough explanation!

I can confirm the problem and your solution. I also added the build dependency on pkg-config.

Thanks!
Comment 5 John Hein 2019-04-03 01:17:24 UTC
Created attachment 203334 [details]
[patch] fix non-default PREFIX

Thanks.
One more thing.  If PREFIX != LOCALBASE, 'make stage' fails:

 .
 .
/usr/bin/strip /usr/ports/devel/librevisa/work/stage/usr/local/lib/libvisa.so
strip: open /usr/ports/devel/librevisa/work/stage/usr/local/lib/libvisa.so failed: No such file or directory
*** Error code 1


The fix is to strip the .so in ${PREFIX} rather than ${LOCALBASE}.

Patch attached.  I didn't feel the need to open a new bug for this, but I can.
Comment 6 Fernando Apesteguía freebsd_committer 2019-04-03 09:21:55 UTC
(In reply to John Hein from comment #5)

Thanks again. Sometimes ports which are not maintained fall behind.

I'll have a look at it later today.

Cheers
Comment 7 commit-hook freebsd_committer 2019-04-03 16:44:45 UTC
A commit references this bug:

Author: fernape
Date: Wed Apr  3 16:44:31 UTC 2019
New revision: 497736
URL: https://svnweb.freebsd.org/changeset/ports/497736

Log:
  devel/librevisa: fix non-default PREFIX

  Stripping was done always in LOCALBASE

  PR:	236750
  Submitted by:	jcfyecrayz@liamekaens.com

Changes:
  head/devel/librevisa/Makefile