Tuesday 30 December 2014

Kompilasi TIM-OS: A General Monte Carlo Optical Simulator for Biomedical Optics

Windows : Visual Studio dengan Intel C++ Compiler

Ketika kompilasi, salah satu issue yang didapat adalah tidak dapat meng-include pthread.h, pthread.h dapat didapatkan di [1].

Sesudah masalah pthread.h beres, tinggal mengedit Additional IncludeDirectories untuk memasukkan header-header MKL (Math Kernel Library).

Entri nya menjadi :

C:\Program Files (x86)\Intel\Composer XE 2015\mkl\include;D:\software\pthreads-w32-2-9-1-release\Pre-built.2\include;%

Masalah utama sekarang adalah, ada beberapa header yang tidak terdapat di windows, yaitu :

sys/sysinfo.h ,  sys/systime.h, sys/resource.h

Berikut error lengkap ketika proses kompilasi :
Error 1 error MSB6006: "icl.exe" exited with code 4. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Platforms\Win32\PlatformToolsets\Intel C++ Compiler XE 15.0\Toolset.targets 327 5 TIM-OS
2 IntelliSense: cannot open source file "sys/sysinfo.h" d:\!Photodinamic\TIM-OS\TIM-OS\TIM-OS\TIMOS.cpp 29 1 TIM-OS
3 IntelliSense: cannot open source file "sys/time.h" d:\!Photodinamic\TIM-OS\TIM-OS\TIM-OS\TIMOS.cpp 30 1 TIM-OS
4 IntelliSense: cannot open source file "sys/resource.h" d:\!Photodinamic\TIM-OS\TIM-OS\TIM-OS\TIMOS.cpp 31 1 TIM-OS
5 IntelliSense: identifier "nanosleep" is undefined d:\!Photodinamic\TIM-OS\TIM-OS\TIM-OS\TIMOS.cpp 989 5 TIM-OS
6 IntelliSense: identifier "nanosleep" is undefined d:\!Photodinamic\TIM-OS\TIM-OS\TIM-OS\TIMOS.cpp 1204 5 TIM-OS
7 IntelliSense: incomplete type is not allowed d:\!Photodinamic\TIM-OS\TIM-OS\TIM-OS\TIMOS.cpp 2355 18 TIM-OS
8 IntelliSense: identifier "gettimeofday" is undefined d:\!Photodinamic\TIM-OS\TIM-OS\TIM-OS\TIMOS.cpp 2356 3 TIM-OS
9 IntelliSense: incomplete type is not allowed d:\!Photodinamic\TIM-OS\TIM-OS\TIM-OS\TIMOS.cpp 2357 18 TIM-OS
10 IntelliSense: incomplete type is not allowed d:\!Photodinamic\TIM-OS\TIM-OS\TIM-OS\TIMOS.cpp 2357 45 TIM-OS
11 IntelliSense: expression must have a constant value d:\!Photodinamic\TIM-OS\TIM-OS\TIM-OS\TIMOS.cpp 2506 23 TIM-OS
12 IntelliSense: no suitable constructor exists to convert from "int" to "ptw32_handle_t" d:\!Photodinamic\TIM-OS\TIM-OS\TIM-OS\TIMOS.cpp 2513 24 TIM-OS
13 IntelliSense: no operator "!=" matches these operands
            operand types are: pthread_t != int d:\!Photodinamic\TIM-OS\TIM-OS\TIM-OS\TIMOS.cpp 2519 14 TIM-OS

Linux - Ubuntu 12.04 : Eclipse dengan Intel C++ Compiler

Pastikan Intel C++ Compiler sudah terinstall.

Masukkan icpp ke path, edit .bashrc, tambahkan :

export PATH=$PATH:/opt/intel/bin

Ketika mencoba melakukan kompilasi, terjadi error :

$ icpc -static -mkl -O3 -o timos TIMOS.cpp
icpc: error #10001: could not find directory in which g++ resides


Instal paket g++ dengan menjalankan perintah :

sudo apt-get install g++ 

Ketika mencoba melakukan kompilasi, terjadi error :

$icpc -static -mkl -O3 -o timos TIMOS.cpp
TIMOS.cpp(1317): error: invalid type conversion: "void *" to "unsigned int"
    unsigned int tid = (unsigned int) threadid;

Referensi

  1. pthreads-win32, ftp://sourceware.org/pub/pthreads-win32
  2. What is an alternative to including sys/times.h on windows?, http://stackoverflow.com/questions/24741553/what-is-an-alternative-to-including-sys-times-h-on-windows

2 comments: