CLJS compilation error with Closure lib dependency on Windows

Description

I encountered this error while developing a cljs project that included openlayers lib in its deps.
Open layers is a Closure library and I used the latest version 3.15.1.

The error that compiler reports is:
java.io.IOException: The filename, directory name, or volume label syntax is incorrect

I have recreated the minimal scenario, the one like on ClojureScript Quick start guide.
Steps to reproduce the problem (basically like the quick start):

  • Download standalone cljs jar from the link in the guide

  • Create the same build.cljs file as defined on the guide

  • Download openlayers-3.15.1.jar and place it in the root

  • Add require statement in core.cljs - (ns hello-world.core (:require ol.Map)) for example

  • Than in cmd run java -cp "cljs.jar;openlayers-3.15.1.jar;src" clojure.main build.clj

I have also tested with cljs master branch (created an uberjar and tested again) and i get the same error.

Attached is the example stacktrace (in that run I added :verbose true to get the 'Copying...' output).

Environment

Tested on Windows 10 with java 8 and on windows 7 with java 7 and java 8.
Clojure version is 1.8.0 on both systems.

Activity

Show:
David Nolen
December 16, 2016, 8:02 PM

The suggested fix isn't desirable as far as I can tell since we have a branch specifically for dealing with Closure libs that will be avoided. We need a better explanation.

Dejan Josifović
February 3, 2017, 12:54 PM

Hi all,

the problem occurred only for Closure libraries compilation (such as openlayers).
As already commented, it manifested on both Win and Linux, but on Linux it did not
cause problems.

The problem was in the function that produced relative output paths for deps (lib-rel-path).
It tried to remove the first part of the absolute path with clojure.string/replace, but
it tried it with a wrong match (it did not reproduce the actual first part of the path)
so it effectively did nothing.

Example:
(str (io/file (System/getProperty "user.dir") lib-path) File/separator)
produced
file:\C:\Users****\Documents\Projects\openlayers-cljs-compile-error-repo\cljsjs\openlayers\development\ instead of
file:\C:\Users****\Documents\Projects\openlayers-cljs-compile-error-repo\openlayers-3.15.1.jar!\cljsjs\openlayers\development\
Attached patch produces better paths that work on both OS.
Can someone check if it is an okay solution?
I have tested it of course on both OS, run CLJS tests etc.

Thanks,
Dejan.

Dejan Josifović
February 3, 2017, 2:23 PM

This is the correct patch - first one contained an error.

Shaun Mahood
March 1, 2017, 10:17 PM

I've tested the newest patch on Windows 10/Java 8 and Mac OSX 10.11.6/Java 8, using the quickstart compile method with both :none and :advanced.
It fixes the compilation issue on Windows and will compile both openlayers and libphonenumber (both are Google Closure libraries, I used the JAR files from CLJSJS to compile them). The folder structure also looks much better and doesn't have the user path embedded anymore.

David Nolen
March 10, 2017, 7:28 PM

Assignee

Unassigned

Reporter

Dejan Josifović

Labels

Approval

None

Patch

None

Affects versions

Priority

Minor
Configure