Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid option `--js-lib-src=jsbits/animationFrame.js' #112

Open
nomeata opened this issue Jul 18, 2018 · 9 comments
Open

Invalid option `--js-lib-src=jsbits/animationFrame.js' #112

nomeata opened this issue Jul 18, 2018 · 9 comments

Comments

@nomeata
Copy link

nomeata commented Jul 18, 2018

I am building ghcjs-base as part of my dependencies. This worked a few weeks ago, but I am unsure what changed:

/tmp/ghcjs-bsae $ cabal new-build --ghcjs -w ghcjs  --with-hc-pkg=ghcjs-pkg --disable-tests --constraint='primitive < 0.6.4.0' .
Warning: don't know how to find change monitoring files for the installed
package databases for ghcjs
Resolving dependencies...
Build profile: -w ghcjs-8.2.0.1 -O1
In order, the following will be built (use -v for more details):
 - ghcjs-base-0.2.0.0 (lib) (first run)
Configuring library for ghcjs-base-0.2.0.0..
Preprocessing library for ghcjs-base-0.2.0.0..
Building library for ghcjs-base-0.2.0.0..
Invalid option `--js-lib-src=jsbits/animationFrame.js'

Usage: ghcjs [--native-executables] [--native-too] [--build-runner]
             [--no-js-executables] [--strip-program ARG] [--log-commandline ARG]
             [--with-ghc ARG] [--only-out] [--no-rts] [--no-stats]
             [--generate-base ARG] [--use-base ARG] [--link-js-lib ARG]
             [--js-lib-outputdir ARG] [--js-lib-src ARG] [--dedupe]

I did upgrade Cabal, maybe that is the problem?

@nomeata
Copy link
Author

nomeata commented Jul 18, 2018

The full command line used by cabal is

/home/jojo/.bin/ghcjs --make -fbuilding-cabal-package -O -outputdir dist/build -odir dist/build -hidir dist/build -stubdir dist/build -i -idist/build -i. -idist/build/autogen -idist/build/global-autogen -Idist/build/autogen -Idist/build/global-autogen -Idist/build -optP-include -optPdist/build/autogen/cabal_macros.h -this-unit-id ghcjs-base-0.2.0.0-Chx6hiqlECh5yDTDWV6kCx -hide-all-packages -Wmissing-home-modules -package-db dist/package.conf.inplace -package-id aeson-1.2.4.0-8rr3JoktyIVFODZ83s6EMA -package-id attoparsec-0.13.2.2-IwmoG0Z0sz05uD4WkrNPYY -package-id base-4.10.1.0-DuxFDcnl7HKKK3wxhYafB1 -package-id binary-0.8.5.1-ALzO2BWjAPP5HK6rDyM5Ez -package-id bytestring-0.10.8.2-JNdgga9938ECdWPoxsaK2A -package-id containers-0.5.10.2-9DI272UIy6s2SQuD3F70c5 -package-id deepseq-1.4.3.0-CGHPJ73R5W952UnsBn6B8R -package-id dlist-0.8.0.4-Apa5X8l1Si9FM3rq0pbapP -package-id ghc-prim-0.5.1.1-7UiAmegvHVuFzwVDFOv8fE -package-id ghcjs-prim-0.1.1.0-Lw1qzAJ9IR31NFzWC6t27Z -package-id hashable-1.2.7.0-7tF1WXjNQZsIkvWKC7rAuB -package-id integer-gmp-1.0.1.0-ESU36R2qYi71eTQfsks4mM -package-id primitive-0.6.3.0-GbuQhnztW5PCPmWJIeDzH1 -package-id scientific-0.3.6.2-21kmRPIBSyP99lZm9bNJNa -package-id text-1.2.3.0-4mOERTuj4vO2yKqXmj0fXe -package-id time-1.8.0.2-Lf3cI0N6xjD8pQyNwoRaJx -package-id transformers-0.5.2.0-HtEf5nV5vOXJgl7pipqNkj -package-id unordered-containers-0.2.9.0-HJfewgjc84ZFfp3JMhlhEI -package-id vector-0.12.0.1-IA4IqzdJXK64EGCQdyOe4S -XHaskell98 Data.JSString Data.JSString.Int Data.JSString.Raw Data.JSString.Read Data.JSString.RealFloat Data.JSString.RegExp Data.JSString.Internal Data.JSString.Text Data.JSString.Internal.Fusion Data.JSString.Internal.Fusion.Types Data.JSString.Internal.Fusion.Common Data.JSString.Internal.Fusion.CaseMapping Data.JSString.Internal.Search GHCJS.Buffer GHCJS.Buffer.Types GHCJS.Concurrent GHCJS.Foreign GHCJS.Foreign.Callback GHCJS.Foreign.Callback.Internal GHCJS.Foreign.Export GHCJS.Foreign.Internal GHCJS.Marshal GHCJS.Marshal.Internal GHCJS.Marshal.Pure GHCJS.Nullable GHCJS.Types JavaScript.Array JavaScript.Array.Internal JavaScript.Array.ST JavaScript.Cast JavaScript.JSON JavaScript.JSON.Types JavaScript.JSON.Types.Class JavaScript.JSON.Types.Generic JavaScript.JSON.Types.Instances JavaScript.JSON.Types.Internal JavaScript.Number JavaScript.Object JavaScript.Object.Internal JavaScript.RegExp JavaScript.TypedArray JavaScript.TypedArray.ArrayBuffer JavaScript.TypedArray.ArrayBuffer.ST JavaScript.TypedArray.DataView JavaScript.TypedArray.DataView.ST JavaScript.TypedArray.Internal JavaScript.TypedArray.ST JavaScript.Web.AnimationFrame JavaScript.Web.Blob JavaScript.Web.Blob.Internal JavaScript.Web.Canvas JavaScript.Web.Canvas.ImageData JavaScript.Web.Canvas.Internal JavaScript.Web.Canvas.TextMetrics JavaScript.Web.CloseEvent JavaScript.Web.CloseEvent.Internal JavaScript.Web.ErrorEvent JavaScript.Web.ErrorEvent.Internal JavaScript.Web.File JavaScript.Web.History JavaScript.Web.Location JavaScript.Web.MessageEvent JavaScript.Web.MessageEvent.Internal JavaScript.Web.Performance JavaScript.Web.Storage JavaScript.Web.Storage.Internal JavaScript.Web.StorageEvent JavaScript.Web.XMLHttpRequest JavaScript.Web.WebSocket JavaScript.Web.Worker GHCJS.Internal.Types Data.JSString.Internal.Type JavaScript.TypedArray.Internal.Types JavaScript.TypedArray.ArrayBuffer.Internal JavaScript.TypedArray.DataView.Internal -O -link-js-lib HSghcjs-base-0.2.0.0-Chx6hiqlECh5yDTDWV6kCx -js-lib-outputdir dist/build -js-lib-src jsbits/array.js -js-lib-src jsbits/animationFrame.js -js-lib-src jsbits/export.js -js-lib-src jsbits/jsstring.js -js-lib-src jsbits/jsstringRaw.js -js-lib-src jsbits/foreign.js -js-lib-src jsbits/text.js -js-lib-src jsbits/utils.js -js-lib-src jsbits/xhr.js -js-lib-src jsbits/websocket.js

@hvr
Copy link

hvr commented Jul 18, 2018

I just ran into the very same issue... :-)

It's confusing that the flag passed to ghcjs is

 -js-lib-src jsbits/animationFrame.js

while the error reads

 Invalid option `--js-lib-src=jsbits/animationFrame.js'

Also, ghcjs --show-options doesn't mention any *js-lib-src flag

@nomeata
Copy link
Author

nomeata commented Jul 18, 2018

Reverting cabal back to fb67b25e1 (where, I believe, this once worked) does not fix the problem.

@nomeata
Copy link
Author

nomeata commented Jul 18, 2018

I am very confused. It worked here:
https://travis-ci.org/nomeata/ghcjs2gh-pages/jobs/396137070
with the command line

git clone https://github.com/ghcjs/ghcjs-base &&
cabal install -j1 --ghcjs --constraint="primitive < 0.6.4.0" ./ghcjs-base

@nomeata
Copy link
Author

nomeata commented Jul 18, 2018

Ok, it must be cabal-version related: It works with cabal-install version 1.24.0.2.

@nomeata
Copy link
Author

nomeata commented Jul 18, 2018

And this is the command line used by that version:

/home/jojo/.bin/ghcjs --make -fbuilding-cabal-package -O -outputdir dist/build -odir dist/build -hidir dist/build -stubdir dist/build -i -idist/build -i. -idist/build/autogen -Idist/build/autogen -Idist/build -optP-include -optPdist/build/autogen/cabal_macros.h -this-unit-id ghcjs-base-0.2.0.0-Jc0aIT6eCKZKCotXi2iKdR -hide-all-packages -package-db dist/package.conf.inplace -package-id aeson-1.2.4.0-8rr3JoktyIVFODZ83s6EMA -package-id attoparsec-0.13.2.2-IwmoG0Z0sz05uD4WkrNPYY -package-id base-4.10.1.0-DuxFDcnl7HKKK3wxhYafB1 -package-id binary-0.8.5.1-ALzO2BWjAPP5HK6rDyM5Ez -package-id bytestring-0.10.8.2-JNdgga9938ECdWPoxsaK2A -package-id containers-0.5.10.2-9DI272UIy6s2SQuD3F70c5 -package-id deepseq-1.4.3.0-CGHPJ73R5W952UnsBn6B8R -package-id dlist-0.8.0.4-Apa5X8l1Si9FM3rq0pbapP -package-id ghc-prim-0.5.1.1-7UiAmegvHVuFzwVDFOv8fE -package-id ghcjs-prim-0.1.1.0-Lw1qzAJ9IR31NFzWC6t27Z -package-id hashable-1.2.7.0-7tF1WXjNQZsIkvWKC7rAuB -package-id integer-gmp-1.0.1.0-ESU36R2qYi71eTQfsks4mM -package-id primitive-0.6.3.0-GbuQhnztW5PCPmWJIeDzH1 -package-id scientific-0.3.6.2-21kmRPIBSyP99lZm9bNJNa -package-id text-1.2.3.0-4mOERTuj4vO2yKqXmj0fXe -package-id time-1.8.0.2-Lf3cI0N6xjD8pQyNwoRaJx -package-id transformers-0.5.2.0-HtEf5nV5vOXJgl7pipqNkj -package-id unordered-containers-0.2.9.0-HJfewgjc84ZFfp3JMhlhEI -package-id vector-0.12.0.1-IA4IqzdJXK64EGCQdyOe4S -XHaskell98 Data.JSString Data.JSString.Int Data.JSString.Raw Data.JSString.Read Data.JSString.RealFloat Data.JSString.RegExp Data.JSString.Internal Data.JSString.Text Data.JSString.Internal.Fusion Data.JSString.Internal.Fusion.Types Data.JSString.Internal.Fusion.Common Data.JSString.Internal.Fusion.CaseMapping Data.JSString.Internal.Search GHCJS.Buffer GHCJS.Buffer.Types GHCJS.Concurrent GHCJS.Foreign GHCJS.Foreign.Callback GHCJS.Foreign.Callback.Internal GHCJS.Foreign.Export GHCJS.Foreign.Internal GHCJS.Marshal GHCJS.Marshal.Internal GHCJS.Marshal.Pure GHCJS.Nullable GHCJS.Types JavaScript.Array JavaScript.Array.Internal JavaScript.Array.ST JavaScript.Cast JavaScript.JSON JavaScript.JSON.Types JavaScript.JSON.Types.Class JavaScript.JSON.Types.Generic JavaScript.JSON.Types.Instances JavaScript.JSON.Types.Internal JavaScript.Number JavaScript.Object JavaScript.Object.Internal JavaScript.RegExp JavaScript.TypedArray JavaScript.TypedArray.ArrayBuffer JavaScript.TypedArray.ArrayBuffer.ST JavaScript.TypedArray.DataView JavaScript.TypedArray.DataView.ST JavaScript.TypedArray.Internal JavaScript.TypedArray.ST JavaScript.Web.AnimationFrame JavaScript.Web.Blob JavaScript.Web.Blob.Internal JavaScript.Web.Canvas JavaScript.Web.Canvas.ImageData JavaScript.Web.Canvas.Internal JavaScript.Web.Canvas.TextMetrics JavaScript.Web.CloseEvent JavaScript.Web.CloseEvent.Internal JavaScript.Web.ErrorEvent JavaScript.Web.ErrorEvent.Internal JavaScript.Web.File JavaScript.Web.History JavaScript.Web.Location JavaScript.Web.MessageEvent JavaScript.Web.MessageEvent.Internal JavaScript.Web.Performance JavaScript.Web.Storage JavaScript.Web.Storage.Internal JavaScript.Web.StorageEvent JavaScript.Web.XMLHttpRequest JavaScript.Web.WebSocket JavaScript.Web.Worker GHCJS.Internal.Types Data.JSString.Internal.Type JavaScript.TypedArray.Internal.Types JavaScript.TypedArray.ArrayBuffer.Internal JavaScript.TypedArray.DataView.Internal -O -link-js-lib HSghcjs-base-0.2.0.0-Jc0aIT6eCKZKCotXi2iKdR -js-lib-outputdir dist/build jsbits/array.js jsbits/animationFrame.js jsbits/export.js jsbits/jsstring.js jsbits/jsstringRaw.js jsbits/foreign.js jsbits/text.js jsbits/utils.js jsbits/xhr.js -js-lib-src jsbits/websocket.js

where oddly the -js-lib-src flag is only passed before the last java script file mentioned.

@nomeata
Copy link
Author

nomeata commented Jul 18, 2018

If I undo haskell/cabal@6148cea selectively by applying this patch:

$ git diff
diff --git a/Cabal/Distribution/Simple/GHCJS.hs b/Cabal/Distribution/Simple/GHCJS.hs
index e043afd3d..d67bf1d69 100644
--- a/Cabal/Distribution/Simple/GHCJS.hs
+++ b/Cabal/Distribution/Simple/GHCJS.hs
@@ -317,7 +317,7 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do
       jsSrcs      = jsSources libBi
       baseOpts    = componentGhcOptions verbosity lbi libBi clbi libTargetDir
       linkJsLibOpts = mempty {
-                        ghcOptExtra =
+                        ghcOptExtra = fromNubListR . toNubListR $
                           [ "-link-js-lib"     , getHSLibraryName uid
                           , "-js-lib-outputdir", libTargetDir ] ++
                           concatMap (\x -> ["-js-lib-src",x]) jsSrcs

then I get the old, “working”, command line and it builds even with the newest Cabal.

But that command line looks so wrong … I guess this is a GHCJS bug that was accidentally worked-around by Cabal, and now uncovered.

@nomeata
Copy link
Author

nomeata commented Jul 18, 2018

Oh, and the error message is lying, because this patch does not work:

index e043afd3d..f16399fd8 100644
--- a/Cabal/Distribution/Simple/GHCJS.hs
+++ b/Cabal/Distribution/Simple/GHCJS.hs
@@ -320,7 +320,7 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do
                         ghcOptExtra =
                           [ "-link-js-lib"     , getHSLibraryName uid
                           , "-js-lib-outputdir", libTargetDir ] ++
-                          concatMap (\x -> ["-js-lib-src",x]) jsSrcs
+                          concatMap (\x -> ["--js-lib-src="++x]) jsSrcs
                       }
       vanillaOptsNoJsLib = baseOpts `mappend` mempty {
                       ghcOptMode         = toFlag GhcModeMake,

oh why.

@nomeata
Copy link
Author

nomeata commented Jul 18, 2018

Ok, it’s a GHCJS bug (reported here: ghcjs/ghcjs#678) and maybe Cabal will want to work around it (reported here: haskell/cabal#5442)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants