eduardok / libsmbclient-php

smbclient's extension for PHP
Other
99 stars 21 forks source link

checking for libsmbclient.h in default paths... not found #97

Open shaqaruden opened 2 years ago

shaqaruden commented 2 years ago

Running pecl install smbclient on alpine. I have tried installing apk add samba-client and also tried apk add samba. I see that libsmbclient is being install.

Searching from root find . -print | grep -a "libsmbclient only returns

./usr/lib/libsmbclient.so.0 ./usr/lib/libsmbclient.so.0.7.0 ./usr/lib/samba/libsmbclient-raw-samba4.so

eduardok commented 2 years ago

find /usr -type f -name libsmbclient.h or locate libsmbclient.h Does it find it anywhere? I think you need: apk add samba-dev

project2021-code commented 1 year ago

I have the similar problem in FreeBSD.

./configure

checking for libsmbclient support... yes, shared
checking for libsmbclient.h in default paths... not found
configure: error: Could not find libsmbclient.h
root@test1:/tmp/php-ext/ext/smbclient # find / -name libsmbclient.h
/usr/local/include/samba4/libsmbclient.h

In file configure, I find that the directory it search for the libsmbclient.h is in Line 4693

    for i in /usr/local/include /usr/local/include/samba-* /usr/include /usr/include/samba-* ; do

It doesn't search /usr/local/include/samba4

If I add /usr/local/include/samba* to Line 4693, I will get

checking whether to enable smbclient support... yes, shared
checking for libsmbclient support... yes, shared
checking for libsmbclient.h in default paths... found in /usr/local/include/samba4
checking for smbc_getOptionUserData in -lsmbclient... no
configure: error: Could not find libsmbclient.so or symbol smbc_getOptionUserData. Check version and config.log for more information.
project2021-code commented 1 year ago

Found the solution, for FreeBSD, please refer to the Makefile in the Ports. You need to use --with-libsmbclient to specific the Local Base Directory and CPPFLAGS & LDFLAGS to specific the library location.

phpize

./configure \
--with-libsmbclient=/usr/local \
CPPFLAGS=-I/usr/local/include/samba4 \
LDFLAGS=-L/usr/local/lib/samba4

make test