My Proguard config file uses the following to remove log statements:
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** e(...);
}
Apparently this only takes effect when optimizations are turned on, so I reference proguard-android-optimize.txt in my project properties file, instead of proguard-android.txt.
Is this a inconsequential change to make? proguard-android-optimize.txt says "Adding optimization introduces certain risks, since for example not all optimizations performed by
ProGuard works on all versions of Dalvik" What exactly does this mean, and can I possibly not use proguard-android-optimize.txt and instead add just the optimization statements that are necessary to my own config file so that log removal takes effect?
Thanks. Total Proguard novice.
You can indeed only remove logging if optimization is enabled.
Optimization should be pretty stable in current versions of ProGuard. You can replace <android.sdk>/tools/proguard/lib/proguard.jar with the latest version if you wish. For instance, version 4.9 has improvements to remove traces of logging from the code, compared to version 4.7 in the Android SDK at this time of writing (indicated by the output of "java -jar proguard.jar").
Related
I'm doing a project in which I need to optimize my code as much as I can because it takes hours to run with a normal compilation.
I was told to use Flambda, but I didn't find anything on the internet on how to use it with dune.
I'd appreciate instructions to follow / resource to read.
Flambda is a configuration feature of the compiler, which is disabled by default (as of January 2022). To use it, you need to install a version of the compiler that enables this feature. It is very easy with opam, e.g.,
opam switch create myswitch ocaml-variants.4.13.1+options ocaml-option-flambda
It will create a new switch with the 4.13.1 version of the OCaml compiler and that has the flambda feature enabled. The general syntax is,
opam switch create <switch-name> ocaml-variants.<version>+options <options>...
You can enable several options, see opam search ocaml-option for all the options.
After you have installed the flambda version of OCaml, it will use flambda optimizations by default (but make sure that you're using the release version, as the default debug version disables some of the optimizations, including the cross-module optimization). Also, as usual, do not forget to activate your switch with eval $(opam env).
The flambda compiler has numerous configuration options that are thoroughly described in the manual. You may experiment with them to find some tradeoff between the compilation time and the performance of your application. You can set the options using flags stanza, e.g., (flags (:standard -rounds 5)). You can set the flags globally as well. Once you find the perfect set of flags, you can even use them to compile your upstream dependencies, using the OCAMLPARAM environment variable. Using this environment variable you can change the optimization parameters without interfering with the build scripts of other packages, e.g.,
export OCAMLPARAM='_,rounds=5,O3=1,inline=100,inline-max-unroll=5'
# opam install your deps
Due to:
extensive usage of code auto-generation (notably for the .isa instruction and decoder sublanguage)
scons symlinking sources into the build tree, and in particular symlinking src/arch/ARCH to src/ARCH
it becomes very hard to setup Eclipse to work well with gem5.
Has anyone managed to achieve a good setup? Especially interested in Linux hosts.
I have achieved a very good setup with the following horrendous hack: define the Eclipse project inside the build/ARM directory itself!
This is done by creating a "New makefile project with existing code" in the build directory. You will also want to fix the C++ standard library as mentioned at: How to solve "Unresolved inclusion: <iostream>" in a C++ file in Eclipse CDT?
This works amazingly because the way the gem5 build system works as of May 2020, the build/ARM directory contains exactly the final compilation tree, including all the source symlinks and autogenerated code,.
This setup is not perfect because there is still some C++ stuff in build/ outside of ARM, e.g. ext, but 99% of the time we don't care about those, and I can perfectly navigate key autogenerated code such as instructions and decoder.
I then just build via the command line normally with scons.
Humongous autogenerated files like exec-ns.cc.inc turn on Eclipse's large file limited mode. Notably, if you want to jump to a definition, Ctrl + click does not work for me, so I just copy the symbol of interest and Ctrl + Shift + T to go to its definition.
I don't usually bother to try GDB step debug gem5 through Eclipse and use it mostly for code navigation, since GDB Dashboard tends to work well enough for me, and I often need to do new log collection runs and I sometimes use reverse debugging when things get serious.
But I have tested step debugging through Eclipse, and it did work normally (no reason not to I guess), you just have to set it up in exactly the same was as for any other C++ application with a Makefile, i.e. basically tell eclipse the Binary name and the desired CLI on the debug configurations.
You have of course as usual to choose between a gem5.debug debug build or a gem5.opt build, where the .debug build is about 10-20x slower but gives greater debug visibility. In general, if the time to reach the point of interest in a debug build starts to annoy you however, what you tend to really want is to do use reverse debugging.
This is also mentioned at: https://cirosantilli.com/linux-kernel-module-cheat/#gem5-eclipse-configuration
Tested in Eclipse 2020-03.
I have just created an Executable Jar of my application using Eclipse. I always try to help you to answer, but this time i really don't know what's going on.
In this project i've added some external class (org.java_websocket) and the conj Jar, used for mysql connections.
In the link below i get like 800+ rows of warnings, but problems are just a few.
To obfuscate this project, i'm using Proguard GUI. I have unchecked shrinking and Optimization, and i've kept the main class of my application inserting it in the bottom box of obfuscation window (i have inserted "SimulatorServer").
That's the Proguard Output after processing is done. I don't get any Jar on output
http://pastebin.com/q2c4KUnq
You have to keep that external JARs from being obfuscation.
You can get general information for ProGuardGUI here
So I have been trying to build libarchive for a couple of days now, following this guide and many other threads: https://github.com/libarchive/libarchive/wiki/BuildInstructions
I want a static library with LZMA, zlib and bzip2 support. I got static versions of these too (lib's)
I just cant get it to work properly. Ive used CMAKE to generate the make files for VS2010 and NMAKE. With both of these options the thing compiles just fine, but when i try to use the archive_static.lib generated, in my project I get plenty of unresolved externals. Compiling the .dll version of the library works without unresolved externals, but then it starts asking for zlib.dll, bzip2.dll etc, which i dont have and dont want to use.
I think i need to set some flags with cmake, but im not sure how to do that.
Any help is greatly appreciated.
http://www.libarchive.org/
I can't be sure if that's what happening here, but please bear in mind, that when linking binaries into a static library, its external dependencies do not necessarily get embedded into it, that means you might need to provide thet static libraries on which your program indirectly depends through libarchive, namely LZMA, zlib and bzip2 in your case, explicitly.
Furthermore there's some confusion on windows when it comes to linking static vs dynamic, for in both cases you provide a .lib file, so it is very easy to mix things up and provide the dynamicaly linked .lib, instead of the static version. If you do that, the linker may refuse to link your program (that notably happens with boost), or may link just fine and then, at the time of execution, the OS will require the respective .dll's.
I want to switch my python-IDE from idle to pydev (eclipse). I am using a couple of modules which I have as compiled bytecode (*.pyc) only. In idle that was never a problem and it even offers code completion for those compiled modules. But pydev gives me a lot of "undefined variable" errors - however the code is interpreted correctly.
Is there a way pydev can handle bytecode modules the way idle does? Perhaps without decompiling the files?
Try adding the modules as forced builtins.
To do that, go into Settings → PyDev → Interpreter - (Python/Jython/IronPython as approriate), select the interpeter you're using, and add it to the list on the Forced Builtins tab (look here for more details).
(Note that you may or may not have to add multiple entries for subpackages and modules; for example to get Fabric working properly one needs to add both fabric and fabric.api)
That makes PyDev load those modules into an interpreter to get code-completion and error checking data, rather than just analysing source code.
I've not tried it for .pyc files, but it works for other things like importing something that's generated dynamically by a script's __init__.py or something (ie fabric) so it might work for you.
(see also this FAQ and that one on the PyDev site)