lindenb/makefile2graph

Build failure due to lack of strndup on Mac OS

johnbachman opened this issue · 0 comments

Hi, thanks for this library.

I'm running Mac OS 10.6.8 and wasn't able to build the repo due to the following compilation error:

$ make
cc -O3 -Wall make2graph.c -o make2graph
make2graph.c: In function ‘targetName’:
make2graph.c:137: warning: implicit declaration of function ‘strndup’
make2graph.c:137: warning: incompatible implicit declaration of built-in function ‘strndup’
Undefined symbols:
"_strndup", referenced from:
_targetName in cczR4fIs.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [make2graph] Error 1

As it turns out strndup is not a standard lib function and is not available on Mac OS and other BSDs, see here: https://bitbucket.org/gward/vcprompt/issue/1/compilation-fails-on-macos-1058

Submitting fix as a pull request shortly.