Hi, and welcome to the forum !
I haven't studied dcraw sources, but since it was meant to run on PC's, an unmodified compile
might cause memory problems - CHDK only has 0.2 - 0.5 Mb free memory (depending on cam type),
easily 1000x less than a PC ...
It may be a good idea to take a look at ewavr's RAW -> DNG implementation in CHDK (core/dng.c)
to get an idea of what is possible, memory-wise ...
just my 2c,
wim