Hi Bruce, All!

19.08.2017 01:03, bruce пишет:
> Hi,
> 
> I am trying to get a program to compile on freebsd-11.1.  It compiles
> just fine using ubuntu-16.04 but there is a problem with linking
> libserialport with freebsd.  Below are the configure.ac and Makefile.am
> I am using.  The linker error follows.  Can anyone help?
> 
> linker error:
> /usr/local/lib/libserialport.so: undefined reference to
> `libusb20_dev_close'
> /usr/local/lib/libserialport.so: undefined reference to `libusb20_be_free'
> /usr/local/lib/libserialport.so: undefined reference to
> `libusb20_dev_kernel_driver_active'
> /usr/local/lib/libserialport.so: undefined reference to
> `libusb20_dev_req_string_simple_sync'
> /usr/local/lib/libserialport.so: undefined reference to
> `libusb20_dev_get_address'
> /usr/local/lib/libserialport.so: undefined reference to
> `libusb20_dev_get_iface_desc'
> /usr/local/lib/libserialport.so: undefined reference to
> `libusb20_be_device_foreach'
> /usr/local/lib/libserialport.so: undefined reference to
> `libusb20_dev_get_bus_number'
> /usr/local/lib/libserialport.so: undefined reference to
> `libusb20_be_alloc_default'
> /usr/local/lib/libserialport.so: undefined reference to
> `libusb20_dev_get_desc'
> /usr/local/lib/libserialport.so: undefined reference to
> `libusb20_dev_get_device_desc'
> /usr/local/lib/libserialport.so: undefined reference to `libusb20_dev_open'
> c++: error: linker command failed with exit code 1 (use -v to see
> invocation)
> *** Error code 1
> 
> Stop.
> 
> 
> 
> Makefile.am:
> 
> gardendir = /home/blm/garden/src
> garden_DATA = ../data/state_table
> AUTOMAKE_OPTIONS = subdir-objects
> ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS}
> cc=c++
> bin_PROGRAMS = garden
> garden_SOURCES = main.cpp garden.cpp
> garden_CPPFLAGS = $(GTKMM_CFLAGS)
> garden_CPPFLAGS += -std=c++11
> garden_LDFLAGS = $(GTKMM_LIBS)
> garden_CXXFLAGS = $(DEPS_CFLAGS)
> garden_LDADD = $(DEPS_LIBS)
> 
> configure.ac:
> 
> AC_PREREQ([2.69])
> AC_INIT([FULL-PACKAGE-NAME],[VERSION],[BUG-REPORT-ADDRESS])
> AM_INIT_AUTOMAKE
> PKG_CHECK_MODULES([DEPS], [gtkmm-3.0 >= 3.0.0])
> PKG_CHECK_MODULES([DEPS], [libserialport-0.1.0 >= 0.1.0])
> AC_CONFIG_SRCDIR([src/garden.cpp])
> AC_CONFIG_HEADERS([config.h])
> 
> # Checks for programs.
> AC_PROG_CXX
> AC_PROG_CC
> 
> # Checks for libraries.
> AC_ARG_WITH([libserialport-include-path],
>           [AS_HELP_STRING([--with-libserialport-include-path],
>             [location of the libserialport headers, defaults to
> /usr/local/include])],
>           [A_CFLAGS="-I$withval"],
>           [A_CFLAGS='-I/usr/local/include'])
> AC_SUBST([A_CFLAGS])
> 
> AC_ARG_WITH([libserialport-lib-path],
>           [AS_HELP_STRING([--with-libserialport-lib-path], [location of
> the libserialport libraries])],
>           [LIBS="-L/usr/local/lib"],
>           [LIBS='-lserialport'])
> AC_SUBST([LIBS])
> # Checks for header files.
> AC_CHECK_HEADERS([unistd.h])
> # Checks for typedefs, structures, and compiler characteristics.
> AC_HEADER_STDBOOL
> 
> # Checks for library functions.
> 
> AC_CONFIG_FILES([Makefile
>                  src/Makefile])
> AC_OUTPUT

Probably you should use '-lusb' linking flag at FreeBSD. Take a look at
/usr/libdata/pkgconfig/libusb-2.0.pc.

Hm, libserialport.pc does not mention this. Should it (at FreeBSD)?

-- 
WBR, bsam

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to