Skip to main content

Could not lchown() symlink

Did I mention that I like rsnapshot very much? Well, I do, but this particular installation is giving me the heebeegeebees:

  WARNING: Could not lchown() symlink "/foo/some/symlink"
Apparently my Perl installation does not have the Lchown module, hence the messages. Well, I switched from SunFreeware to OpenCSW, but rsnapshot is using /usr/bin/perl anyway and rsnapshot itself is from a current GIT checkout, so why are these messages coming up just now? The cure for this is to install Lchown from CPAN - unfortunately, this does not went so well, and we have a lot of CPAN surgery ahead just to get Lchown working (again?):
  CPAN.pm: Going to build N/NC/NCLEATON/Lchown-1.00.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Lchown
cp Lchown.pm blib/lib/Lchown.pm
/usr/bin/perl /usr/perl5/5.8.4/lib/ExtUtils/xsubpp -typemap /usr/perl5/5.8.4/lib/ExtUtils/typemap \
                   Lchown.xs > Lchown.xsc && mv Lchown.xsc Lchown.c
cc -c  -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xarch=v8 -D_TS_ERRNO -xO3 \
         -xspace -xildoff    -DVERSION=\"1.00\"  -DXS_VERSION=\"1.00\" -KPIC \
         "-I/usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE"   Lchown.c
sh: cc: not found
*** Error code 1
Well, we could edit Config.pm, but this stock Perl-5.8 installation from Solaris10 does not seem to have this file. The OpenCSW version was no better, forcing it to compile with gcc did not succeed either, as expected:
[...]
gcc -c   -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xarch=v8 -D_TS_ERRNO \
           -xO3 -xspace -xildoff    -DVERSION=\"1.00\"  -DXS_VERSION=\"1.00\" -KPIC \
           "-I/usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE"   Lchown.c
gcc: unrecognized option `-KPIC'
gcc: language ildoff not recognized
gcc: Lchown.c: linker input file unused because linking not done
So I went a different direction:
$ wget http://rsnapshot.org/downloads/extras/Lchown-1.00.tar.gz -O - | gzip -dc | tar -xf -
$ cd Lchown-1.00
$ perl Makefile.PL 
Checking if your kit is complete...
Looks good
Writing Makefile for Lchown
$ cat ../Lchown.diff
--- Lchown-1.00/Makefile        Mon Aug 31 22:03:58 2009
+++ Lchown-1.00.edited/Makefile Mon Aug 31 22:02:06 2009
@@ -23,12 +23,12 @@
 
 # They may have been overridden via Makefile.PL or on the command line
 AR = ar
-CC = cc
-CCCDLFLAGS = -KPIC
+CC = gcc
+CCCDLFLAGS = -fPIC
 CCDLFLAGS = -R /usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE
 DLEXT = so
 DLSRC = dl_dlopen.xs
-LD = cc
+LD = gcc
 LDDLFLAGS = -G
 LDFLAGS = 
 LIBC = /lib/libc.so
@@ -254,8 +254,8 @@
 
 # --- MakeMaker cflags section:
 
-CCFLAGS = -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xarch=v8 -D_TS_ERRNO
-OPTIMIZE = -xO3 -xspace -xildoff
+CCFLAGS = -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TS_ERRNO
+OPTIMIZE = -O2
 PERLTYPE = 
 MPOLLUTE = 

$ gpatch < ../Lchown.diff
$ make
$ sudo make install
Running rsnapshot again, the errors are gone now, heh!