# graphics/xsane fails to compile



## cpm@ (Jan 6, 2013)

Performing the latest upgrade for print/xsane, confirming that pkg-config(1) can not find the file path sane-backends.pc, fault that port builds erroneously.

```
checking for SANE - version >= 1.0.0... Package sane-backends was not found in the pkg-config search path.
 Perhaps you should add the directory containing `sane-backends.pc'
 to the PKG_CONFIG_PATH environment variable
 No package 'sane-backends' found
 Package sane-backends was not found in the pkg-config search path.
 Perhaps you should add the directory containing `sane-backends.pc'
 to the PKG_CONFIG_PATH environment variable
 No package 'sane-backends' found
 Package sane-backends was not found in the pkg-config search path.
 Perhaps you should add the directory containing `sane-backends.pc'
 to the PKG_CONFIG_PATH environment variable
 No package 'sane-backends' found yes
```

Problem above will cause undefined references:

```
xsane-back-gtk.o: In function `xsane_control_option':
xsane-back-gtk.c:(.text+0x3faf): undefined reference to `sane_control_option'
xsane-back-gtk.o: In function `xsane_back_gtk_set_option':
xsane-back-gtk.c:(.text+0x4513): undefined reference to `sane_strstatus'
.. (many more undefined references)
```

I have defined PKG_CONFIG_PATH environment variable in /etc/csh.cshrc as follow:

```
setenv PKG_CONFIG_PATH /usr/local/libdata/pkgconfig
```

For bash users, change syntax type in /etc/bash.bashrc:

```
export PKG_CONFIG_PATH=/usr/local/libdata/pkgconfig
```

This variable is used to augment pkg-config's search path, some local modules may be installed in a different prefix such as /usr/local. In that case, it's necessary to prepend the search path so that pkg-config can locate the .pc files. 

E.g. $libdir/pkgconfig is the address used on Linux[1]. This .pc files are included in /usr/local/pkgconfig and was needed add a new path separated by ":"


```
#tcsh
setenv PKG_CONFIG_PATH /usr/local/libdata/pkgconfig:/usr/local/pkgconfig

#bash
export PKG_CONFIG_PATH=/usr/local/libdata/pkgconfig:/usr/local/pkgconfig
```

[1]This does not affect the ports tree since ${X11BASE}/libdata/pkgconfig was added to mtree.

To solve this problem apply patch in /usr/ports/graphics/sane-backends/Makefile, and reinstall this port again.

Finally, installing graphics/xsane works.

While latest revision for graphics/sane-backends patched is merged into the ports tree, hope it helps other users.

PS this PR was submitted.


----------



## BeachGeek (Jan 9, 2013)

Thanks, fixed my build of 'sane-frontends'


----------



## cpm@ (Jan 9, 2013)

*UPDATE*: New revision 310057 was merged.


----------

