libsmbclient-php builds successfully but I get an error on "make install"

404 views
Skip to first unread message

Patrick Rynhart

unread,
Aug 27, 2010, 3:30:14 PM8/27/10
to libsmbclient-php
Hi,

I have followed the instructions at:

http://github.com/eduardok/libsmbclient-php/blob/master/README

and have been able to succesfully "phpize", "configure" and "make".
However, I get errors attempting to "make install". A module
"libsmbclient.so" is created (so I presume that I could complete the
installation by hand). However, it would be good if the issue
affecting "make install" could be resolved. I am on CentOS 5.3. (It
looks like a dynamic shared object is not being built, but attempts
are being made to install it ?)

Below is the output of my build attempt:

# less README
# phpize

# ./configure
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for icc... no
checking whether gcc and cc understand -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/
main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/
php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib/20060613-debug
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... yes
checking if zts is enabled... yes
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to
regenerate PHP parsers.
checking for gawk... gawk
checking for libsmbclient support... yes, shared
checking for libsmbclient files in default path... found in /usr
checking for smbc_init in -lsmbclient... yes
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 32768
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc static flag works... yes
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld) supports shared
libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h

# make
make: Warning: File `/root/libsmbclient-php/libsmbclient.c' has
modification time 1.5e+05 s in the future
/bin/sh /root/libsmbclient-php/libtool --mode=compile gcc -I. -I/root/
libsmbclient-php -DPHP_ATOM_INC -I/root/libsmbclient-php/include -I/
root/libsmbclient-php/main -I/root/libsmbclient-php -I/usr/include/php
-I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/
Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/
include/php -DHAVE_CONFIG_H -g -O0 -c /root/libsmbclient-php/
libsmbclient.c -o libsmbclient.lo
mkdir .libs
gcc -I. -I/root/libsmbclient-php -DPHP_ATOM_INC -I/root/libsmbclient-
php/include -I/root/libsmbclient-php/main -I/root/libsmbclient-php -I/
usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/
include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/
lib -I/usr/include/php -DHAVE_CONFIG_H -g -O0 -c /root/libsmbclient-
php/libsmbclient.c -fPIC -DPIC -o .libs/libsmbclient.o
/bin/sh /root/libsmbclient-php/libtool --mode=link gcc -DPHP_ATOM_INC -
I/root/libsmbclient-php/include -I/root/libsmbclient-php/main -I/root/
libsmbclient-php -I/usr/include/php -I/usr/include/php/main -I/usr/
include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/
include/php/ext/date/lib -I/usr/include/php -DHAVE_CONFIG_H -g -O0
-o libsmbclient.la -export-dynamic -avoid-version -prefer-pic -module -
rpath /root/libsmbclient-php/modules libsmbclient.lo -lsmbclient
gcc -shared .libs/libsmbclient.o -lsmbclient -Wl,-soname -
Wl,libsmbclient.so -o .libs/libsmbclient.so
creating libsmbclient.la
(cd .libs && rm -f libsmbclient.la && ln -s ../libsmbclient.la
libsmbclient.la)
/bin/sh /root/libsmbclient-php/libtool --mode=install cp ./
libsmbclient.la /root/libsmbclient-php/modules
cp ./.libs/libsmbclient.so /root/libsmbclient-php/modules/
libsmbclient.so
cp ./.libs/libsmbclient.lai /root/libsmbclient-php/modules/
libsmbclient.la
PATH="$PATH:/sbin" ldconfig -n /root/libsmbclient-php/modules
----------------------------------------------------------------------
Libraries have been installed in:
/root/libsmbclient-php/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

make: warning: Clock skew detected. Your build may be incomplete.

# make install
make: Warning: File `/root/libsmbclient-php/libsmbclient.c' has
modification time 1.5e+05 s in the future
/bin/sh /root/libsmbclient-php/libtool --mode=compile gcc -I. -I/root/
libsmbclient-php -DPHP_ATOM_INC -I/root/libsmbclient-php/include -I/
root/libsmbclient-php/main -I/root/libsmbclient-php -I/usr/include/php
-I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/
Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/
include/php -DHAVE_CONFIG_H -g -O0 -c /root/libsmbclient-php/
libsmbclient.c -o libsmbclient.lo
gcc -I. -I/root/libsmbclient-php -DPHP_ATOM_INC -I/root/libsmbclient-
php/include -I/root/libsmbclient-php/main -I/root/libsmbclient-php -I/
usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/
include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/
lib -I/usr/include/php -DHAVE_CONFIG_H -g -O0 -c /root/libsmbclient-
php/libsmbclient.c -fPIC -DPIC -o .libs/libsmbclient.o
/bin/sh /root/libsmbclient-php/libtool --mode=link gcc -DPHP_ATOM_INC -
I/root/libsmbclient-php/include -I/root/libsmbclient-php/main -I/root/
libsmbclient-php -I/usr/include/php -I/usr/include/php/main -I/usr/
include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/
include/php/ext/date/lib -I/usr/include/php -DHAVE_CONFIG_H -g -O0
-o libsmbclient.la -export-dynamic -avoid-version -prefer-pic -module -
rpath /root/libsmbclient-php/modules libsmbclient.lo -lsmbclient

*** Warning: Linking the shared library libsmbclient.la against the
loadable module
*** libsmbclient.so is not portable!
rm -fr .libs/libsmbclient.la .libs/libsmbclient.lai .libs/
libsmbclient.so
gcc -shared .libs/libsmbclient.o -Wl,--rpath -Wl,/root/libsmbclient-
php/.libs -Wl,--rpath -Wl,/root/libsmbclient-php/modules /root/
libsmbclient-php/.libs/libsmbclient.so -Wl,-soname -
Wl,libsmbclient.so -o .libs/libsmbclient.so
gcc: /root/libsmbclient-php/.libs/libsmbclient.so: No such file or
directory
make: *** [libsmbclient.la] Error 1

# find . -name 'libsmbclient.so'
./modules/libsmbclient.so



Eduardo Kienetz

unread,
Aug 27, 2010, 4:22:26 PM8/27/10
to libsmbcl...@googlegroups.com
On Fri, Aug 27, 2010 at 1:30 PM, Patrick Rynhart <pryn...@gmail.com> wrote:
> Hi,
>
> I have followed the instructions at:
>
> http://github.com/eduardok/libsmbclient-php/blob/master/README
>
> and have been able to succesfully "phpize", "configure" and "make".
> However, I get errors attempting to "make install".  A module
> "libsmbclient.so" is created (so I presume that I could complete the
> installation by hand).  However, it would be good if the issue
> affecting "make install" could be resolved.  I am on CentOS 5.3.  (It
> looks like a dynamic shared object is not being built, but attempts
> are being made to install it ?)

> # make
> make: Warning: File `/root/libsmbclient-php/libsmbclient.c' has
> modification time 1.5e+05 s in the future

First clue of something wrong with time.

> make: warning:  Clock skew detected.  Your build may be incomplete.

Definite message about time problems.

Can you fix the time in your machine or at least run a: touch *

I guess you could be also using an NFS server. If that's the case
please make sure the NFS server's time matches this machine's time.
You could use NTP on each one: ntpdate nz.pool.ntp.org

Let me know what happens.

Thanks for the reports,

--
Eduardo Bacchi Kienetz

Patrick Rynhart

unread,
Aug 27, 2010, 4:52:48 PM8/27/10
to libsmbclient-php
> > make: Warning: File `/root/libsmbclient-php/libsmbclient.c' has
> > modification time 1.5e+05 s in the future
>
> First clue of something wrong with time.
> > make: warning: Clock skew detected. Your build may be incomplete.
> Definite message about time problems.
> Can you fix the time in your machine or at least run a: touch *

Ah - I did notice those but thought they were benign :-)

Resolved with a

# find . | xargs touch

> I guess you could be also using an NFS server. If that's the case
> please make sure the NFS server's time matches this machine's time.
> You could use NTP on each one: ntpdate nz.pool.ntp.org

Not on an NFS share - but I completed the git check out and created a
tar of the directory on an off-site box (then uploaded to my
production environment where I attempted the build). There will be a
clock skew somewhere as a result of this process.

> Let me know what happens.

Looks much better. Although when I attempt a "make test", I get:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/
20060613-debug/dbase.so' - /usr/lib/20060613-debug/dbase.so: cannot
open shared object file:

I did try to find where this library is supposed to be on CentOS with
a:

# yum provides '/usr/lib/20060613-debug/dbase.so'

(which gave no hits) and then a yum provides 'dbase.so'

which gave:

php-common-5.1.6-27.el5.i386 : Common files for PHP
php-dbase-5.1.6-15.el5.centos.1.i386 : Standard dBase module for PHP
applications
php-common-5.1.6-27.el5.i386 : Common files for PHP

Trouble is all these rpm's are installed.

Is this important, or will libsmbclient-php run without the dbase.so
shared object ?

>
> Thanks for the reports,

No problems - Thank you for your quick answers!

I haven't tried loading limsmbclient-php as an extension yet (still
wanting to get the build correct).

Do you have a code snippet for copying a remote file from a CIFS
box ? i.e. I'm after the SMB/CIFS "equivalent" to

scp remoteBox:/foo /tmp

(i.e. copy a file "foo" from "remoteBox" to the local filesystem - but
using CIFS as opposed to SFTP).

(Even better, I want to serve up a file for HTTP download on demand
using a *nix box as a frontend to a backend CIFS box. If you know of
a way that I can do this without having to locally cache it on the
*nix frontend this would be appreciated.)

Thanks for your help.

Patrick
>
> --
> Eduardo Bacchi Kienetz

Eduardo Kienetz

unread,
Aug 27, 2010, 6:36:17 PM8/27/10
to libsmbcl...@googlegroups.com
On Fri, Aug 27, 2010 at 2:52 PM, Patrick Rynhart <pryn...@gmail.com> wrote:
> Ah - I did notice those but thought they were benign :-)

Yeah, it's kinda weird that stuff doesn't work because of that. I'm
pretty sure there's a good explanation. Maybe one of these days I'll
actually do some research and find out :P

> Resolved with a
>
> # find . | xargs touch
>

> Not on an NFS share - but I completed the git check out and created a
> tar of the directory on an off-site box (then uploaded to my
> production environment where I attempted the build).  There will be a
> clock skew somewhere as a result of this process.

Yeah, so that box is in the future.

> Trouble is all these rpm's are installed.
>
> Is this important, or will libsmbclient-php run without the dbase.so
> shared object ?

Oh, I forgot about that. You can safely ignore and simply make install now :)

> I haven't tried loading limsmbclient-php as an extension yet (still
> wanting to get the build correct).
>
> Do you have a code snippet for copying a remote file from a CIFS
> box ?  i.e. I'm after the SMB/CIFS "equivalent" to
>
> scp remoteBox:/foo /tmp
>
> (i.e. copy a file "foo" from "remoteBox" to the local filesystem - but
> using CIFS as opposed to SFTP).
>
> (Even better, I want to serve up a file for HTTP download on demand
> using a *nix box as a frontend to a backend CIFS box.  If you know of
> a way that I can do this without having to locally cache it on the
> *nix frontend this would be appreciated.)

Yeah, that's why I had to use libsmbclient-php. I was doing not only
download but upload to a samba server's share.

Note that you could also do: smbclient //sambaserver/share -N -p -c
"prom ; cd dir1/dir2 ; get myfile.zip"

That's the type of thing I was using before I implemented libsmbclient-php.

Basically you're gonna have something like:

$fh = smbclient_open($url);
if(!$fh) return;
while($str = smbclient_read($fh, 4096))
$file_contents .= $str;
smbclient_close($fh);

$url should be in the format: smb://user:pass@server/share/file.txt

Regards,

--
Eduardo Bacchi Kienetz

Patrick Rynhart

unread,
Aug 29, 2010, 5:32:52 AM8/29/10
to libsmbclient-php
Hi Eduardo,

I have been able to get your test script "libsmbclient.php" up and
running! Works great. An excellent link between PHP and Samba :-)

A couple of comments / observations:

1. Executing "libsmbclient.php" under httpd for me initially resulted
in:

Fatal error: Call to undefined function smbclient_opendir() in /var/
www/html/libsmbclient-php/libsmbclient.php on line 31

Taking the commented line "//dl("./.libs/libsmbclient.so");" as a
hint, I tried:

dl("libsmbclient.so");

which resulted in libsmbclient-php working correctly. Perhaps either
ship this example script as above (i.e. with an uncommented line
dl("libsmbclient.so");) or add a comment to the README ?

2. On stderr, the following is being written for each script (executed
interactively):

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/
20060613-debug/dbase.so' - /usr/lib/20060613-debug/dbase.so: cannot
open shared object file: No such file or directory in Unknown on line
0

This will be related to the dbase.so warnings observed with "make
test" as discussed above.

Otherwise - looks good.

Regards,

Patrick

Eduardo Kienetz

unread,
Aug 30, 2010, 12:28:42 PM8/30/10
to libsmbcl...@googlegroups.com
On Sun, Aug 29, 2010 at 3:32 AM, Patrick Rynhart <pryn...@gmail.com> wrote:
> Hi Eduardo,
>
> I have been able to get your test script "libsmbclient.php" up and
> running!  Works great. An excellent link between PHP and Samba :-)

Good, thanks.

> A couple of comments / observations:
>
> 1. Executing "libsmbclient.php" under httpd for me initially resulted
> in:
>
> Fatal error: Call to undefined function smbclient_opendir() in /var/
> www/html/libsmbclient-php/libsmbclient.php on line 31
>
> Taking the commented line "//dl("./.libs/libsmbclient.so");" as a
> hint, I tried:
>
> dl("libsmbclient.so");
>
> which resulted in libsmbclient-php working correctly.  Perhaps either
> ship this example script as above (i.e. with an uncommented line
> dl("libsmbclient.so");) or add a comment to the README ?

The dl() line is only needed if you want to manually load the
library/extension instead of using php.ini as described in README.

> 2. On stderr, the following is being written for each script (executed
> interactively):
>
> PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/
> 20060613-debug/dbase.so' - /usr/lib/20060613-debug/dbase.so: cannot
> open shared object file: No such file or directory in Unknown on line
> 0
>
> This will be related to the dbase.so warnings observed with "make
> test" as discussed above.

I don't get those on my Mandriva (and I don't have a dbase.so), but I
remember seeing that before, perhaps it was on my Slackware.
Anyway... once I'm able to reproduce I'll take a look.

Keep in mind that there are many functions from samba's client library
that weren't implemented in libsmbclient-php yet, so if you seem to
need anything that's not supported let me know and perhaps I can add
(e.g: chmod, print functions, etc).

Thanks again,

--
Eduardo Bacchi Kienetz

mssel...@gmail.com

unread,
Mar 6, 2013, 8:05:08 AM3/6/13
to libsmbcl...@googlegroups.com
Hi all,
         I am getting the following error.

/opt/setup/libsmbclient-php/libsmbclient.c:75: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘libsmbclient_functions’
/opt/setup/libsmbclient-php/libsmbclient.c:97: error: ‘libsmbclient_functions’ undeclared here (not in a function)
/opt/setup/libsmbclient-php/libsmbclient.c: In function ‘zif_smbclient_mkdir’:
/opt/setup/libsmbclient-php/libsmbclient.c:278: warning: cast from pointer to integer of different size
/opt/setup/libsmbclient-php/libsmbclient.c: In function ‘zif_smbclient_creat’:
/opt/setup/libsmbclient-php/libsmbclient.c:469: warning: cast from pointer to integer of different size
make: *** [libsmbclient.lo] Error 1


The OS:CentOS6.3 64bit
Php:-
PHP 5.4.12 (cli) (built: Mar  6 2013 16:00:06)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies


Regards,
SELVA
Reply all
Reply to author
Forward
0 new messages