Skip to content

Latest commit

 

History

History
149 lines (103 loc) · 7.09 KB

How_to_build_me.md

File metadata and controls

149 lines (103 loc) · 7.09 KB

How to compile

Birdee can be compiled by two different IDEs, while both ways differ slightly.

##Requirements and Dependencies

  • LLVM (version 3.4.2)
  • Visual Studio 2010 or later (recommended for browsering this project on Windows)
  • Code::Blocks (recommended for building this project on Windows and Linux)
  • libmemcached
  • memcached (if you are doing distributed computation. Otherwise, not needed)

Fortunately, we provide a pre-built static library pack with LLVM and libmemcached (x86 and x64) on Windows for MingW and Visual Studio. Here, click "下载(33.3M)" to download. If you are using Linux, here is the static library of LLVM.

##Build Birdee on Ubuntu

sudo apt-get install ncurses-dev
sudo apt-get install libmemcached-dev
sudo apt-get install llvm-3.4-dev
cd Birdee/src/Birdee/Birdee
make debug

Birdee binary will be available in "Birdee/src/Birdee/Birdee/bin/Debug"

##Build Birdee on Windows

###First thing first On the cluster nodes that Birdee runs on, you should run an instance of memcached.

  • The distributed memory system of Birdee is based on libmemcached. You should first build the libmemcached library. In windows, a ready-to-compile Visual Studio libmemcached project file is available (FIX-ME : add URL). After compiling the project, you can have the files "libmemcached.lib","libmemcached.dll" and "libmemcached.def".
  • Collect all the header files of libmemcached. Create a folder called libmemcached at the parent folder of the root folder of Birdee project. Copy all ".h" files to the newly created folder. Create a folder called "memcached" in folder "libmemcached", put "protocol_binary.h" into it.
  • Link/Copy the file "inttypes.h" (which you can find in the libmemcached VS project) into the parent folder of the root folder of Birdee project.
  • Link/Copy the files "libmemcached.lib","libmemcached.dll" and "libmemcached.def" at the folder above.
  • (If you are going to compile Birdee with mingw/Codeblocks) You can find "dlltool" at "mingw/bin". Use the tool by the command "dlltool --dllname libmemcached.dll --def libmemcached.def --output-lib libmemcached.a" at the folder above to create gcc style static lib.

Build Birdee with Visual Studio

You should first fetch and compile LLVM (version 3.4.2). Here is a tutorial for compiling a static LLVM library which is needed by Birdee. a tutorial for compiling LLVM into a static lib(Chinese) There are still some more things to do after you get the static library "libLLVMLite.lib".

  • Link/Copy the directory "llvm-3.4.2.src/include" to the same directory holding the root directory of the source code of Birdee. (For example, if the Birdee source code is in directory 'Birdee-src', and the parent directory of 'Birdee-src' is 'codes', then put the 'include' directory into 'codes')
  • After using cmake to configure the LLVM source code, you will get a VisualStudio Project directory. Link/Copy the directory "include" in the project directory to the same diectory above, re-naming as 'include2'.
  • Link/Copy the static library "libLLVMLite.lib" to the to the same diectory above. Then open the Visual Studio solution file "/Birdee/Birdee.sln". Now you should be able to compile and run Birdee with Visual Studio!

Build Birdee in Code::Blocks (Linux and Windows)

As the Visual Studio approach of compiling Birdee, building Birdee with Code::Blocks also need a static library of LLVM compiled by GCC or MinGW (version 3.4.2). To build LLVM with MinGW, the following steps are to be taken.

  • Use cmake to make the CodeBlocks project files for LLVM.
  • In cmake, choose the path to the project files generated by cmake. (in this tutorial, the path is supposed as "c:\llvm_cb",you can choose your own choise of directory.)
  • Click "configure" and choose the generator "CodeBlocks - MinGW makefiles" and "Use default native compilers"
  • Click "Generate" to make the CodeBlocks project files for LLVM
  • Open c:\llvm_cb\LLVM.cbp
  • Compile this project
  • Create a ".bat" file at "c:\llvm_cb\lib"
  • Put the following lines in the ".bat" file. (Note that "ar.exe" can be found at "path\to\CodeBlocks\MinGW\bin", you should either replace all of the occurence of "ar.exe" with the full path of it or add "path\to\CodeBlocks\MinGW\bin" to the "path" environment variable.)
  ar x libLLVMCore.a
  
  ar x libLLVMCodeGen.a
  
  ar x libLLVMExecutionEngine.a
  
  ar x libLLVMTarget.a
  
  ar x libLLVMJIT.a
  
  ar x libLLVMScalarOpts.a
  
  ar x libLLVMSupport.a
  
  ar x libLLVMAnalysis.a
  
  ar x libLLVMMC.a
  
  ar x libLLVMX86AsmParser.a
  
  ar x libLLVMX86AsmPrinter.a
  
  ar x libLLVMX86Desc.a
  
  ar x libLLVMX86Info.a
  
  ar x libLLVMX86Utils.a
  
  ar x libLLVMX86CodeGen.a
  
  ar x libLLVMSelectionDAG.a
  
  ar x libLLVMObject.a
  
  ar x libLLVMTransformUtils.a
  
  ar x libLLVMBitWriter.a 
  
  ar x libLLVMBitReader.a
  
  ar x libLLVMMCJIT.a
  
  ar x libLLVMRuntimeDyld.a
  
  ar x libLLVMAsmPrinter.a
  
  ar x libLLVMAsmParser.a
  
  ar x libLLVMMCParser.a
  
  ar x libLLVMBitReader.a

  ar x libLLVMBitWriter.a

  ar x libLLVMVectorize.a

  ar x libLLVMipa.a
  
  ar x libLLVMipo.a
  
  ar x libLLVMInstCombine.a

  ar rcs libLLVMLite.a *.obj ./CodeGen/CMakeFiles/LLVMCodeGen.dir/Analysis.cpp.obj
  
  del *.obj
  
  pause
  • Execute the ".bat" file, and "libLLVMLite.a" should be ready at "lib" directory.

After the static library is obtained, a few more steps should be done to compile Birdee.

  • Link/Copy the directory "llvm-3.4.2.src/include" to the same directory holding the root directory of the source code of Birdee. (For example, if the Birdee source code is in directory 'Birdee-src', and the parent directory of 'Birdee-src' is 'codes', then put the 'include' directory into 'codes')
  • Link/Copy the directory "c:\llvm_cb\include" in the project directory to the same diectory above, re-naming as 'include3'.
  • Link/Copy the static library "libLLVMLite.a" to the to the same diectory above.

Then open "src\Birdee\Birdee\Birdee.cbp" if you are using Windows (or "\Birdee\Birdee\Birdee.linux.cbp" if you are using Linux), and everything should be okay to build Birdee! Or, if you are using "makefile" to build Birdee, change the current directory to src\Birdee\Birdee, and enter "make debug" to compile.

##Install Birdee into your system If you are using Birdee on Linux,

  • First switch to Birdee's root directory in a terminal, and run the script make_lib.sh (sh make_lib.sh)
  • Add the path to the "lib" directory to the environment variables. "sudo vi /etc/profile" then add the following two lines at end of the file:
export DKH_LOAD_SEARCH_PATH=/home/menooker/Birdee/Birdee/lib
export BDL_LOAD_SEARCH_PATH=/home/menooker/Birdee/Birdee/lib
  • Refresh the environment variables. "source /etc/profile"

If you are using Birdee on Windows,

  • Run cmd.exe as admin.
  • Switch to Birdee's root directory. "cd /d c:\Menooker\Birdee"
  • Run the script "make_install.bat" in the cmd window. "make_install.bat"

Now installation of Birdee is done.