Complete linux novice here! :)

I'm trying to get my brilliant DS209 NAS box to do some transcoding for me of a few AVI videos to a format suitable for my Apply iTouch - yes I could do it with another machine and Handbrake but it would be really useful to offload some of this to the NAS to do overnight.

I've managed to install ipkg onto my DS209 NAS box and have played around with installing some packages (binutils, mono, bash etc).

I've even managed to install ffmpeg from ipkg and put together the correct command line profile to do the encoding as a .sh file:

time ffmpeg -y -i $1 -f mp4 -title $2 -vcodec libx264 -level 21 -s 426×320 -b 512k -bt 512k -bufsize 4M -maxrate 4M -g 250 -coder 0 -threads 0 -acodec libfaac -ac 2 -ab 64k $3

However running this I get a missing dependency on libx264.

I've tried building this from the latest source in git, but I get errors during the make process that I just don't understand (way out of my depth).

encoder/set.c: In function 'x264_sei_version_write':
encoder/set.c:491: error: 'X264_VERSION' undeclared (first use in this function)
encoder/set.c:491: error: (Each undeclared identifier is reported only once
encoder/set.c:491: error: for each function it appears in.)
make: *** [encoder/set.o] Error 1

Can anyone else try building it or give me a pointer as to what I can do to get this going? Its been a good learning experience so far!


UPDATE: In response to questions below, this is the error that I'm now stuck on:

gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/mc.o common/mc.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/predict.o common/predict.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/pixel.o common/pixel.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/macroblock.o common/macroblock.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/frame.o common/frame.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/dct.o common/dct.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/cpu.o common/cpu.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/cabac.o common/cabac.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/common.o common/common.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/mdate.o common/mdate.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/rectangle.o common/rectangle.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/set.o common/set.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/quant.o common/quant.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/deblock.o common/deblock.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/vlc.o common/vlc.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/mvpred.o common/mvpred.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/bitstream.o common/bitstream.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/analyse.o encoder/analyse.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/me.o encoder/me.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/ratecontrol.o     encoder/ratecontrol.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/set.o encoder/set.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/macroblock.o encoder/macroblock.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/cabac.o encoder/cabac.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/cavlc.o encoder/cavlc.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/encoder.o encoder/encoder.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/lookahead.o encoder/lookahead.c
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/arm/mc-c.o common/arm/mc-c.c
common/arm/mc-c.c: In function 'x264_weight_cache_neon':
common/arm/mc-c.c:86: warning: assignment discards qualifiers from pointer target type
common/arm/mc-c.c:91: warning: assignment discards qualifiers from pointer target type
common/arm/mc-c.c:96: warning: assignment discards qualifiers from pointer target type
common/arm/mc-c.c:98: warning: assignment discards qualifiers from pointer target type
common/arm/mc-c.c: In function 'x264_mc_init_arm':
common/arm/mc-c.c:232: warning: assignment discards qualifiers from pointer target type
common/arm/mc-c.c:233: warning: assignment discards qualifiers from pointer target type
common/arm/mc-c.c:234: warning: assignment discards qualifiers from pointer target type
gcc -Wshadow -O3 -fno-fast-math  -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fPIC -s -fomit-frame-pointer -fno-tree-vectorize   -c -o common/arm/predict-c.o common/arm/predict-c.c
gcc -Wall -I. -std=gnu99 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -c -DPIC -o common/arm/cpu-a.o common/arm/cpu-a.S
gcc: Internal error: Segmentation fault (program as)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make: *** [common/arm/cpu-a.o] Error 1

I don't think I'm missing any libraries and this is using GCC 4.2.3. Any ideas?

  • If you're a n00b I'd strongly recommend installing packages rather than trying to build from source. If you can post what Linux distribution your box is using, I'll add some installation steps here. Jun 16, 2010 at 16:12
  • If there were packages I'd use them - but I'm stuck using ipkg on my DS209 (ARM) and although there are ffmpeg and x264 packages, x264 doesnt seem to be a shared library so ffmpeg cannot use it. Any ideas? Aug 10, 2010 at 11:43
  • I'd appreciate if you specified what you did to get from the error you started with to the one later on where you say "this is where I'm up to now"
    – PandaWood
    Jul 26, 2013 at 12:01
  • I know this is late, but to continue, the last error is fishy because I don't believe our Synology ARM has an FPU, hence "neon" being specified seems like the wrong way to start compiling
    – PandaWood
    Jul 26, 2013 at 13:20

2 Answers 2


Go further back in the log, and I'll suspect that there is a missing header file earlier on.

For instance, a similar problem was found here.

I've got a DS411+, if you want to share how you got as far as you did, I could help debug it with you.

  • I've updated my question with where I've got to - still stuck with GCC 4.2.3 on my DS209 :( Aug 10, 2010 at 11:42

I realize this thread is quite old now, but I just ran into the exact same problem compiling the same file on my Synology DS212j. I was trying to compile handbrake for use on my NAS. I realize this is likely to be horribly slow, but for stuff that I'm in no hurry for, it's an always on low-power computer, so I might as well use it!

I did some poking around and modifying the file, and found that any of the "vsub" or "vadd" instructions seem to cause the assembler (as) to seg fault. I got lost in the ARM world of multiple versions and platforms and didn't really find a good assembly reference for the CPU. I abandoned trying to fix this -- I figured trying to rewrite assembly would be an exercise in futility.

What I ended up doing was adding a line to HandBrake-0.9.5/contrib/x264/module.defs:

X264.CONFIGURE.extra += --disable-asm

This essentially adds the --disable-asm to the ./configure line for the x264 library. After this, building libx264 worked.

As I proceeded building handbrake, I needed to install various other ipkg modules. Most of these could be fairly easily figured out by looking at the errors or googling the errors.

Lastly, I had to disable the build of the GUI, since this obviously won't work on the NAS. To do this, I commented out this line in HandBrake-0.9.5/make/include/main.defs:

MODULES += gtk

Now I am successfully running HandBrakeCLI on my Synology DS212j NAS. It is in fact very slow. I'm sure by disabling the assembly code, it is even slower, but it's faster than if it hadn't been built at all.

My first task was to shrink a full Blu-Ray rip down to 800x480. I imagine processing a full Blu-Ray rip would be about as demanding as it might get. With this job, it processes a little under a frame per second. So over 1 day per hour of processed video.

The extra things that I can remember I had to do to get HandBrake to compile: 1. ipkg install perl-xml-parser 2. ipkg install yasm 3. Download and compile intltool (I build intltool-0.40.6) 4. If you install intltool to a non-standard location, add the share/aclocal directory to /opt/share/aclocal/dirlist file (just create a file with one line in it): /your_install_prefix/share/aclocal

I know there were some other things, but I can't forget. If anyone tries to do this, I'd be happy to help if you encouter a problem. I probably encountered it too, so seeing a particular error might trigger my memory.

  • This is useful, though do note: handbrake does not do "passthrough". So if you want extract video files out of an .mkv, for example, handbrake forces you to re-encode - it can't simply extract the video stream. This is why Handbrake is not a solution for me, at all, I'm afraid. And why getting ffmpeg working is still required.
    – PandaWood
    Jul 26, 2013 at 12:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.