How to disable Error (warning 66): unused open! in dune - ocaml

As per https://github.com/ocaml/ocaml/pull/1110, OCaml 4.08 and later raises a warning for unused module opens, even when they are opened with open!. This creates friction with the common practice of using open! Foo to establish that the following code is to be in the context of module Foo (whether or not any thing is used from inside of Foo). Moreover, since dune treats all warnings as fatal errors by default, this will cause dune builds in the default dev profile to fail with errors like
$ dune build
File "lib/mylib.ml", line 1, characters 0-10:
1 | open! Core
^^^^^^^^^^
Error (warning 66): unused open! Core.
How can I disable this warnings and the fatal error?

The dune FAQ explains how to configure warnings so that they are "non-fatal" (letting the build proceed). However, this will still leave the warnings cluttering your build output. For developers using the open! Foo idiom to establish the context, this is annoying. The best solution is just to selectively disable this warning for the project:
Create a dune file at the root of your project
Add the following stanza
(env
(dev
(flags (:standard -w -66))))
This stanza instructs dune to pass the -w flag with the -66 argument to the OCaml compiler when building under the dev profile. man ocamlc explains how this flag works:
-w warning-list
Enable, disable, or mark as fatal the warnings specified by the argument warning-list.
...
-num Disable warning number num.
...
The warning numbers are as follows.
...
66 Unused open! statement.

Related

gcc compiler error when building on raspbian

I am trying to build openvibe! source code on raspbian and i have installed all the required dependencies, one by one manually, but in the end it seems to have a compilation error.
So after writing build files it says:
-- Build files have been written to: /home/pi/Desktop/openvibe-2.0.0-src/build/sdk-Release
Generation succeeded!
Building project...
and:
[1/340] Building CXX object build-tool...
[some dirty code here]
and then stops building sdk
returning this :
c++: error: unrecognized command line option ‘-msse2’
ninja: build stopped: subcommand failed.
ERROR: Build failed
Error while building sdk
I want to make it clear that i have searched everywhere and SOF is my last resort! So any help would be highly appreciated!
Judging by the output, you are building the library using cmake.
-msse2 is gcc compilation flag, which enables x86 sse vectorisation. Since you are compiling for raspbian you need to disable it.
Usually, compilation flags are set in CMakeLists.txt files. Find, the place where it was set:
find . -name CMakeLists.txt | xargs grep msse2
You will find something like:
# Switch -msse2 enables vectorization. Remove if your CPU/compiler doesn't support it.
SET(OV_EIGEN_FLAGS "-msse2")
As guided, remove every occurrence, and you are done.

How to force error on SwiftLint instead of warnings?

my question is very simple, how do I make all warnings become errors on SwiftLint? (without manually configuring each rule separately)
To integrate SwiftLint to your project, you normally need to add a Run Script Phase, as described by the doc.
If you used the CocoaPods installation, this script would look like:
"${PODS_ROOT}/SwiftLint/swiftlint"
That is where you can customize the command line options. In your case, you may want to use:
"${PODS_ROOT}/SwiftLint/swiftlint" lint --strict
The warnings will still be displayed as warnings, but an extra error will be given, preventing running or archiving:
Command /bin/sh failed with exit code 3
That is the desired error.
One drawback with "--strict" flag is that it won't show which line has a Warning.
You can pipe the output and replace "warning" with "error" by adding:
| sed "s/warning:/error:/"
the whole command will look like:
"${PODS_ROOT}/SwiftLint/swiftlint" lint --strict | sed "s/warning:/error:/"
then Xcode will show all SwiftLint warnings as errors.
You can make every swiftlint rule throw an error by enabling --strict
swiftlint lint --strict
Alternatively, you can configure each rule of swiftlint if you are using a config.yml file so that only certain rules throw an error.
swiftlint lint --config 'config.yml'
In the config.yml file simply add the configuration for the rule you want to throw as an error.
implicit_return:
severity: error
I believe this will work for any swiftlint rule. This is useful if you are looking to gradually adopt a stricter approach to linting.

Compiling Qt 5.3.1 from source error at qprintsupport

I'm not sure whether or not this question has a causality with my previous question.
So, I compiled Qt 5.3.1 from source with MinGW 4.8.2. The build stopped at qtbase/src/printsupport directory, as you can see the image below:
Is it a bug or something at qtbase/src/printsupport/kernel/qprintengine_win.cpp file? Then, should I just report it to the developer?
Look here it give you a hint. Probably somewhere you use this key -Werror in make files implicitly or explicitly when start compilation with gcc. If I correct understand error in that switch operation must be default: statement or case PPK_CustomBase: statement.
miraiE,
If you will notice in your output: cc1plus.exe: all warnings being treated as errors
This is, as was mentioned before, a warning that is stopping the compile process as an error.
You should be able to run you configure.bat script again, with the option -no-warnings-are-errors.
Then re-run your make.exe to get past this, and other warnings, from stopping the build.
Details of the specific configure options below:
../qtbase-opensource-src-5.3.1/configure --help |grep -i warn
-silent ............ Reduce the build output so that warnings and errors
-no-warnings-are-errors Make warnings be treated normally
-warnings-are-errors Make warnings be treated as errors
I hope this helps!

How to compile DEC UNIX v4.0 application source code in Linux?

I want to compile a source code but I have trouble in compile.
cc -O2 -Olimit 2000 -g -migrate -assume -Zp1 noaligned_objects ...
cc: error: 2000: No such file or directory
cc: error: noaligned_objects: No such file or directory
cc: error: unrecognized command line option ‘-migrate’
cc: error: unrecognized command line option ‘-assume’
cc: error: unrecognized command line option ‘-Zp1’
Start with compiling it with no system-specific flags (i.e. by using gcc possibly with -I, -L, and -l flags and nothing else). If the program in question is portable enough, then it will be a matter of getting all dependencies available for it.
Once you are able to build it, see if it runs as expected (ignore performance). If it doesn't, that would be a good time to look at the flags you used on DEC to see if it requires any special treatment when building. This is where you either make the program portable or try to get the equivalent behavior using gcc on the target architecture of your choice.
Finally, once the program builds and runs, that would be a good time to see if you want to use any optimization flags (hint: you don't have to. If it runs fine, leave it the way it is).

Why do I get an amibguity error when I compile from the command line, but not from the IDE?

I am trying to compile a rather large project with Borland C++ Builder 5.5. The project compiles in the IDE, but is much too slow. However, when I compile with the command line I get an ambiguity error that was not present in the IDE:
Error E2015 Project.h 536: Ambiguity between 'TTreeNode' and 'Comctrls::TTreeNode'
My command line arguments are as follows:
d:\PROGRA~1\Borland\CBUILD~1\bin..\BIN\bcc32 -Od -Vx -Ve -X- -r- -a8 -5 -b- -d -k -vi -c -tW -tWM -w-par -I[really big list of include files] -nQ:\output [really big list of files to compile]
This command is generated by make.exe.
I believe the problem lies in the fact the command line compiler and the IDE compiler are different. The command line appears to be more strict about ambiguity whereas the IDE flags it only as a warning. In light of this, I guess some projects simply can't be built with the command line tools even if they build in the IDE.