gjtorikian / commonmarker

Ruby wrapper for the comrak (CommonMark parser) Rust crate
MIT License
418 stars 81 forks source link

libcmark is missing #13

Closed yazinsai closed 8 years ago

yazinsai commented 8 years ago

Tried installing this on my Mac OSX Mavericks Yosemite 10.10.4 using gem install commonmarker and got the following error:

Fetching gem metadata from https://rubygems.org/.............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
...
Installing commonmarker 0.4.0 with native extensions

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for cmake... yes
-- The C compiler identification is AppleClang 6.1.0.6020053
-- The CXX compiler identification is AppleClang 6.1.0.6020053
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE_FLAG_ADDRESS_SANITIZER
-- Performing Test HAVE_FLAG_ADDRESS_SANITIZER - Failed
-- Performing Test HAVE_FLAG_SANITIZE_ADDRESS
-- Performing Test HAVE_FLAG_SANITIZE_ADDRESS - Failed
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- Looking for stdbool.h
-- Looking for stdbool.h - found
-- Performing Test HAVE___BUILTIN_EXPECT
-- Performing Test HAVE___BUILTIN_EXPECT - Success
-- Performing Test HAVE___ATTRIBUTE__
-- Performing Test HAVE___ATTRIBUTE__ - Success
-- Found PythonInterp: /usr/local/bin/python3 (found suitable version "3.4.3", minimum required is "3") 
-- Configuring done
-- Generating done
-- Build files have been written to: /private/var/folders/18/1prfmx4x4llbpwfl9t_zkfk8506v1t/T/bundler20150826-69417-1vibvg3commonmarker-0.4.0/gems/commonmarker-0.4.0/ext/commonmarker/cmark/build
Scanning dependencies of target libcmark_static
[  5%] Building C object src/CMakeFiles/libcmark_static.dir/cmark.c.o
[ 10%] Building C object src/CMakeFiles/libcmark_static.dir/node.c.o
[ 15%] Building C object src/CMakeFiles/libcmark_static.dir/iterator.c.o
[ 21%] Building C object src/CMakeFiles/libcmark_static.dir/blocks.c.o
[ 26%] Building C object src/CMakeFiles/libcmark_static.dir/inlines.c.o
[ 31%] Building C object src/CMakeFiles/libcmark_static.dir/scanners.c.o
[ 36%] Building C object src/CMakeFiles/libcmark_static.dir/utf8.c.o
[ 42%] Building C object src/CMakeFiles/libcmark_static.dir/buffer.c.o
[ 47%] Building C object src/CMakeFiles/libcmark_static.dir/references.c.o
[ 52%] Building C object src/CMakeFiles/libcmark_static.dir/render.c.o
[ 57%] Building C object src/CMakeFiles/libcmark_static.dir/man.c.o
[ 63%] Building C object src/CMakeFiles/libcmark_static.dir/xml.c.o
[ 68%] Building C object src/CMakeFiles/libcmark_static.dir/html.c.o
[ 73%] Building C object src/CMakeFiles/libcmark_static.dir/commonmark.c.o
[ 78%] Building C object src/CMakeFiles/libcmark_static.dir/latex.c.o
[ 84%] Building C object src/CMakeFiles/libcmark_static.dir/houdini_href_e.c.o
[ 89%] Building C object src/CMakeFiles/libcmark_static.dir/houdini_html_e.c.o
[ 94%] Building C object src/CMakeFiles/libcmark_static.dir/houdini_html_u.c.o
[100%] Building C object src/CMakeFiles/libcmark_static.dir/cmark_ctype.c.o
Linking C static library libcmark.a
[100%] Built target libcmark_static
checking for cmark_parse_document() in -lcmark... no
libcmark is missing.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
    --with-cmark-dir
    --without-cmark-dir
    --with-cmark-include
    --without-cmark-include=${cmark-dir}/include
    --with-cmark-lib
    --without-cmark-lib=${cmark-dir}/
    --with-cmarklib
    --without-cmarklib

Gem files will remain installed in /var/folders/18/1prfmx4x4llbpwfl9t_zkfk8506v1t/T/bundler20150826-69417-1vibvg3commonmarker-0.4.0/gems/commonmarker-0.4.0 for inspection.
Results logged to /var/folders/18/1prfmx4x4llbpwfl9t_zkfk8506v1t/T/bundler20150826-69417-1vibvg3commonmarker-0.4.0/gems/commonmarker-0.4.0/ext/commonmarker/gem_make.out
An error occurred while installing commonmarker (0.4.0), and Bundler cannot continue.
Make sure that `gem install commonmarker -v '0.4.0'` succeeds before bundling.

Problem there seems to be a missing libcmark library. How do I get that?

gjtorikian commented 8 years ago

That's odd. libcmark is part of the repository's submodule.

I'm on Yosemite, unfortunately, and it works here. The lines from your output which are strange to me are:

Linking C static library libcmark.a
[100%] Built target libcmark_static
checking for cmark_parse_document() in -lcmark... no
libcmark is missing.

So, it built libcmark_static, but it couldn't find it locally (the error message comes from here).

It's a bit late at night for me right now (almost midnight!) so I don't have a readily available answer. I'll try to do some research this week to figure out what went wrong.

yazinsai commented 8 years ago

Whoops, sorry I'm using Yosemite 10.10.4 too. Thanks

gjtorikian commented 8 years ago

Okay, I figured out the problem based on your log output, and pushed a new release at 0.4.1 that should fix this. (I tested it locally, too.)

One line that stuck out to me in your output was

--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby

This meant that you were using Yosemite's default installed Ruby. I switched my Ruby version to use OS X's and could reproduce the error you saw. I made a tiny change to get around whatever limitation Yosemite's default Ruby has.

As some advice, I would suggest not using OS X's default Ruby. Apple has mucked around with it to support some of their own requirements, and the system Ruby can be a bit broken (albeit far less now than before). There are several articles advising against it, but this one provides a nice summary, and includes ways to install newer, "cleaner" Ruby versions. (I personally use rbenv.) Hope this helps!

yazinsai commented 8 years ago

you rock! thank you so much :+1:

ShalbafZadeh commented 8 years ago

hi guys this issue happened again to me on OSX Yosemite 10.10.5 when i tried to install version 0.7.0 of common marker

ERROR: Error installing commonmarker:
 ERROR: Failed to build gem native extension.

    /Users/mehdizyadi/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20160307-13769-2o4cmm.rb extconf.rb
checking for cmake... yes
-- The C compiler identification is AppleClang 6.0.0.6000057
-- The CXX compiler identification is AppleClang 6.0.0.6000057
-- Check for working C compiler: /Applications/Xcode 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- broken
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.4/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "/Applications/Xcode
  2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc" is
  not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /Users/mehdizyadi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/commonmarker-0.7.0/ext/commonmarker/cmark/build/CMakeFiles/CMakeTmp

  Run Build Command:"/usr/bin/make" "cmTC_9c12f/fast"

  /Applications/Xcode 2.app/Contents/Developer/usr/bin/make -f
  CMakeFiles/cmTC_9c12f.dir/build.make CMakeFiles/cmTC_9c12f.dir/build

  make: /Applications/Xcode: No such file or directory

  make: *** [cmTC_9c12f/fast] Error 1

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)

-- Configuring incomplete, errors occurred!
See also "/Users/mehdizyadi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/commonmarker-0.7.0/ext/commonmarker/cmark/build/CMakeFiles/CMakeOutput.log".
See also "/Users/mehdizyadi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/commonmarker-0.7.0/ext/commonmarker/cmark/build/CMakeFiles/CMakeError.log".
make: *** No rule to make target `libcmark_static'. Stop.
checking for cmark_parse_document() in -lcmark... no
libcmark is missing.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
 --with-opt-dir
 --without-opt-dir
 --with-opt-include
 --without-opt-include=${opt-dir}/include
 --with-opt-lib
 --without-opt-lib=${opt-dir}/lib
 --with-make-prog
 --without-make-prog
 --srcdir=.
 --curdir
 --ruby=/Users/mehdizyadi/.rbenv/versions/2.2.3/bin/$(RUBY_BASE_NAME)
 --with-cmark-dir
 --without-cmark-dir
 --with-cmark-include
 --without-cmark-include=${cmark-dir}/include
 --with-cmark-lib
 --without-cmark-lib=${cmark-dir}/lib
 --with-cmarklib
 --without-cmarklib

extconf failed, exit code 1

Gem files will remain installed in /Users/mehdizyadi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/commonmarker-0.7.0 for inspection.
Results logged to /Users/mehdizyadi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/commonmarker-0.7.0/gem_make.out
 ```ERROR: Error installing commonmarker:
 ERROR: Failed to build gem native extension.

    /Users/mehdizyadi/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20160307-13769-2o4cmm.rb extconf.rb
checking for cmake... yes
-- The C compiler identification is AppleClang 6.0.0.6000057
-- The CXX compiler identification is AppleClang 6.0.0.6000057
-- Check for working C compiler: /Applications/Xcode 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- broken
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.4/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "/Applications/Xcode
  2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc" is
  not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /Users/mehdizyadi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/commonmarker-0.7.0/ext/commonmarker/cmark/build/CMakeFiles/CMakeTmp

  Run Build Command:"/usr/bin/make" "cmTC_9c12f/fast"

  /Applications/Xcode 2.app/Contents/Developer/usr/bin/make -f
  CMakeFiles/cmTC_9c12f.dir/build.make CMakeFiles/cmTC_9c12f.dir/build

  make: /Applications/Xcode: No such file or directory

  make: *** [cmTC_9c12f/fast] Error 1

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)

-- Configuring incomplete, errors occurred!
See also "/Users/mehdizyadi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/commonmarker-0.7.0/ext/commonmarker/cmark/build/CMakeFiles/CMakeOutput.log".
See also "/Users/mehdizyadi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/commonmarker-0.7.0/ext/commonmarker/cmark/build/CMakeFiles/CMakeError.log".
make: *** No rule to make target `libcmark_static'. Stop.
checking for cmark_parse_document() in -lcmark... no
libcmark is missing.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
 --with-opt-dir
 --without-opt-dir
 --with-opt-include
 --without-opt-include=${opt-dir}/include
 --with-opt-lib
 --without-opt-lib=${opt-dir}/lib
 --with-make-prog
 --without-make-prog
 --srcdir=.
 --curdir
 --ruby=/Users/mehdizyadi/.rbenv/versions/2.2.3/bin/$(RUBY_BASE_NAME)
 --with-cmark-dir
 --without-cmark-dir
 --with-cmark-include
 --without-cmark-include=${cmark-dir}/include
 --with-cmark-lib
 --without-cmark-lib=${cmark-dir}/lib
 --with-cmarklib
 --without-cmarklib

extconf failed, exit code 1

Gem files will remain installed in /Users/mehdizyadi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/commonmarker-0.7.0 for inspection.
Results logged to /Users/mehdizyadi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/commonmarker-0.7.0/gem_make.out

cmake is installed (3.4.3)

gjtorikian commented 8 years ago

cmake is installed, sure, but I see a lot of errors around XCode. The one that stands out is

  The C compiler "/Applications/Xcode
  2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc" is
  not able to compile a simple test program.

I'm not sure what XCode 2 is, but it seems to be your default installer and can't be found:

make: /Applications/Xcode: No such file or directory