vmg / sundown

Standards compliant, fast, secure markdown processing library in C
1.99k stars 385 forks source link

Error when compiling #55

Closed FSX closed 12 years ago

FSX commented 12 years ago

I got an error when compiling Sundown with the suplied makefile:

yui% make
gcc -c -g -O3 -Wall -Werror -Isrc -Ihtml    -c -o src/markdown.o src/markdown.c
gcc -c -g -O3 -Wall -Werror -Isrc -Ihtml    -c -o src/array.o src/array.c
gcc -c -g -O3 -Wall -Werror -Isrc -Ihtml    -c -o src/buffer.o src/buffer.c
gcc -c -g -O3 -Wall -Werror -Isrc -Ihtml    -c -o src/autolink.o src/autolink.c
gcc -c -g -O3 -Wall -Werror -Isrc -Ihtml    -c -o html/html.o html/html.c
gcc -c -g -O3 -Wall -Werror -Isrc -Ihtml    -c -o html/html_smartypants.o html/html_smartypants.c
gcc -g -O3 -Wall -Werror  -shared -Wl src/markdown.o src/array.o src/buffer.o src/autolink.o html/html.o html/html_smartypants.o -o libsundown.so.1
/usr/bin/ld: src/markdown.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
src/markdown.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [libsundown.so.1] Error 1

After adding -fPIC to CFLAGS it works again.

Don't know what caused it. I use a 64-bit Linux.

vmg commented 12 years ago

Hm. Thanks for reporting, I just added the flag to the Makefile. PIC code is always an issue in Linux it seems.