Showing posts with label llvm. Show all posts
Showing posts with label llvm. Show all posts

Friday, April 19, 2013

Rust 0.6 for Fedora



The previous draft spec wasn't able to build rust with the official 0.6 sources. The spec file is now updated and you can build your own rust package using:
$ curl -O https://raw.github.com/fabiand/rust-spec/master/rust.spec
$ nice ionice rpmbuild --noclean -ba -v rust.spec

It is assumed that you've got a working fedora-package setup and an internet connection.

Changes are mainly that chrpath is used to remove rpaths from files. Rust is still using it's own libuv and llvm.

Friday, December 9, 2011

OpenCL on Fedora: A quick look at building pocl.

Finally a 3.0 release candidate of llvm is packaged for Fedora and available via rawhide. Many of the current OpenCL implementations like pocl and clover depend on llvm-3.0 and with this release it is finally an easy thing to build pocl on Fedora.
pocl has some other pre-requirements besides clang/llvm, after installing them you can just build the software as usual:

$ sudo yum install --enablerepo=rawhide llvm-devel llvm clang \
libtool-ltdl

$ git clone 
$ bzr branch lp:pocl
$ bash autogen.sh
$ ./configure
$ make
$ make check

Wednesday, October 5, 2011

From vala to js - with emscripten.

Stumbling over emscripten again. A fun tool to compile llvm bytecode to JavaScript.
After installing some basic dependencies via
$ sudo yum install vala clang js
and a bit of glue (see below) and you can quickly run code written in vala using a JavaScript interpreter. All this can be done with all code clang compiles, so there is no more magic than normal involved.

$ cd /tmp
$ git clone https://github.com/kripken/emscripten.git
$ wget http://closure-compiler.googlecode.com/files/compiler-latest.zip
$ unzip compiler-latest.zip

Now that all software is in place, do some configurations by editing ~/.emscripten:

$ cat <<EOF ~/.emscripten
# path where you cloned emscripten
EMSCRIPTEN_ROOT=os.path.expanduser("~/tmp/emscripten") 
# I needed to link EMSCRIPTEN_ROOT/src/tmp to this path e.g. 
TEMP_DIR='/tmp' 

LLVM_ROOT=os.path.expanduser('/usr/bin/')
#LLVM_GCC=... # we don't have that on fedora
COMPILER_OPTS = ['-m64'] # Change to your arch!

SPIDERMONKEY_ENGINE = [os.path.expanduser('/usr/bin/js'), '-m']
COMPILER_ENGINE=SPIDERMONKEY_ENGINE
JS_ENGINE=SPIDERMONKEY_ENGINE
CLOSURE_COMPILER = os.path.expanduser('~/tmp/emscripten/closure-compiler.jar')

TIMEOUT=None
EOF

Basically now everything is in place. Using the following snippet
struct FooBar
{
	int m;
	public void wtf ()
	{
		stdout.printf ("Wtf!\n"); // The \n is important.
	}
}

void main()
{
	FooBar f = FooBar ();
	f.wtf ();
}

... we can compile and execute the whoole thing using the following lines:

$ valac --profile=posix --ccode vaem.vala
$ clang -emit-llvm -S -o vaem.ll vaem.c
$ ./emscripten.py va/vaem.ll -o vaem.js
$ js -m vaem.js
Wtf!
$

We need to use the posix profile, otherwise we need to compile the whole glib/gobject system using emscripten. Another way of creating JavaScript from vala code is using maja.