Perl programmer for hire: download my resume (PDF).
John Bokma's Hacking & Hiking

VirtualBox shared folder makes cmake_symlink_library fail

June 20, 2017

In the morning I decided to do some work on my Markdown-to-site project, a project that will eventually generate this website. At this early stage the project required me to install the Perl module CommonMark:

$ cpanm CommonMark
--> Working on CommonMark
Fetching http://www.cpan.org/authors/id/N/NW/NWELLNHOF/CommonMark-0.240100.tar.g
z ... OK
Configuring CommonMark-0.240100 ... N/A
! Configure failed for CommonMark-0.240100. See /home/john/.cpanm/work/149796912
4.7545/build.log for details.

The log contains the following line, explaining the reason of failure:

libcmark 0.21.0 or higher not found at Makefile.PL line 16.

Next, as I am developing on Ubuntu 17.04, I tried to install libghc-cmark-dev:

sudo apt-get install libghc-cmark-dev

But this did not solve the issue. I am not sure why not, but decided to just build the required library from source. Also because the version that comes with Ubuntu 17.04 might already be outdated.

So I cloned the CommonMark parsing and rendering library repository as follows.

git clone https://github.com/jgm/cmark.git

As make complained that cmake could not be found I installed this program as follows:

sudo apt-get install cmake

And another speed bump was hit: the make process failed unexpectedly. Output edited for brevity follows:

$ make
mkdir -p build; \
cd build; \
cmake .. \
	-G "Unix Makefiles" \
	-DCMAKE_BUILD_TYPE= \
	-DCMAKE_INSTALL_PREFIX=/usr/local \
	-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
:
:
[ 64%] Linking C shared library libcmark.so
CMake Error: cmake_symlink_library: System Error: Read-only file system
src/CMakeFiles/libcmark.dir/build.make:562: recipe for target 'src/libcmark.so.0
.27.1' failed
make[3]: *** [src/libcmark.so.0.27.1] Error 1
make[3]: *** Deleting file 'src/libcmark.so.0.27.1'
:
:
Makefile:32: recipe for target 'cmake_build' failed
make: *** [cmake_build] Error 2

A Google search for "CMake Error: cmake_symlink_library: System Error: Read-only file system" (without the quotes) gave as a first result: 0015837: cmake_symlink_library fails on shared folders in Virtualbox with linux vm and linux host - MantisBT which made clear that this error has to do with me using a VirtualBox Shared folder. Hence, the solution was as easy as moving the cmark directory out of the mounted directory and running:

make
make test
sudo make install

After these three commands I could install the CommonMark distribution without any problem:

$ cpanm CommonMark
--> Working on CommonMark
Fetching http://www.cpan.org/authors/id/N/NW/NWELLNHOF/CommonMark-0.240100.tar.g
z ... OK
Configuring CommonMark-0.240100 ... OK
Building and testing CommonMark-0.240100 ... OK
Successfully installed CommonMark-0.240100
1 distribution installed