Google Blockly `namespace never provided` Error with closure-compiler.jar - google-closure-compiler

I asked at this issue, but I still can't solve a problem. I get error like required "Blockly" namespace never provided .
I follow Google bLockly Advanced Compilation tutorial to try. I did not create a new directory in the Blockly root directory to test, but instead used blockly and closure-library as subdirectories (submodules) in project as below :
project
├─blockly
├─closure-library
├─closure-compiler.jar
├─index.html
└─main.js
Then compile files using the commend as below :
java -jar closure-compiler.jar --js='main.js' ^
--js='./blockly/**.js' ^
--js='!./blockly/externs/**.js' ^
--js='!./blockly/msg/messages.js' ^
--js='./closure-library/closure/goog/**.js' ^
--js='./closure-library/third_party/closure/goog/**.js' ^
--generate_exports ^
--externs ./blockly/externs/svg-externs.js ^
--compilation_level ADVANCED_OPTIMIZATIONS ^
--dependency_mode=STRICT --entry_point=Main ^
--js_output_file main_compressed.js
Stack Traces
main.js:3: ERROR - required "Blockly.Msg.en" namespace never provided
goog.require('Blockly.Msg.en');
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
main.js:5: ERROR - required "Blockly" namespace never provided
goog.require('Blockly');
^^^^^^^^^^^^^^^^^^^^^^^
main.js:7: ERROR - required "Blockly.Constants.Logic" namespace never provided
goog.require('Blockly.Constants.Logic');
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
main.js:8: ERROR - required "Blockly.Constants.Loops" namespace never provided
goog.require('Blockly.Constants.Loops');
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
main.js:9: ERROR - required "Blockly.Constants.Math" namespace never provided
goog.require('Blockly.Constants.Math');
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
main.js:10: ERROR - required "Blockly.Constants.Text" namespace never provided
goog.require('Blockly.Constants.Text');
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6 error(s), 0 warning(s)
Operating System
OS: Windows 7
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
Closure Compiler Version: v20180204
P.S. I get same errors even I follow all step in the tutorial (same directory structure as tutorial)

Usually the 'Namespace never provided' error is caused by not passing the file that provides that namespace to the compiler. Your directory layout is perfectly fine, but for the actual command I find it's always better to specify what files you want specifically rather than using the ! operator. I see a lot of people having issues with that. I would try the following:
`java -jar closure-compiler.jar --js='main.js' \
--js='blockly/blocks/**.js' \
--js='blockly/core/**.js' \
--js='blockly/generators/**.js' \
--js='blockly/msg/js/**.js' \
--js='closure-library/closure/goog/**.js' \
--js='closure-library/third_party/closure/goog/**.js' \
--generate_exports \
--externs blockly/externs/svg-externs.js \
--compilation_level ADVANCED_OPTIMIZATIONS \
--dependency_mode=STRICT --entry_point=Main \
--output_manifest manifest.MF
--js_output_file main_compressed.js`
Note that this will allow you see what files are actually being compiled by listing them in manifest.MF.

Related

yocto inherit qmake5 don't work if install directory is not /usr/bin

I have a directory qt project with a application (customqtapp) and two libraries (libprotocustom and libcustom).
I created a simple yocto recipe inherit qmake5.
All works fine if the target install dir is /usr/bin for application and /usr/lib for libraries but don't work if
the target install directories are /usr/local/bin and /usr/local/lib
project.pro
SUBDIRS += \
libprotocustom \
libcustom \
customqtapp
...
libprotocustom.pro
target.path=/usr/local/lib
INSTALL = target
...
libcustom.pro
target.path=/usr/local/lib
INSTALL = target
...
customqtapp.pro
target.path=/usr/local/bin
INSTALL = target
...
customqtapp.bb
SUMMARY = "customqtapp"
SRC_URI = " git:///customqt.git;protocol=file;branch=master "
SRCREV = "master"
S = "${WORKDIR}/git"
inherit qmake5
The error messages was
ERROR: customqtapp-1.0.0-r0 do_package: QA Issue: customqtapp: Files/directories were installed but not shipped in any package:
/usr/local/lib/libprotocustom.so.1.0.0
/usr/local/lib/libprotocustom.so.1.0
/usr/local/lib/libprotocustom.so
/usr/local/lib/libprotocustom.so.1
/usr/local/lib/liblibcustom.so.1.0.0
/usr/local/lib/liblibcustom.so.1
/usr/local/lib/liblibcustom.so
/usr/local/lib/liblibcustom.so.1.0
/usr/local/bin/customqtapp
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
customqtapp: 11 installed and not shipped files. [installed-vs-shipped]
ERROR: customqtapp-1.0.0-r0 do_package: Fatal QA errors found, failing task.
ERROR: Logfile of failure stored in: /home/user/yocto-local/build/tmp/work/cortexa53-crypto-poky-linux/customqtapp/1.0.0-r0/temp/log.do_package.6581
ERROR: Task (/home/user/yocto-local/sources/meta-custom/recipes-custom/customqtapp/customqtapp_1.0.0.bb:do_package) failed with exit code '1'
So I added the files to FILES variable in recipe
FILES_${PN} = "\
/usr/local/sbin \
/usr/local/lib/libprotocustom.so.1.0.0 \
/usr/local/lib/libprotocustom.so.1.0 \
/usr/local/lib/libprotocustom.so \
/usr/local/lib/libprotocustom.so.1 \
/usr/local/lib/liblibcustom.so.1.0.0 \
/usr/local/lib/liblibcustom.so.1 \
/usr/local/lib/liblibcustom.so \
/usr/local/lib/liblibcustom.so.1.0 \
/usr/local/bin/customqtapp \
"
But don't work
ERROR: customqtapp-1.0.0-r0 do_package_qa: QA Issue: non -dev/-dbg/nativesdk- package customqtapp contains symlink .so '/usr/local/lib/libprotocustom.so'
non -dev/-dbg/nativesdk- package customqtapp contains symlink .so '/usr/local/lib/liblibcustom.so' [dev-so]
WARNING: customqtapp-1.0.0-r0 do_package_qa: QA Issue: customqtapp-dbg: found library in wrong location: /usr/local/lib/.debug/libprotocustom.so.1.0.0
customqtapp-dbg: found library in wrong location: /usr/local/lib/.debug/liblibcustom.so.1.0.0
customqtapp: found library in wrong location: /usr/local/lib/libprotocustom.so.1.0.0
customqtapp: found library in wrong location: /usr/local/lib/libprotocustom.so.1.0
customqtapp: found library in wrong location: /usr/local/lib/libprotocustom.so
customqtapp: found library in wrong location: /usr/local/lib/libprotocustom.so.1
customqtapp: found library in wrong location: /usr/local/lib/liblibcustom.so.1.0.0
customqtapp: found library in wrong location: /usr/local/lib/liblibcustom.so.1
customqtapp: found library in wrong location: /usr/local/lib/liblibcustom.so
customqtapp: found library in wrong location: /usr/local/lib/liblibcustom.so.1.0 [libdir]
ERROR: customqtapp-1.0.0-r0 do_package_qa: QA run found fatal errors. Please consider fixing them.
ERROR: Logfile of failure stored in: /home/user/yocto-local/build/tmp/work/cortexa53-crypto-poky-linux/customqtapp/1.0.0-r0/temp/log.do_package_qa.7056
ERROR: Task (/home/user/yocto-local/sources/meta-custom/recipes-custom/customqtapp/customqtapp_1.0.0.bb:do_package_qa) failed with exit code '1'
some ideas?
Thanks in advance.

java.lang.UnsatisfiedLinkError: Invalid URL for class: jar:rsrc:javafx.graphics.jar!/com/sun/glass/utils/NativeLibLoader.class

I'm trying to run an application using the command prompt. It's built in Eclipse, using JavaFx. It's a digital diary program that I've been writing for a while and would like to send it to some friends. It is exported with packaged libraries as a runnable jar file.
I'm using the line
java -jar -Djavafx.verbose=true main.jar --module-path /users/home/javafx-sdk-11.0.2/lib --add-modules javafx.controls,javafx.fxml
to run it.
I've traced the errors (through use of -Djavafx.verbose=true) to java.lang.UnsatisfiedLinkError.
One of them is as follows:
WARNING: java.lang.UnsatisfiedLinkError: Invalid URL for class: jar:rsrc:javafx.graphics.jar!/com/sun/glass/utils/NativeLibLoader.class
What's causing this error?
EDIT after moving the --add-modules before main.jar, I get some new errors.
Exception in thread "main" java.lang.ExceptionInInitializerError
...
Caused by: java.lang.IllegalStateException: This operation is permitted on the event thread only; currentThread = main
...
When specifying arguments for the java virtual machine being run with a -jar command, these arguments need to go before the jar file name in the command line.
Do not use this
It will treat the module arguments as program arguments rather than VM arguments:
java -jar -Djavafx.verbose=true main.jar --module-path /users/home/javafx-sdk-11.0.2/lib --add-modules javafx.controls,javafx.fxml
Instead, use this
java --module-path /users/home/javafx-sdk-11.0.2/lib --add-modules javafx.controls,javafx.fxml -Djavafx.verbose=true -jar main.jar

QT can't build - "Some of the required modules (!win32-g++) are not available"

I pulled down the qtpdf repository to check out and play with from here:
http://code.qt.io/cgit/qt-labs/qtpdf.git
As soon as I open the qtpdf.pro file, I get the following general messages:
Cannot read C:/.../build-qpdf-Desktop_Qt_5_10_0_MinGW_32bit-Debug/src/lib/pdfium.pri: No such file or directory
Cannot read C:/.../build-qpdf-Desktop_Qt_5_10_0_MinGW_32bit-Debug/src/lib/freetype.pri: No such file or directory
Project MESSAGE: perl -w C:\Qt\5.10.0\mingw53_32\bin\syncqt.pl -module QtPdf -version 5.9.0 -outdir "C:/.../build-qpdf-Desktop_Qt_5_10_0_MinGW_32bit-Debug" C:/.../qtpdf
Project MESSAGE: perl -w C:\Qt\5.10.0\mingw53_32\bin\syncqt.pl -module QtPdfWidgets -version 5.9.0 -outdir "C:/.../build-qpdf-Desktop_Qt_5_10_0_MinGW_32bit-Debug" C:/.../qtpdf
Project ERROR: Unknown module(s) in QT: pdfwidgets
Project ERROR: Unknown module(s) in QT: pdf
Also when running "rebuild all" I get the following error message:
16:15:33: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" qmake_all
"Some of the required modules (!qnx:!uikit:!winphone:!winrt:!win32-g++:!integrity) are not available."
"Skipped."
I've narrowed this down to !win32-g++ - If I remove that, it won't throw that error, but I don't understand what exactly this error means - I have googled around a lot but couldn't find anything that seemed reminiscent of this particular problem.
I managed to build qtpdf with mingw provided with Qt5.11.2.
Comment out "requires(!qnx:!uikit:!winphone:!winrt:!win32-g++:!integrity)" from pdf.pro
Apply the patch found here : https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-pdfium-git/pdfium-2729.patch (link dead in 2021, no backup sorry)
Add -luuid after "win32: LIBS_PRIVATE += -ladvapi32 -lgdi32 -luser32" in lib.pro
I don't know why, probably because I am not an expert, but mingw doesn't generate correctly the folder "include". As a workaround I use the one generated under linux. For some reason, mingw generate only QPdfDepends and QPdfWidgetsDepends, none of the needed headers are generated. I didn't dig because I am lazy.
Hope it helps !
# Upstream PDFium has not been ported to various platforms yet.
requires(!qnx:!uikit:!winphone:!winrt:!win32-g++:!integrity)
The module is not working on win32-g++ (mingw32).

Google closure compiler: required entry point "goog" never provided

I am trying to compile a simple closure project but I am getting this error:
build/closure-library/closure/bin/build/closurebuilder.py:
Compiling with the following command:
java -client -jar build/compiler.jar
--js build/closure-library/closure/goog/base.js
--js js/index.js
--manage_closure_dependencies=true
--transform_amd_modules
--process_common_js_modules
--common_js_entry_module
--common_js_module_path_prefix
--language_in=ECMASCRIPT5_STRICT
--compilation_level=SIMPLE_OPTIMIZATIONS
ERROR - required entry point "goog" never provided
As you can see, the java command is including base.js which has goog defined in it, so I have no idea what is going on.
I switched from using the bower version of closure-compiler to just cloning that actual source: https://github.com/google/closure-compiler and building it myself, and it worked.

error javac: invalid flag: -J-Xmx1028m in sbt

I have OutOfMemoryError when I compile my project using sbt. So I need to enlarge the java compiler heap space. I use java 6. And I have set JAVA_HOME to java 6 in my bash env.
I tried to add this line to build.sbt
javacOptions ++= Seq(<other arguments>,"-J-Xmx1028m")
When I compile, I have error like this:
[error] javac: invalid flag: -J-Xmx1028m
[error] Usage: javac <options> <source files>
[error] use -help for a list of possible options
The funny thing is: this error disappears when I specify the javaHome in build.sbt, which I have already done it in my bash env:
javaHome := Some(file("path to java 6"))
Does it mean that I have to specify JAVA_HOME twice? once in bash env, once in build.sbt? I don't want to specify a absolute path in build.sbt, which makes it may not work properly on other computers.

Resources