From owner-freebsd-usb@FreeBSD.ORG Fri Feb 22 08:15:50 2013 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 69155D74 for ; Fri, 22 Feb 2013 08:15:50 +0000 (UTC) (envelope-from bsam@passap.ru) Received: from forward5h.mail.yandex.net (forward5h.mail.yandex.net [IPv6:2a02:6b8:0:f05::5]) by mx1.freebsd.org (Postfix) with ESMTP id D8BAEE27 for ; Fri, 22 Feb 2013 08:15:49 +0000 (UTC) Received: from smtp3h.mail.yandex.net (smtp3h.mail.yandex.net [84.201.186.20]) by forward5h.mail.yandex.net (Yandex) with ESMTP id 9F314D01FDE; Fri, 22 Feb 2013 12:15:46 +0400 (MSK) Received: from smtp3h.mail.yandex.net (localhost [127.0.0.1]) by smtp3h.mail.yandex.net (Yandex) with ESMTP id 3F1801B404F0; Fri, 22 Feb 2013 12:15:46 +0400 (MSK) Received: from 93.91.2.200.tel.ru (93.91.2.200.tel.ru [93.91.2.200]) by smtp3h.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Fj0OKDkH-Fj0mLiLr; Fri, 22 Feb 2013 12:15:46 +0400 Message-ID: <51272931.4050407@passap.ru> Date: Fri, 22 Feb 2013 12:15:45 +0400 From: Boris Samorodov Organization: =?UTF-8?B?0JfQkNCeICLQktCQ0KDQoiI=?= User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Hans Petter Selasky Subject: Re: argyllcms and usb (0.1 and 1.0) References: <5124932E.5080205@passap.ru> <201302201804.09100.hselasky@c2i.net> In-Reply-To: <201302201804.09100.hselasky@c2i.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: freebsd-usb@freebsd.org X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Feb 2013 08:15:50 -0000 20.02.2013 21:04, Hans Petter Selasky пишет: > On Wednesday 20 February 2013 10:11:10 Boris Samorodov wrote: >> Hello, All! >> >> I try to build argyllcms (http://www.argyllcms.com/) at FreeBSD: >> ----- >> % uname -a >> FreeBSD bsam.wart.ru 10.0-CURRENT FreeBSD 10.0-CURRENT #8 r246714: Tue >> Feb 12 22:26:27 SAMT 2013 >> bsam@bsam.wart.ru:/usr/obj/usr/src/sys/BB64X amd64 >> ----- >> >> The program uses USB-0.1 and USB-1.0. There is a remark at sources >> that since libusb1 does not support FreeBSD, usb-0.1 is used. >> >> When compiling I get the following error: >> ----- >> spectro/usbio.c:741:17: error: use of undeclared identifier 'dev'; did >> you mean 'div'? >> descriptor = dev->descriptor; /* Copy */ >> ^~~ >> div >> /usr/include/stdlib.h:91:8: note: 'div' declared here >> div_t div(int, int) __pure2; >> ^ >> spectro/usbio.c:741:20: error: member reference base type 'div_t (int, >> int)' is not a structure or union >> descriptor = dev->descriptor; /* Copy */ >> ~~~^ ~~~~~~~~~~ >> 5 warnings and 2 errors generated. >> >> cc -c -o spectro/usbio.o -DUNIX -D_THREAD_SAFE -pipe -O2 >> -DARGYLLCMS -Ispectro -Ih -Inumlib -Iicc -Icgats -Irspl -Ixicc -Igamut >> -Ispectro -Iplot -Ilibusb -Iucmm -I/usr/local/include spectro/usbio.c >> ----- >> >> Relevant (imho) parts from the source file: >> ----- >> [...] >> #ifdef USE_LIBUSB1 >> # include "libusb.h" >> #else >> # include "usb.h" >> #endif >> [...] >> /* Get a copy of the device descriptor so we can >> see device params */ >> #ifdef USE_LIBUSB1 >> if (libusb_get_device_descriptor(p->ppath->dev, >> &descriptor) != LIBUSB_SUCCESS) >> error("Get device descriptor on USB port >> '%s' failed with %d (%s)",p->ppath->path,rv,libusb_strerror(rv)); >> #else >> descriptor = dev->descriptor; /* Copy */ >> #endif >> ----- >> >> GCC version of the error message: >> ----- >> spectro/usbio.c: In function 'usb_open_port': >> spectro/usbio.c:741: error: 'dev' undeclared (first use in this function) >> spectro/usbio.c:741: error: (Each undeclared identifier is reported only >> once >> spectro/usbio.c:741: error: for each function it appears in.) >> ----- >> >> Seems (from my very inexperienced in USB POV) that the program >> wants libusb-0.1 but gets libusb-2.0... So I'm stuck here. >> >> Questons. >> 1. Should I use some additional flags to build sources using libusb-0.1? >> 2. Is a note about FreeBSD about libusb1 is stale and lubusb1 is >> supported? Sould I use some flags to use libusb1? >> >> Any help is appreciated. Thanks! > > USE_LIBUSB1 should be set, and -lusb must be used as linker flag, not - > lusb-1.0 like under linux. After a deeper look at the code I realised that actually the called LIBUSB1 is a USB-1.0 with some changes. The author call it "USB-1.0A". And this specific code is used at Linux and Windows drivers. And this code dosn't compile at FreeBSD. So I proceed with USB-0.1. The linker flag actually is "-lusb". > In FreeBSD -lusb is a multi-API library, including v0.1, v1.0 and v2.0. Header > files are in /usr/include Thanks, it was helpfull. With some changes at the code I managed to build argyllcms-1.4.0. -- WBR, Boris Samorodov (bsam) FreeBSD Committer, http://www.FreeBSD.org The Power To Serve