[argyllcms] Re: [FreeBSD, patch] spectro/usbio.c etc.

  • From: Graeme Gill <graeme@xxxxxxxxxxxxx>
  • To: argyllcms@xxxxxxxxxxxxx
  • Date: Wed, 27 Feb 2013 20:36:06 +1100

Boris Samorodov wrote:
> Hi All,
> 
> 27.02.2013 04:52, Graeme Gill пишет:
>> Boris Samorodov wrote:
>>
>>> while building argyllcms at FreeBSD some errors occur. Errors are
>>> the same at 9-i386 and 10-amd64. Compiles tested (clang is base
>>> compiler at 10.x):
>>
>>> spectro/usbio.c:(.text+0x1a): undefined reference to `usb_argyll_patched'
>>> cc: error: linker command failed with exit code 1 (use -v to see invocation)
>>
>>      that's a hint that you need to use the libusb that is provided
>> with ArgyllCMS in order to guarantee that all the instruments will work.
>> It has an implementation for usb_argyll_patched().
> 
> OK, I removed the patch from my experimental port. Let's try to build
> the patched driver.
> 
>>> spectro/usbio.c:742: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:742:20: error: member reference base type 'div_t (int,
>>> int)' is not a structure or union
>>>                         descriptor = dev->descriptor;   /* Copy */
>>
>> Hmm. The compiler seems to be automatically "correcting" dev to div. That
>> doesn't sound like a good thing for a compiler to do.
> 
> I don't think that clang tries to "correct" but rather "guess and
> propose".
> 
>> dev is an argument of the usb_check_and_add() function. I would
>> suspect a clash with some system library declaration or #define,
>> but the error message is poor. It should note the re-declaration if
>> this is the case.
> 
> There is no re-declaration, it's just undefined. Here is the gcc output:

> 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.)
> spectro/usbio.c: In function 'icoms_usb_cancel_io':
> spectro/usbio.c:1485: warning: cast from pointer to integer of different
> size
> 
>         gcc -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
> 
> ...failed Cc_ spectro/usbio.o ...
> [...]
> -----
> 
> Well, the base gcc at FreeBSD-9 is an old one, the base compiler at
> FreeBSD-10 is clang. They show similar behaviour: mark dev undefined.
> 
>> I don't think this code is present in V1.5 beta,
>> although there is a dev variable in usbio_lx.c.
>>
>>> But the question is: should there be a file named
>>> <lagacy/dev/usb/usb.h>?
>>
>> Sorry, out of my scope at the moment - I don't have a FreeBSD system to
>> check.
> 
> Oh, thats supposed to be the _system_ header! At least FreeBSD does not
> have that.
> 
>> I'm hoping to get a chance to install FreeBSD 9.1 on a partition
>> of my test machine at some stage.
> 
> If you like I can arrange an ssh login to a FreeBSD-based machine.
> 
> In case you would like to install FreeBSD yourself, here is my
> experimental port (attached). Just do:
> -----
> # cd /usr/ports/
> # sh <patch_to_shar_file>
> # cd graphics/argyll
> # make
> -----
> 


Other related posts: