1

I have trouble installing this library called librsync on an Amazon standard linux instance.

I tried this:

yum install librsync-devel

but I got No package librsync available (fair enough I guess!)

I also followed the install instructions, which says:

To build and test librsync from the extracted distribution do;

$ ./configure
$ make all check

I'm no linux expert, I extracted the library files and run these commands:

[ec2-user@ip-**-***-**-*** librsync]$ ./configure
-bash: ./configure: Permission denied

[ec2-user@ip-**-***-**-*** librsync]$ sudo ./configure
sudo: ./configure: command not found

[ec2-user@ip-**-***-**-*** librsync]$ sudo configure
sudo: configure: command not found

I changed permission of the configure file and run the ./configure command again. I got a long list of yes (full log here) and then this:

checking whether g++ accepts -g... no
checking dependency style of g++... none
checking how to run the C++ preprocessor... /lib/cpp
configure: error: C++ preprocessor "/lib/cpp" fails sanity check

I'm totally lost. Any idea how to install this librsync library on EC2 linux instance?

poolie
  • 9,289
  • 1
  • 47
  • 74
TheDude
  • 3,045
  • 4
  • 46
  • 95

1 Answers1

3

From the error, it looks like your configure script is not set to be executable. You can check with ls -l configure. You should see a line that starts with something like -rwxr-xr-x. If not, you can run chmod +x configure to add executable permission to it.

If the permissions on that file are not right, it would be good to check the rest of the files in the distribution. How did you get the file? Downloading the tarball from Sourceforge? Download the ZIP from Github? Checking out from Github? And how did you extract it? If you could fill those details in to your question, as well as the full output of ls -l, that might help us figure out what happened.

edit to add: It looks from your configure log like cpp (the C preprocessor) is looking for cc1plus, which is part of g++. You can install that with yum install gcc-c++ (remember to run as root or with sudo).

Also, in regards to your comment, I would recommend copying the .tar.gz file directly to the Linux machine, and extracting it with tar xvzf myfile.tar.gz rather than extracting it on a Windows machine and uploading it. There are enough differences in the filesystem (how permission bits work, case sensitivity), that the process of extracting files on Windows and uploading the extracted files with something like winscp can cause problems like this.

Brian Campbell
  • 322,767
  • 57
  • 360
  • 340
  • Thank you Brian, yes, I actually just found about this just before you answered my question (see edit). Yes, I got the file from sourceforge, I extracted it locally then uploaded via winscp. After bypassing the permission issue, I had few errors about C++ or something. I posted the [full log here](http://pastebin.com/E77VQ02m) – TheDude Oct 16 '12 at 17:24
  • Thank you so much Brian! That (almost) did it! I re-uploaded the tar & extracted it on the EC2 instance, I installed gcc & make and **it worked** ([see logs here](http://pastebin.com/9C9nEk3g)), I tried calling it, ie. `librsync --help` but it doesn't work (it says `-bash: librsync: command not found`)...I understand it's a library rather than an executable, but how can I call it anyway via SSH? – TheDude Oct 18 '12 at 19:42
  • PS. [readme is located here](https://github.com/kaseya/librsync/blob/master/README) and [makefile.in is here](https://github.com/kaseya/librsync/blob/master/Makefile.in) – TheDude Oct 18 '12 at 19:44
  • 1
    @Gdhami What are you intending to do with `librsync`? As you point out, it's a library, not an executable. That means you would generally use it by compiling and linking an executable to it. Do you have a program that depends on `librsync`? Or are you writing such a program? To link against it, you would generally call GCC like: `gcc -o program program.c -lrsync`. If you want something that you can call from the command line, you should just use [`rsync`](http://rsync.samba.org/) itself. – Brian Campbell Oct 18 '12 at 19:50
  • I'd like to call librsync to patch/restore a given file. The idea is to call it via PHP (ie. `exec("librsync --patch=$file_name --delta=$delta_file --output=$final_file");`), that's why I wanted to install librsync. If rsync can be used to apply a **specific/single rdiff/restore job** I'd use it in a heartbeat (Can I?) but my understanding is it's a full sync package (which is not what I want) – TheDude Oct 18 '12 at 20:01
  • 1
    @Gdhami Ah. You want the `rdiff` application (which should be build and installed as part of `librsync`). Try `man rdiff` or `rdiff --help`. There are three steps to using it; you generate a signature of the old file, you use that signature and the new file to create a delta, then you can apply that delta to a basis file (the old file, or another file that is similar enough that the delta still applies). So your command, once you've generated a delta, would be `exec("rdiff patch $file_name $delta_file $final_file")`. – Brian Campbell Oct 18 '12 at 20:52
  • I can't believe I forgot about rdiff, yes you're right but...rdiff seems to be missing on the EC2 instance, obviously it hasn't been installed, any idea where I can find it? I googled a lot but only found something called `rdiff-backup` – TheDude Oct 18 '12 at 21:35
  • 2
    @Gdhami `rdiff` is built and installed as part of `librsync`. Did you run `sudo make install`? Or `make install` when logged in as root? If not, do so. If you did, it likely would have installed `rdiff` in `/usr/local/bin`. Is that in your path? You can check with `echo $PATH`, or you can try running `/usr/local/bin/rdiff` manually. If it's not in your path, you can add something like `export PATH=/usr/local/bin:$PATH` to your `.profile` or `.bash_profile`. There's probably somewhere else you will need to set it for PHP, or just use the absolute pathname when invoking it from PHP. – Brian Campbell Oct 18 '12 at 21:55
  • OK, I think `sudo make install` did the trick and now I'm able to find rdiff under `/usr/local/bin`, thank you so much Brian for all your help!!! – TheDude Oct 18 '12 at 22:15