Installing ddar on a Synology NAS

This is how I installed ddar on a Synology NAS. The source distribution of ddar installs just fine with gcc and make available from optware. The problem is the protobuf dependency. It can’t be installed via PyPI due to seemingly a variety of unfixed issues, and I failed to compile it on the NAS itself, due to this error:


make[2]: Entering directory `/tmp/protobuf-2.4.0a/src'
/bin/ash ../libtool --tag=CXX --mode=link g++ -pthread -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -O2 -g -DNDEBUG -pthread -o protoc main.o -lpthread libprotobuf.la libprotoc.la -lz
libtool: link: g++ -pthread -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -O2 -g -DNDEBUG -pthread -o .libs/protoc main.o -lpthread ./.libs/libprotobuf.so ./.libs/libprotoc.so -lz -pthread -Wl,-rpath -Wl,/usr/local/lib
main.o: In function `__exchange_and_add':
/opt/lib/gcc/i686-linux-gnu/4.2.1/../../../../include/c++/4.2.1/ext/atomicity.h:51: undefined reference to `__sync_fetch_and_add_4'
main.o: In function `__exchange_and_add':
/tmp/protobuf-2.4.0a/src/google/protobuf/compiler/main.cc:60: undefined reference to `__sync_fetch_and_add_4'
/tmp/protobuf-2.4.0a/src/google/protobuf/compiler/main.cc:60: undefined reference to `__sync_fetch_and_add_4'
/tmp/protobuf-2.4.0a/src/google/protobuf/compiler/main.cc:60: undefined reference to `__sync_fetch_and_add_4'
/tmp/protobuf-2.4.0a/src/google/protobuf/compiler/main.cc:60: undefined reference to `__sync_fetch_and_add_4'
main.o:/tmp/protobuf-2.4.0a/src/google/protobuf/compiler/main.cc:60: more undefined references to `__sync_fetch_and_add_4' follow
collect2: ld returned 1 exit status

I always have a hard time understanding C/C++ errors. Varies fiddling with -march flags, as suggested in various places, didn’t help.

However, copying the required files from my Ubuntu machine did. While I’m fortunate that my Synology box is using an x86 processor, I really only copied Python files, so this should be architecture independent. I’m also using Python 2.6 here, on both sides. So, with ddar and protobuf 2.3.0 installed on the Desktop, I did:

  1. On the NAS, extracted the ddar source package into $DDAR.
  2. Copied the protobuf Python package to the NAS (/usr/lib/pymodules/python2.6/google for me), into /opt/local/lib/python2.6/site-packages.
  3. Copied the ddar_pb2.py file to the NAS ( /usr/lib/pymodules/python2.6/synctus/ddar_pb2.py on my machine), into the $DDAR/synctus directory, alongside ddar.proto.
  4. On the NAS, edited $DDAR/setup.py and removed install_requires option that declares the protobuf dependency.
  5. On the NAS, python2.6 setup.py install installs a working ddar copy.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s