I have launch4j configure for my project. I used it back, when i developed on windowsXP, where it worked. Now i need it to build on mac as well:
My build.xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="create-exe">
<property name="platform" value="win32"/>
<property name="launch4j.dir" location="${basedir}/tools/launch4j/" />
<include file="create-jar.xml" as="sub"/>
<target name="create-exe" depends = "sub.create-jar">
<launch4j configFile="launch4j-config.xml" />
<delete file="client.win32.jar"/>
</target>
<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask">
<classpath>
<pathelement path="tools/launch4j/launch4j.jar"/>
<pathelement path="tools/launch4j/lib/xstream.jar"/>
</classpath>
</taskdef>
</project>
I get the following output:
create-exe:
[launch4j] Compiling resources
[launch4j] Generated resource file...
[launch4j] LANGUAGE 0, 1
[launch4j] 2 RCDATA BEGIN "1.6.0\0" END
[launch4j] 18 RCDATA BEGIN "0\0" END
[launch4j] 25 RCDATA BEGIN "512\0" END
[launch4j] 27 RCDATA BEGIN "1024\0" END
[launch4j] 21 RCDATA BEGIN "http://java.com/download\0" END
[launch4j] 20 RCDATA BEGIN "32\0" END
[launch4j] 9 RCDATA BEGIN "true\0" END
[launch4j] 101 RCDATA BEGIN "An error occurred while starting the application.\0" END
[launch4j] 102 RCDATA BEGIN "This application was configured to use a bundled Java Runtime Environment but the runtime is missing or corrupted.\0" END
[launch4j] 103 RCDATA BEGIN "This application requires a Java Runtime Environment\0" END
[launch4j] 104 RCDATA BEGIN "The registry refers to a nonexistent Java Runtime Environment installation or the runtime is corrupted.\0" END
[launch4j] 17 RCDATA BEGIN "true\0" END
BUILD FAILED
/Users/fabian/dev/rsys-client/create-win32-exe.xml:9: net.sf.launch4j.BuilderException: net.sf.launch4j.ExecException: java.io.IOException: Cannot run program "./bin/windres": error=2, No such file or directory
When i add bindir="tools/launch4j/bin" to the launch4j-execution, ld and windres are found, and the output changes to:
create-exe:
[launch4j] Compiling resources
[launch4j] Linking
[launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./w32api/crt2.o: No such file or directory
[launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./head/guihead.o: No such file or directory
[launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./head/head.o: No such file or directory
[launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./w32api/libmingw32.a: No such file or directory
[launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./w32api/libgcc.a: No such file or directory
[launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./w32api/libmsvcrt.a: No such file or directory
[launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./w32api/libkernel32.a: No such file or directory
[launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./w32api/libuser32.a: No such file or directory
[launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./w32api/libadvapi32.a: No such file or directory
[launch4j] /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld: cannot find ./w32api/libshell32.a: No such file or directory
BUILD FAILED
/Users/fabian/dev/rsys-client/create-win32-exe.xml:9: net.sf.launch4j.BuilderException: net.sf.launch4j.ExecException: Exec failed (1): /Users/fabian/dev/rsys-client/tools/launch4j/bin/ld -mi386pe --oformat pei-i386 --dynamicbase --nxcompat --no-seh --subsystem windows -s ./w32api/crt2.o ./head/guihead.o ./head/head.o /var/folders/n5/44dkvyzd00z0h5mklk_pwtch0000gn/T/launch4j3026065429236284429o ./w32api/libmingw32.a ./w32api/libgcc.a ./w32api/libmsvcrt.a ./w32api/libkernel32.a ./w32api/libuser32.a ./w32api/libadvapi32.a ./w32api/libshell32.a -o /Users/fabian/dev/rsys-client/Kassa.exe
Total time: 6 seconds
For those that experience the:
error=2, No such file or directory
issue when running windres on 64-bit Linux, you will need to install 32-bit libraries. On Linux Mint I installed the package ia32-libs with:
sudo apt-get install ia32-libs
This error occurs when your current directory is not the launch4j directory, as Leo noted.
Launch4j attempts to find its own install directory by looking on the
classpath for launch4j.properties. This is done in Util.java, at the top of
the getJarBaseDir() method. It was changed recently to have these lines:
URI uri = new URI(Util.class.getClassLoader()
.getResource(Launch4jProperties)
.getFile());
String path = uri.getPath();
if (path.startsWith("file:")) {
String jarPath = path.substring(5,path.lastIndexOf('!'));
The problem is uri.getPath() does not return the "file:" part for local file URIs--it only returns the path portion of the URI beginning with /. I changed those last two lines to this, and it started working:
if (path.startsWith("/")) {
String jarPath = path.substring(0, path.lastIndexOf('!'));
Note the 5 -> 0 in substring because we don't need to remove "file:" part anymore.
I had to rename build.xml.prod to build.xml in order to compile launch4j, but other than that it worked fine.
I was facing the same problem and couldnĀ“t set the path/classpath properly but as a workaround I create the Ant build within the launch4j directory and I was able to get it work generating the executable file.
I also had this problems and I fixed it by modifying the launch4j code.
In the Class Launch4JTask.java I replaced the line
final Builder b = new Builder(Log.getAntLog());
with this one
final Builder b = new Builder(Log.getAntLog(), new File(getOwningTarget().getProject().getProperty("launch4j.bindir")));
Through this change i could specify the path to Launch4j inside my ant build script like that
<property name="launch4j.bindir" location="../tools/launch4j/" />
Greetings, -chris-
I had similar problem with building launch4j in Maven:
...
[INFO] launch4j: (longPathIn.m2Repository)\windres.exe: can't popen `type (longPathToTemp)\Temp\launch4j8580185391499327059rc': No error
[ERROR]
net.sf.launch4j.BuilderException: net.sf.launch4j.ExecException: Exec failed(1): [Ljava.lang.String;#9f1fb5
at net.sf.launch4j.Builder.build(Builder.java:145)
...
it started working normally after cleaning system variable ComSpec:
was: ComSpec=%SystemRoot%\system32\cmd.exe;c:\Program Files (x86)\NSIS\NSIS.exe
now: ComSpec=%SystemRoot%\system32\cmd.exe
It seems like NSIS inserted itself there, not me.
Related
With clang-tidy static analyzer I can keep a file (.clang-tidy) in the root of the project with the warnings I want to activate or deactivate.
clang-tidy will look for this file (as far I know) and use the options defined there. This saves me from hard coding long command lines in CMake or Makefiles.
Is it possible to do the same with cppcheck static analyzer?
Currently I have this very long command line hardcoded:
cppcheck --max-ctu-depth=3 --enable=all --inline-suppr --suppress=*:*thrust/complex* --suppress=missingInclude --suppress=syntaxError --suppress=unmatchedSuppression --suppress=preprocessorErrorDirective --language=c++ --std=c++14 --error-exitcode=666
This is an example of .clang-tidy configuration file that I keep at the root of a project:
---
Checks: '
*,
-readability-magic-numbers,
-modernize-use-nodiscard,
-altera-struct-pack-align,
-cert-err58-cpp,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-avoid-magic-numbers,
-fuchsia-default-arguments-calls,
-fuchsia-trailing-return,
-fuchsia-statically-constructed-objects,
-fuchsia-overloaded-operator,
-hicpp-vararg,
-hicpp-no-array-decay,
-llvm-header-guard,
-llvmlibc-restrict-system-libc-headers,
-llvmlibc-implementation-in-namespace,
-llvmlibc-callee-namespace
'
WarningsAsErrors: '*'
HeaderFilterRegex: '.'
AnalyzeTemporaryDtors: false
FormatStyle: file
...
You can store the configuration in a *.cppcheck file and then use the --project command line option to run the check. See the manual - Cppcheck GUI project section.
cppcheck files are normally generated by CppCheckGUI via File -> New project file. The exact syntax is undocumented but it's basically just an XML file and looks to be fairly straightforward if you want to create the file directly without using the GUI.
Sample test.cppcheck file:
<?xml version="1.0" encoding="UTF-8"?>
<project version="1">
<builddir>test2-cppcheck-build-dir</builddir>
<platform>Unspecified</platform>
<analyze-all-vs-configs>false</analyze-all-vs-configs>
<check-headers>true</check-headers>
<check-unused-templates>false</check-unused-templates>
<max-ctu-depth>10</max-ctu-depth>
<exclude>
<path name="WINDOWS/"/>
</exclude>
<suppressions>
<suppression>IOWithoutPositioning</suppression>
</suppressions>
</project>
I'm trying to import generic test execution with sonar.testExecutionReportPaths.
I'm using the xml file format provided in the doc.
I use full path to the file in the path attribute. And files exist.
I don't understand why my files are ignored. Any idea ?
sonar.testExecutionReportPaths = "C:\Program Files (x86)\Jenkins\workspace\CI\Sonarqube.xml"
sonar.test.inclusions = "**\*Test*.cs"
Here is the log from Sonar Runner:
INFO: Sensor Generic Test Executions Report
INFO: Parsing C:\Program Files (x86)\Jenkins\workspace\CI\Sonarqube.xml
WARNING: WARN: Property 'sonar.genericcoverage.unitTestReportPaths' is deprecated. Please use 'sonar.testExecutionReportPaths' instead.
INFO: Imported test execution data for 0 files
INFO: Test execution data ignored for 5 unknown files, including:
C:\Program Files (x86)\Jenkins\workspace\CI\Tests\A-Test.cs
C:\Program Files (x86)\Jenkins\workspace\CI\Tests\B-Tests.cs
C:\Program Files (x86)\Jenkins\workspace\CI\Tests\C-Tests.cs
C:\Program Files (x86)\Jenkins\workspace\CI\Tests\D-Test.cs
C:\Program Files (x86)\Jenkins\workspace\CI\Tests\E-Test.cs
INFO: Sensor Generic Test Executions Report (done) | time=265ms
Here is the a part of the Generic XMl File:
<testExecutions version="1">
<file path="C:\Program Files (x86)\Jenkins\workspace\CI\Tests\A-Test.cs">
<testCase name="My A Test" duration="1210" />
</file>
<file path="C:\Program Files (x86)\Jenkins\workspace\CI\Tests\B-Tests.cs">
<testCase name="My B Test" duration="566" />
</file>
</testExecutions>
Thank you!
What did it for me was adding:
sonar.testExecutionReportPaths=coverage/test-report.xml
sonar.tests=src
sonar.test.inclusions=**/*.spec.ts to my sonar-project.properties file. "sonarqube-scanner-node".
Basically, you need to confirm those parts if you want to make the sonar unit test count show correctly, it must be one of the error
Add config sonar.testExecutionReportPaths=xx/test-report.xml to properties and make sure the path is correct.
Check your test-report.xml file field and path content(file path="C:\Program Files (x86)\Jenkins\workspace\CI\Tests\A-Test.cs"), make sure the path is the same as the file in your local or server, for example, if you run this inside docker, you need to check the A-Test.cs file path in the docker container, whether it's the with the defined path in xml file.
Finally, I solved my problem by doing this check, hopefully, it can help you.
And there are some tips from standard documentation here
* The root node should be named testExecutions.
* Its version attribute should be set to 1.
* Insert a file element for each test file.
* Its path attribute can be either absolute or relative to the root of the module.
BTW, there is a warning in your sonar log:
WARNING: WARN: Property 'sonar.genericcoverage.unitTestReportPaths' is deprecated. Please use 'sonar.testExecutionReportPaths' instead.
But I can see you already use the testExecutionReportPaths, you may need to check whether sonar run the lasted version of settings and the option soanr56x is false in your package.json config.
I am trying to set up and run LibreCAD and I am following their Build From Source Guide.
At some point, and after installing QT and boost, I reach the step where it says this:
To change these default settings you have to create the file
scripts/custom-windows.bat and overwrite the different settings
without effect to the SCM (git). Example for
scripts/custom-windows.bat:
set Qt_DIR=C:\Qt\5.4
set NSIS_DIR=C:\PROGRA~2\NSIS
set MINGW_VER=mingw491_32
So I created a custom-windows.bat file and overwrote the settings. Now, and since I am working on 64 bit Windows, They are saying that I need to do this:
There are issues with the NSIS_DIR path on 64 Bit Windows. When NSIS
is installed in the Program Files (x86) folder and NSIS_DIR is added
to the PATH, something goes wrong in the build process.
In this case use the command dir /X \ and get an output like this:
09/02/2014 09:50 PM <DIR> PROGRA~1 Program Files
10/27/2014 12:33 PM <DIR> PROGRA~2 Program Files (x86)
08/16/2014 10:49 PM <DIR> Qt
But what does that mean? "..use the command dir /X \ and get the output.." Where and how? Appreciate it if anyone could tell me how to solve that.
Open up a command prompt and literally type dir /X \. The output will show the mapping between the short folder names and the long ones.
Your goal is to use the correct short form representation for Program Files (x86) in NSIS_DIR, since it's not always PROGRA~2. It can vary from filesystem to filesystem, based on the history of the filesystem.
I am trying to add a resource file to include an icon for my win32 form application in Code::Blocks. I created the resource.rc file and added it to my project, and placed my icon in the root folder of the project (where the source files are), and I keep on receiving a preprocessing failed error.
This is what my resource.rc file looks like
#ifndef _resource_rc
#define _resource_rc
MAINICON ICON "icon1.ico"
#endif
My main.cpp file is just a untouched win32 form application, and the project itself is untouched besides adding the resource.rc file to the project.
The build message error is
||preprocessing failed.|
||=== Build finished: 1 errors, 0 warnings ===|
And the build log is
gcc: Files\: No such file or directory
gcc: \(x86\)\CodeBlocks\MinGW\include: No such file or directory
windres.exe: preprocessing failed.
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings
I have checked to make sure where Code::Blocks is installed and it is located in \Program Files(x86)\ where as it seems gcc is looking at a folder called \(x86)\. May this be the problem?
If I remove the resource file, the application compiles and runs correctly.
Thanks for any help.
edit: I've enabled full compiler output and here is what is being ran:
windres.exe -i C:\Users\user\Desktop\MENOET~1\resource.rc -J rc -o obj\Debug\resource.res -O coff -I"C:\Program Files (x86)\CodeBlocks\MinGW\include"
gcc: Files\: No such file or directory
gcc: \(x86\)\CodeBlocks\MinGW\include: No such file or directory
windres.exe: preprocessing failed.
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings
What I've noticed is that MENOET~1 is some sort of abbreviated name of my project directory and that is not its actual name. Not sure if that has anything to do with it, and I cant seem to change it.
edit2: I managed to fix it, but I rather not do it this way. What I did was copy MingGW to C:\ and then went Settings -> Compiler and debugger -> Search directories -> Resource compiler, and set that path to C:\MingGW\include. This allowed relieved all the errors and the build was successful, although I would much rather not have to have copies of MingGW in my root C:\ directory. Is there any way to fix this so it would work with the original path? I'd imagine it is just goofing up on the spaces in the file name, but I cant figure out where to find the build variables to insert quotes.
As per my deductions and enhzflep's settings, I have fixed the problem. The problem is caused by spaces and characters such as brackets being in the path name of the search directories for the resource compiler.
In order to fix this, either move any directories in the resource compilers search directory to C:\ as to remove spaces from it's name, or remove its reference from code::blocks completely.
Both methods worked. Moving the MingGW directory into C:\ and then setting the new search path to C:\MingGW\include fixed this error as well as just removing any reference to this folder in the resource compiler menu.
Both allowed the application to compile successfully.
You can find the resource compiler search directories under
Settings -> Compiler and debugger -> Search directories -> Resource compiler
PHP Notice: Please no longer include "PHPUnit/Framework.php". in /usr/share/php/PHPUnit/Framework.php on line 50
Fatal error: Class 'PHPUnit_Runner_StandardTestSuiteLoader' not found in /usr/share/php/PHPUnit/TextUI/TestRunner.php on line 434
PHP Fatal error: Class 'PHPUnit_Runner_StandardTestSuiteLoader' not found in /usr/share/php/PHPUnit/TextUI/TestRunner.php on line 434
/var/www/nrka2/build/build.xml:30: exec returned: 255
BUILD FAILED (total time: 2 seconds)
Hello I got this error in the latest phpUnit version. Any ideas how to solve it?
Change your inclusion to PHPUnit/Autoload.php.
Look in your folder that contains your tests.
For example, in Symfony2, there is a Tests folder under each bundle folder. Then you have to browse through the sub directories until you find the test file
e.g. login_databaseTest.php
You will see a line
require_once 'PHPUnit/Framework.php';
Use a good IDE that has a search feature and search your entire project.
I originally though this was some file in the PHPUnit directory, under PHP. Not so. The files needing modified are generated test files that include this line needing modified.