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

  • From: Boris Samorodov <bsam@xxxxxxxxx>
  • To: argyllcms@xxxxxxxxxxxxx
  • Date: Wed, 27 Feb 2013 11:30:51 +0400

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:
-----
% gcc --version
gcc (GCC) 4.2.1 20070831 patched [FreeBSD]
Copyright (C) 2007 Free Software Foundation, Inc.
-----
[...]
Cc_ spectro/usbio.o
spectro/usbio.c: In function 'icoms_usb_interrupt_write':
spectro/usbio.c:449: warning: cast to pointer from integer of different size
spectro/usbio.c: In function 'icoms_usb_interrupt_read':
spectro/usbio.c:471: warning: cast to pointer from integer of different size
spectro/usbio.c: In function 'icoms_usb_bulk_write':
spectro/usbio.c:493: warning: cast to pointer from integer of different size
spectro/usbio.c: In function 'icoms_usb_bulk_read':
spectro/usbio.c:515: warning: cast to pointer from integer of different size
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.)
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
-----

-- 
WBR, Boris Samorodov (bsam)
FreeBSD Committer, http://www.FreeBSD.org The Power To Serve
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#       .
#       ./graphics
#       ./graphics/argyll
#       ./graphics/argyll/distinfo
#       ./graphics/argyll/Makefile
#       ./graphics/argyll/pkg-plist
#       ./graphics/argyll/files
#       ./graphics/argyll/files/patch-spectro_webwin.c
#       ./graphics/argyll/files/patch-Jamtop
#       ./graphics/argyll/pkg-descr
#
echo c - .
mkdir -p . > /dev/null 2>&1
echo c - ./graphics
mkdir -p ./graphics > /dev/null 2>&1
echo c - ./graphics/argyll
mkdir -p ./graphics/argyll > /dev/null 2>&1
echo x - ./graphics/argyll/distinfo
sed 's/^X//' >./graphics/argyll/distinfo << 'f253ecda9d52b5ddf593d4742225a789'
XSHA256 (Argyll_V1.4.0_src.zip) = 
d33134704d2964db69f9e61eb73188632fe2058cdf57aeaa56e64a264e02b1a8
XSIZE (Argyll_V1.4.0_src.zip) = 15242860
f253ecda9d52b5ddf593d4742225a789
echo x - ./graphics/argyll/Makefile
sed 's/^X//' >./graphics/argyll/Makefile << '11d4034f26b67dafa4cb5d2831cc9d8e'
X# $FreeBSD$
X
XPORTNAME=      argyll
XPORTVERSION=   1.4.0
XCATEGORIES=    graphics
XMASTER_SITES=  http://www.argyllcms.com/
XDISTNAME=      Argyll_V${PORTVERSION}_src
X
XMAINTAINER=    bsam@xxxxxxxxxxx
XCOMMENT=       ICC compatible color management system (CMS)
X
XPATCH_DEPENDS= jam:${PORTSDIR}/devel/jam
XBUILD_DEPENDS= jam:${PORTSDIR}/devel/jam
XLIB_DEPENDS=   Xss:${PORTSDIR}/x11/libXScrnSaver \
X               jbig:${PORTSDIR}/graphics/jbigkit \
X               jpeg:${PORTSDIR}/graphics/jpeg \
X               pthread-stubs:${PORTSDIR}/devel/libpthread-stubs \
X               tiff:${PORTSDIR}/graphics/tiff \
X               xcb:${PORTSDIR}/x11/libxcb
X
XUSE_ZIP=       yes
XLDFLAGS+=      -L${LOCALBASE}/lib
XUSE_XORG=      x11 xau xdmcp xext xrandr xrender xxf86vm xinerama 
XWRKSRC=                ${WRKDIR}/Argyll_V${PORTVERSION}
XUSE_GCC=       any
X
Xpost-patch:
X       # If you want to test building with the system libusb
X       # comment out the following line
X       #${CP} /usr/lib/libusb.a ${WRKSRC}/libusb/
X
Xpost-install:
X       # The license information should be treated with the
X       # FreeBSD ports infrastructure
X       ${RM} ${WRKSRC}/usr/local/bin/License.txt
X       ${INSTALL_PROGRAM} ${WRKSRC}/usr/local/bin/* ${PREFIX}/bin
X       ${MKDIR} ${PREFIX}/share/color/ref
X       ${INSTALL_DATA} ${WRKSRC}/usr/local/ref/* ${PREFIX}/share/color/ref
X
X.include <bsd.port.pre.mk>
X
X.if ${OSVERSION} < 800069
XBROKEN=                this port is unsupported on FreeBSD 7.x
X.endif
X
X.include <bsd.port.post.mk>
11d4034f26b67dafa4cb5d2831cc9d8e
echo x - ./graphics/argyll/pkg-plist
sed 's/^X//' >./graphics/argyll/pkg-plist << '43daeb9823949165d6a3fcfd0cdb73c4'
Xbin/applycal 
Xbin/average 
Xbin/cb2ti3 
Xbin/cctiff 
Xbin/ccxxmake 
Xbin/chartread 
Xbin/collink 
Xbin/colprof 
Xbin/dispcal 
Xbin/dispread 
Xbin/dispwin 
Xbin/extracticc 
Xbin/extractttag 
Xbin/fakeCMY 
Xbin/fakeread 
Xbin/greytiff 
Xbin/i1d3ccss 
Xbin/iccdump 
Xbin/iccgamut 
Xbin/icclu 
Xbin/illumread 
Xbin/invprofcheck 
Xbin/kodak2ti3 
Xbin/mppcheck 
Xbin/mpplu 
Xbin/mppprof 
Xbin/printcal 
Xbin/printtarg 
Xbin/profcheck 
Xbin/refine 
Xbin/revfix 
Xbin/scanin 
Xbin/spec2cie 
Xbin/specplot 
Xbin/splitti3 
Xbin/spotread 
Xbin/spyd2en 
Xbin/spyd4en 
Xbin/synthcal 
Xbin/synthread 
Xbin/targen 
Xbin/tiffgamut 
Xbin/timage 
Xbin/txt2ti3 
Xbin/verify 
Xbin/viewgam 
Xbin/xicclu 
Xshare/color/ref/3dap5k.sp 
Xshare/color/ref/CIE_C.sp 
Xshare/color/ref/CMP_DT_003.cht 
Xshare/color/ref/CMP_Digital_Target-3.cht 
Xshare/color/ref/CMP_Digital_Target-3.cie 
Xshare/color/ref/CMP_Digital_Target-3.ti2 
Xshare/color/ref/ClayRGB1998.icm 
Xshare/color/ref/ColorChecker.cht 
Xshare/color/ref/ColorChecker.cie 
Xshare/color/ref/ColorChecker.ti2 
Xshare/color/ref/ColorCheckerDC.cht 
Xshare/color/ref/ColorCheckerSG.cht 
Xshare/color/ref/D50_0.0.sp 
Xshare/color/ref/D50_0.1.sp 
Xshare/color/ref/D50_0.3.sp 
Xshare/color/ref/D50_0.5.sp 
Xshare/color/ref/D50_0.7.sp 
Xshare/color/ref/D50_1.0.sp 
Xshare/color/ref/D50_1.2.sp 
Xshare/color/ref/D50_1.5.sp 
Xshare/color/ref/D50_1.7.sp 
Xshare/color/ref/D50_2.0.sp 
Xshare/color/ref/D50_2.5.sp 
Xshare/color/ref/D50_3.0.sp 
Xshare/color/ref/ECI2002.ti2 
Xshare/color/ref/ECI2002R.ti2 
Xshare/color/ref/FograStrip2.ti1 
Xshare/color/ref/FograStrip2_2.ti2 
Xshare/color/ref/FograStrip3.ti1 
Xshare/color/ref/FograStrip3_3.ti2 
Xshare/color/ref/GTIPlus.sp 
Xshare/color/ref/Hutchcolor.cht 
Xshare/color/ref/LaserSoftDCPro.cht 
Xshare/color/ref/Office.sp 
Xshare/color/ref/QPcard_201.cht 
Xshare/color/ref/QPcard_201.cie 
Xshare/color/ref/RefMediumGamut.gam 
Xshare/color/ref/SOtele.sp 
Xshare/color/ref/SpyderChecker.cht 
Xshare/color/ref/SpyderChecker.cie 
Xshare/color/ref/Trulux.sp 
Xshare/color/ref/TruluxPlus.sp 
Xshare/color/ref/ccxx.ti1 
Xshare/color/ref/example.sp 
Xshare/color/ref/example121.sp 
Xshare/color/ref/i1_RGB_Scan_1.4.cht 
Xshare/color/ref/i1_RGB_Scan_1.4.ti2 
Xshare/color/ref/it8.cht 
Xshare/color/ref/lab2lab.icm 
Xshare/color/ref/linear.cal 
Xshare/color/ref/sRGB.icm 
Xshare/color/ref/strange.cal 
X@dirrm share/color/ref
X@dirrmtry share/color
43daeb9823949165d6a3fcfd0cdb73c4
echo c - ./graphics/argyll/files
mkdir -p ./graphics/argyll/files > /dev/null 2>&1
echo x - ./graphics/argyll/files/patch-spectro_webwin.c
sed 's/^X//' >./graphics/argyll/files/patch-spectro_webwin.c << 
'139a471dcb7f898c03c0833071e5c49c'
X--- spectro/webwin.c.orig      2013-02-21 18:07:57.864549491 +0400
X+++ spectro/webwin.c   2013-02-21 18:09:01.623810046 +0400
X@@ -22,6 +22,7 @@
X # include <sys/types.h>
X # include <ifaddrs.h>
X # include <netinet/in.h> 
X+# include <sys/socket.h>
X # include <arpa/inet.h>
X #endif
X #include "copyright.h"
139a471dcb7f898c03c0833071e5c49c
echo x - ./graphics/argyll/files/patch-Jamtop
sed 's/^X//' >./graphics/argyll/files/patch-Jamtop << 
'4e5826da2c039fc5fc1a6b5bda7dded1'
X--- Jamtop.orig        2012-04-19 11:50:31.000000000 +0400
X+++ Jamtop     2013-02-21 23:55:04.000000000 +0400
X@@ -54,6 +54,8 @@ if $(UNIX) {
X       } else {
X               if [ GLOB /usr/X11R6/include/X11 : X.h ] {
X                       LibWinH = /usr/X11R6/include ;
X+              } else if [ GLOB /usr/local/include/X11 : X.h ] {
X+                      LibWinH = /usr/local/include ;
X               } else if [ GLOB /usr/include/X11 : X.h ] {
X                       LibWinH = /usr/include ;
X               } else {
X@@ -63,6 +65,8 @@ if $(UNIX) {
X               if $(HOST64) {
X                       if [ GLOB /usr/X11R6/lib : libX11.so ] {
X                               LibWinD = /usr/X11R6/lib ;
X+                      } else if [ GLOB /usr/local/lib : libX11.so ] {
X+                              LibWinD = /usr/local/lib ;
X                       } else if [ GLOB /usr/lib/x86_64-linux-gnu : libX11.so 
] {
X                               LibWinD = /usr/lib/x86_64-linux-gnu ;
X                       } else if [ GLOB /usr/lib64 : libX11.so ] {
X@@ -73,6 +77,8 @@ if $(UNIX) {
X               } else {
X                       if [ GLOB /usr/X11R6/lib : libX11.so ] {
X                               LibWinD = /usr/X11R6/lib ;
X+                      } else if [ GLOB /usr/local/lib : libX11.so ] {
X+                              LibWinD = /usr/local/lib ;
X                       } else if [ GLOB /usr/lib : libX11.so ] {
X                               LibWinD = /usr/lib ;
X                       } else {
X@@ -90,8 +96,8 @@ if $(UNIX) {
X 
X # See if we have a system TIFF library.
X if ! $(BUILTIN_TIFF) && $(UNIX) {
X-      if [ GLOB /usr/include : tiffio.h ]  {
X-              if  ! $(HOST64) && ( [ GLOB /usr/lib : libtiff.so ] || [ GLOB 
/usr/lib : libtiff.a ] )
X+      if [ GLOB /usr/local/include : tiffio.h ]  {
X+              if  ! $(HOST64) && ( [ GLOB /usr/local/lib : libtiff.so ] || [ 
GLOB /usr/local/lib : libtiff.a ] )
X                ||   $(HOST64) && ( [ GLOB /usr/lib64 : libtiff.so ] || [ GLOB 
/usr/lib64 : libtiff.a ] )
X                ||   $(HOST64) && ( [ GLOB /usr/lib/x86_64-linux-gnu : 
libtiff.so ] || [ GLOB /usr/lib/x86_64-linux-gnu : libtiff.a ] ) {
X                       echo "Using system TIFF library" ;
X@@ -112,9 +118,9 @@ if ! $(HAVE_TIFF) || $(BUILTIN_TIFF) {
X 
X # See if we have a system JPEG library.
X if ! $(BUILTIN_JPEG) && $(UNIX) {
X-      if [ GLOB /usr/include : jpeglib.h ]  {
X-              if  ! $(HOST64) && ( [ GLOB /usr/lib : libjpg.so ] || [ GLOB 
/usr/lib : libjpg.a ] )
X-               ||   $(HOST64) && ( [ GLOB /usr/lib64 : libjpg.so ] || [ GLOB 
/usr/lib64 : libjpg.a ] )
X+      if [ GLOB /usr/local/include : jpeglib.h ]  {
X+              if  ! $(HOST64) && ( [ GLOB /usr/local/lib : libjpeg.so ] || [ 
GLOB /usr/local/lib : libjpeg.a ] )
X+               ||   $(HOST64) && ( [ GLOB /usr/local/lib : libjpeg.so ] || [ 
GLOB /usr/local/lib : libjpeg.a ] )
X                ||   $(HOST64) && ( [ GLOB /usr/lib/x86_64-linux-gnu : 
libjpg.so ] || [ GLOB /usr/lib/x86_64-linux-gnu : libjpg.a ] ) {
X                       echo "Using system JPEG library" ;
X                       JPEGLIB = ;
4e5826da2c039fc5fc1a6b5bda7dded1
echo x - ./graphics/argyll/pkg-descr
sed 's/^X//' >./graphics/argyll/pkg-descr << 'f8654dd19ce94d017d959a56ca9ef6d5'
XArgyllCMS is an ICC compatible color management system, available as Open 
Source.
XIt supports accurate ICC profile creation for scanners, cameras and film
Xrecorders, and calibration and profiling of displays and RGB & CMYK printers.
X
XWWW: http://www.argyllcms.com/
f8654dd19ce94d017d959a56ca9ef6d5
exit

Other related posts: