How to make a HTML build from raylib - html

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.

Related

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

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

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.

Install Cuda without root

I know that I can install Cuda with the following:
wget http://developer.download.nvidia.com/compute/cuda/7_0/Prod/local_installers/cuda_7.0.28_linux.run
chmod +x cuda_7.0.28_linux.run
./cuda_7.0.28_linux.run -extract=`pwd`/nvidia_installers
cd nvidia_installers
sudo ./NVIDIA-Linux-x86_64-346.46.run
sudo modprobe nvidia
sudo ./cuda-linux64-rel-7.0.28-19326674.run
Just wondering if I can install Cuda without root?
Thanks,
Update The installation UI for 10.1 changed. The following works:
Deselect driver installation (pressing ENTERon it)
Change options -> root install path to a non-sudo directory.
Press A on the line marked with a + to access advanced options. Deselect create symbolic link, and change the toolkit install path.
Now installation should work without root permissions
Thank you very much for the hints in the question! I just want to complete it with an approach that worked for me, also inspired in this gist and that hopefully helps in situations where a valid driver is installed, and installing a more recent CUDA on Linux without root permissions is still needed.
TL;DR: Here are the steps to install CUDA9+CUDNN7 on Debian, and installing a pre-compiled version of TensorFlow1.4 on Python2.7 to test that everything works. Everything without root privileges and via terminal. Should also work for other CUDA, CUDNN, TensorFlow and Python versions on other Linux systems too.
INSTALLATION
Go to NVIDIA's official release web for CUDA (as for Nov. 2017, CUDA9 is out): https://developer.nvidia.com/cuda-downloads.
Under your Linux distro, select the runfile (local)option. Note that the sudo indication present in the installation instructions is deceiving, since it is possible to run this installer without root permissions. On a server, one easy way is to copy the <LINK> of the Download button and, in any location of your home directory, run wget <LINK>. It will download the <INSTALLER> file.
Run chmod +x <INSTALLER> to make it executable, and execute it ./<INSTALLER>.
accept the EULA, say no to driver installation, and enter a <CUDA> location under your home directory to install the toolkit and a <CUDASAMPLES> for the samples.
Not asked here but recommended: Download a compatible CUDNN file from the official web (you need to sign in). In my case, I downloaded the cudnn-9.0-linux-x64-v7.tgz, compatible with CUDA9 into the <CUDNN> folder. Uncompress it: tar -xzvf ....
Optional: compile the samples. cd <CUDASAMPLES> && make. There are some very nice examples there and a very good starting point to write some CUDA scripts of yourself.
(If you did 5.): Copy the required files from <CUDNN> into <CUDA>, and grant reading permission to user (not sure if needed):
cp -P <CUDNN>/cuda/include/cudnn.h <CUDA>/include/
cp -P <CUDNN>/cuda/lib64/libcudnn* <CUDA>/lib64
chmod a+r <CUDA>/include/cudnn.h <CUDA>/lib64/libcudnn*
Add the library to your environment. This is typically done adding this following two lines to your ~/.bashrc file (in this example, the <CUDA> directory was ~/cuda9/:
export PATH=<CUDA>/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<CUDA>/lib64/
FOR QUICK TESTING OR TENSORFLOW USERS
The quickest way to get a TensorFlow compatible with CUDA9 and CUDNN7 (and a very quick way to test this) is to download a precompiled wheel file and install it with pip install <WHEEL>. Most of the versions you need, can be found in mind's repo (thanks a lot guys). A minimal test that confirms that CUDNN is also working involves the use of tf.nn.conv2d:
import tensorflow as tf
x = tf.nn.conv2d(tf.ones([1,1,10,1]), tf.ones([1,5,1,1]), strides=[1, 1, 1, 1], padding='SAME')
with tf.Session() as sess:
sess.run(x) # this should output a tensor of shape (1,1,10,1) with [3,4,5,5,5,5,5,5,4,3]
In my case, the wheel I installed required Intel's MKL library, as explained here. Again, from terminal and without root users, this are the steps I followed to install the library and make TensorFlow find it (reference):
git clone https://github.com/01org/mkl-dnn.git
cd mkl-dnn/scripts && ./prepare_mkl.sh && cd ..
mkdir -p build && cd build
cmake -D CMAKE_INSTALL_PREFIX:PATH=<TARGET_DIR_IN_HOME> ..
make # this takes a while
make doc # do this optionally if you have doxygen
make test # also takes a while
make install # installs into <TARGET_DIR_IN_HOME>
add the following to your ~/.bashrc: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<TARGET_DIR_IN_HOME>/lib
Hope this helps!
Andres
You can install using conda with the following command.
conda install -c anaconda cudatoolkit
But you need to have prior accesss to the device(GPU).
EDIT : If you are finding error in anaconda repository then change the repository to conda-forge which is frequently updated.
conda install -c conda-forge cudatoolkit
You can install CUDA and compile programs, but you won't be able to run them for a lack of device access.

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.