After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 782446 - gvfs cannot find -lsmbclient on FreeBSD because the result of pkg-config --libs is not used
gvfs cannot find -lsmbclient on FreeBSD because the result of pkg-config --li...
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: build
git master
Other FreeBSD
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2017-05-10 14:45 UTC by Ting-Wei Lan
Modified: 2017-05-15 09:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
build: Use flags returned by pkg-config to find smbclient (2.79 KB, patch)
2017-05-10 14:58 UTC, Ting-Wei Lan
none Details | Review
build: Use flags returned by pkg-config to find smbclient (3.73 KB, patch)
2017-05-12 14:35 UTC, Ting-Wei Lan
none Details | Review
build: Use flags returned by pkg-config to find smbclient (3.73 KB, patch)
2017-05-12 14:42 UTC, Ting-Wei Lan
committed Details | Review

Description Ting-Wei Lan 2017-05-10 14:45:33 UTC
I have samba 4.4.13 installed on my FreeBSD desktop system, but gvfs cannot find -lsmbclient and automatically disables samba support.

checking for SMBCLIENT... yes
checking libsmbclient.h usability... yes
checking libsmbclient.h presence... yes
checking for libsmbclient.h... yes 
checking for smbc_getFunctionStatVFS in -lsmbclient... no
checking for smbc_new_context in -lsmbclient... no
checking for Samba libraries... no

gvfs configuration summary:
    Samba support: no


The reason of the problem is that the configure script never uses flags returned by pkg-config. Even if the script uses PKG_CHECK_MODULES to find smbclient library, it never uses SMBCLIENT_LIBS.

It may be possible to workaround the issue by manually passing --with-samba-libs option, but I think it is better to get it work by default because pkg-config can return the correct result.
Comment 1 Ting-Wei Lan 2017-05-10 14:58:03 UTC
Created attachment 351556 [details] [review]
build: Use flags returned by pkg-config to find smbclient

Previously, the result returned PKG_CHECK_MODULES is only used to find
header files, and --with-samba-libs option is required if the shared
library is not installed in the default search path. This commit changes
it to use the result returned by pkg-config to find both header files
and the shared library when --with-samba-libs is not used, preventing
samba feature from being unexpectedly disabled on FreeBSD.
Comment 2 Ondrej Holy 2017-05-11 10:39:04 UTC
Review of attachment 351556 [details] [review]:

Thanks! However, I think we can rely on PKG_CHECK_MODULES these days and that the old detection code may be removed instead of updating them. What do you think? Can you please update your patch?
Comment 3 Ting-Wei Lan 2017-05-12 14:35:45 UTC
Created attachment 351726 [details] [review]
build: Use flags returned by pkg-config to find smbclient

Previously, the result returned by PKG_CHECK_MODULES is only used to
find header files, and --with-samba-libs option is required if the
shared library is not installed in the default search path. This commit
replaces the old detection code with simple pkg-config calls, making
it easier to find and specify the smbclient library.

Yes, using PKG_CHECK_MODULES not only simplifies the code but also makes
debugging easier. This patch is based on the libusb check found in the
same file.
Comment 4 Ting-Wei Lan 2017-05-12 14:42:38 UTC
Created attachment 351727 [details] [review]
build: Use flags returned by pkg-config to find smbclient

Previously, the result returned by PKG_CHECK_MODULES is only used to
find header files, and --with-samba-libs option is required if the
shared library is not installed in the default search path. This commit
replaces the old detection code with simple pkg-config calls, making
it easier to find and specify the smbclient library.

Fix the AC_DEFINE macro usage.
Comment 5 Ondrej Holy 2017-05-15 09:48:53 UTC
Attachment 351727 [details] pushed as 18b24b2 - build: Use flags returned by pkg-config to find smbclient

Thanks a lot for your contribution!