devinus / markdown

A simple Elixir Markdown to HTML conversion library
The Unlicense
87 stars 19 forks source link

(Mix) Could not compile dependency hoedown #11

Open dlcmh opened 9 years ago

dlcmh commented 9 years ago

Faced issue mentioned in the title - please help, thanks!

Machine is MacBook Air running Yosemite.

Elixir 1.0.5 & Erlang/OTP 18 installed.

Added {:markdown, github: "devinus/markdown"} to deps in mix.exs in a Phoenix project.

Ran mix deps.get -> no issues.

Ran mix phoenix.server and mix eps.compile hoedown several times -> here's what appeared:

mix phoenix.server
==> hoedown
cc -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter -Isrc -fPIC -c -o src/autolink.o src/autolink.c
cc -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter -Isrc -fPIC -c -o src/buffer.o src/buffer.c
cc -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter -Isrc -fPIC -c -o src/document.o src/document.c
cc -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter -Isrc -fPIC -c -o src/escape.o src/escape.c
cc -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter -Isrc -fPIC -c -o src/html.o src/html.c
cc -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter -Isrc -fPIC -Wno-static-in-inline -c -o src/html_blocks.o src/html_blocks.c
cc -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter -Isrc -fPIC -c -o src/html_smartypants.o src/html_smartypants.c
cc -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter -Isrc -fPIC -c -o src/stack.o src/stack.c
cc -g -O3 -ansi -pedantic -Wall -Wextra -Wno-unused-parameter -Isrc -fPIC -c -o src/version.o src/version.c
cc -Wl,-soname,libhoedown.so.3 -shared src/autolink.o src/buffer.o src/document.o src/escape.o src/html.o src/html_blocks.o src/html_smartypants.o src/stack.o src/version.o  -o libhoedown.so.3
ld: unknown option: -soname
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libhoedown.so.3] Error 1
==> hello_phoenix
** (Mix) Could not compile dependency hoedown, make command failed. If you want to recompile this dependency, please run: mix deps.compile hoedown
mylaptop:hello_phoenix$ mix deps.compile hoedown
==> hoedown
cc -Wl,-soname,libhoedown.so.3 -shared src/autolink.o src/buffer.o src/document.o src/escape.o src/html.o src/html_blocks.o src/html_smartypants.o src/stack.o src/version.o  -o libhoedown.so.3
ld: unknown option: -soname
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libhoedown.so.3] Error 1
==> hello_phoenix
** (Mix) Could not compile dependency hoedown, make command failed. If you want to recompile this dependency, please run: mix deps.compile hoedown
josevalim commented 9 years ago

I think you need a more recent gcc version. Either install it via homebrew or install Xcode command line tools with xcode-select --install.

devinus commented 9 years ago

@dlcmh Try locking hoedown to tag 3.0.2:

{:hoedown, github: "hoedown/hoedown", tag: "3.0.2", override: true}

and report back

dlcmh commented 9 years ago

@devinus -> same result, I think the issue is with the use of -soname on OS X, as highlighted by the error message ld: unknown option: -soname which I got when I ran mix phoenix.server.

Googling "mac gcc soname install_name" suggests that -install_name is the correct option to use for OS X, instead of -soname -> when I replace -soname in deps/hoedown/Makefile with -install_name and run mix reps.compile hoedown, I get the following warnings, but compilation is successful and I was then able to useMarkdown.to_html in Phoenix controllers:

...

bin/hoedown.c:446:10: warning: comparison of integers of different signs: 'clock_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
                if (t1 == -1 || t2 == -1) {
                    ~~ ^  ~~
bin/hoedown.c:446:22: warning: comparison of integers of different signs: 'clock_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
                if (t1 == -1 || t2 == -1) {
                                ~~ ^  ~~
2 warnings generated.

...