should I recompile all clang project when I want to add a new checker in Clang StaticAnalyzer? - llvm-clang

I follow the steps in the section Checker Registration
in the manual page of clang static analyzer one by one and can not find my checker from the output of the command
clang -cc1 -help | grep "analyzer"
So, I wonder if I should recompile the whole project? That is a burdensome job which I need almost several hours to compile it.

You should be using a build system like ninja or make when compiling llvm/clang. The build system automatically decides which parts need to be recompiled and which parts do not.
As an example, if you follow the steps to build clang here, step number 7 says to run the following commands:
mkdir build (in-tree build is not supported)
cd build
cmake -G "Unix Makefiles" ../llvm
make
From that point forward every time you make changes you only need to re-run the make command from your build folder and make will automatically compile anything that needs to be recompiled.
If you want slightly faster recompile times you can install the ninja build system and use cmake -G "Ninja" ../llvm when first building the project and use the ninja command instead of make from that point forward.

Related

How to make a HTML build from raylib

I am a beginner programmer and I was wondering how I would make an HTML build from raylib. I tried looking at the GitHub https://github.com/raysan5/raylib/wiki/Working-for-Web-(HTML5) I couldn't understand it. would you be able to write a simple step-by-step tutorial for me. please
For the very beginning you have to install emscripten SDK. As stated at the site "Emscripten is a complete compiler toolchain to WebAssembly, using LLVM, with a special focus on speed, size, and the Web platform."
Installation steps are prety easy:
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
git pull
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
After this steps you will have emscripten installed into the directory you've cloned it.
Then, you need to compile raylib itself to be usable in Web:
Go to the raylib/src directory and open Makefile, find where EMSDK_PATH variable is being defined and edit it accordingly to your setup. If you downloaded emscripten into /home/user/emsdk directory then put it in there:
EMSDK_PATH ?= /home/user/emsdk
Fix PYTHON_PATH definition as well.
then launch execute make:
make -e PLATFORM=PLATFORM_WEB -B
Notice -e option. That option allows to propagate and override environment variables to makefile.
Generated libraylib.a is placed in raylib\src\libraylib.a directory.
After that you can cd into raylib/examples/, fix Makefile as described above and launch make -e PLATFORM=PLATFORM_WEB -B again.
After that you would be able to start python3 -m http.server in that directory, navigate to http://0.0.0.0:8000/ in your browser and see examples.

How do I make Octave see installed Shogun libraries in Ubuntu 16.04?

I copied the commands (from these instructions: http://www.shogun-toolbox.org/install#ubuntu) into the terminal and they seem to have worked, but there is no documentation on how to make Octave find the libraries. I have tried modshogun and init_shogun but Octave cannot find them. I do have the libraries in usr/lib, and I have put that directory on PATH. I have even set usr/lib as my working directory in Octave and that did not help. As far as I have found, there is no Shogun documentation on what to do at this point.
I have also tried compiling Shogun from source, but configure couldn't find GCC. Apparently, this is a known problem with newer versions of GCC. I decided to ask for help with the former method because at least I have the libraries with that.
Edit: I am following the instructions here http://www.shogun-toolbox.org/install#manual-basics
When i do cd build and then "cmake -DINTERFACE_OCTAVE=ON" it tells me there is no cmakelists.txt. There is one in in the above folder, but when I go to that directory and do "cmake -DINTERFACE_OCTAVE=ON" again, it tells me "Shogun can only be built with GPL codes if the source files are in /home/derose/shogun/src/shogun/src/gpl. Please download or disable with LICENSE_GPL_SHOGUN=OFF."
However, when I add -LICENSE_GPL_SHOGUN=OFF as an option, i get the error "CMake Error: The source directory "/home/derose/shogun/src/shogun/-LICENSE_GPL_SHOGUN=OFF" does not exist."
You've linked to the Ubuntu install instructions. From there
These currently do contain the C++ library and Python bindings..
No word that this would include the GNU Octave binding. See below on the same page:
The native C++ interface is always included. The cmake options for building interfaces are -DINTERFACE_PYTHON=ON -DINTERFACE_R .. etc. For example, replace the cmake step above by cmake -DINTERFACE_PYTHON=ON...
So you have to grab the source and fire up cmake with something like -DINTERFACE_OCTAVE=ON
Steps to build the bleeding edge of shogun (the github repo) and the Octave interface:
git clone https://github.com/shogun-toolbox/shogun && cd shogun
git submodule update --init
mkdir build && cd build
cmake .. -DINTERFACE_OCTAVE=ON
make -j4

How to show the configuration of my CMake?

I'm looking for a command like cmake --features or cmake --config which shows me how my CMake executable was built. For example, I want to know weather the flags like --system-bzip2 really did get used and check the paths to the libraries CMake uses.
I am not interested in knowing what features are available on which CMake version, but which options were actually used in the build.
To find out, which libraries are used for the compiling of your CMake executable, I see three ways, as there is no --feature or --config provided by CMake.
Check the output of CMake's configure run. For most libraries, it indicates the path to the library.
Check the CMakeCache.txt within the build directory. You can find out the library paths
When you build CMake, call make VERBOSE=ON and check the output.
As far as I know, there's no such a feature in the CMake executable.
You should check your CMake version toward the official documentation to check whether a given feature is included in that version.
There's a nice tool, written in CMake language, that automates this work, you can find more info here.

As a project user, what do I need to do to make a project with Cmake?

I'm working with a project that [used to] support both Autotools and Cmake. In the past, I would:
cd project/build
...
../llvm/configure --enable-optimized --enable-cxx11 $OTHER_OPTIONS --prefix=/usr/local
make -j2
sudo make install
The project has kind of abandoned it support for Autotools, so I have to use Cmake now. Using Cmake to configure seems like it should be relatively easy.
Unfortunately, Mac OS X lacks man pages for Cmake, so I can't RTFM. And the search hits I am finding discuss how to build Cmake packages (and other stuff package maintainers would do), and not how to use it as a dumb project user.
I tried to simply use Cmake in place of Configure, but it did not work:
$ cd project/build
$ OTHER_OPTIONS=" --enable-libcpp"; cmake ../llvm --enable-optimized --enable-cxx11 "$OTHER_OPTIONS" --prefix=/usr/local
CMake Error: The source directory ".../clang-3.6/build/--prefix=/usr/local" does not exist.
Why is Cmake treating a configuration option like a directory (--prefix=/usr/local)?
How do I configure and build a project that uses Cmake as a dumb project user?
You're trying to configure a CMake project like it was autotools. The syntax of the command is;
cmake -Doptions -Dmore_options src_dir
src directory is the last argument, which is why it treats --prefix that way. You will need to know the name of the parameters available to you though. If you're new to CMake, your best bet is to run, either the Qt gui or the curses gui ( ccmake /path/to/src while your in the build directory ). Those gui tools will let you pick your options, configure then generate. Then all you need is to type make ....
Note
cmake --help
does provide info even if your man pages aren't installed. Also, if you have access to google and the internet, searching "cmake man page" should give you access the your missing man pages.

Why can't I get the gotour with go get?

So I decided I wanted to learn go, and so I started the tour. In stage 3 of that tour they recommend to use go to checkout a copy of the tour and run it locally, so I installed go for mac via the recommended installer package.
I then had the go command available, so I ran go get code.google.com/p/go-tour/gotour as it suggests in the tour.
It says "and then run the resultant gotour executable" in the tour. No executable was to be found.
The output from go get was this:
package code.google.com/p/go-tour/gotour: Get https://code.google.com/p/go-tour/source/checkout?repo=: EOF
I know EOF means end of file but I'm not sure as to whether that was an error message or not.
I have hg installed:
$ hg --version
Mercurial Distributed SCM (version 2.3.1)
And I set my $GOPATH (and the file doesn't appear there):
echo $GOPATH
/Users/alex/.golib
Running go env returns this:
GOROOT="/usr/local/go"
GOBIN=""
GOARCH="386"
GOCHAR="8"
GOOS="darwin"
GOEXE=""
GOHOSTARCH="386"
GOHOSTOS="darwin"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_386"
GOGCCFLAGS="-g -O2 -fPIC -m32 -pthread -fno-common"
CGO_ENABLED="1"
If it helps, I'm using fish as my shell.
What am I doing wrong?
a go get (contrary to go get -u) will get, compile and install the go module you want in $GOPATH.
The executable gotour will be in $GOPATH/bin.
So make sure you have your $GOPATH/bin in your path.
When executed, you should see:
2012/09/15 10:43:57 Serving content from $GOPATH/src/code.google.com/p/go-tour
2012/09/15 10:43:57 Open your web browser and visit http://127.0.0.1:3999/
Note (personal preference): I would use a more visible path than /Users/alex/.golib: /Users/alex/go
GOPATH isn't just to get some libs, but to develop all your go projects.