Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
STIR
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Installing STIR with CMake
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
= Stage 3: actual compilation = The previous step used CMake to generate files for the build system appropriate for your OS. Now, you need to use the build system to compile STIR. We list the most common ones: == Unix-type systems: make == CMake will have created a series of directories in STIR-bin with a series of Makefiles. To build STIR, you just type <pre> make </pre> If there are compilation problems, you might want to see the compilation commands: <pre> make VERBOSE=1 </pre> Run the tests (see also next section). <pre> make test </pre> You would normally finish with <pre> make install </pre> === Potential problems === On Linux, you might see an error like <pre> /usr/bin/ld: /home/user/ecat/lib/libecat.a(matrix_extra.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC </pre> This can happen when you enable shared libraries in STIR, or when you build the Python or MATLAB support. The reason for this error is that Python/MATLAB modules are shared libraries and on Linux this sadly means that all code needs to be compiled with ''-fPIC''. The same error would occur with other external libraries such as ITK. Unfortunately the only solution is to recompile all dependent libraries with the appropriate flag, or disable them in STIR of course. For the ecat library, this can be done as follows <pre> cd ecat # or wherever the source is make -f Makefile.unix CC="gcc -fPIC" </pre> For libraries built with CMake, use something like <pre> cmake -DBUILD_POSITION_DEPENDENT_CODE=ON ... </pre> == Visual Studio/XCode and other systems with an IDE for compilation == CMake will have created a series of directories in the build directory with the necessary projects files. For example, for Visual studio, there will be a STIR.sln with targets ALL_BUILD, INSTALL, RUN_TESTS (and projects for every for every library and executable). You would open the STIR solution, and build the relevant target. Remember to set the type of build (Release or Debug) first from your GUI. == Windows using msbuild == If you have chosen Visual Studio output, you can build via the IDE as above. However, you can also use MSBuild. This would for instance be a good choice if you want to use the Windows SDK compilers (as opposed to normal Visual Studio). This could go as follows * open a command prompt with the path set for your build environment * cd to the location where you instructed CMake to generate the build files * you can build a single project or the whole solution, e.g. ** build all targets in Debug mode <pre> MSBuild ALL_BUILD.vcxproj /p:Configuration=Debug </pre> ** run the tests in Debug mode (see also next section) <pre> MSBuild RUN_TESTS.vcxproj /p:Configuration=Debug </pre> ** install all targets (compiled in Release mode) <pre> MSBuild INSTALL.vcxproj /p:Configuration=Release </pre> == Build from command line using CMake == Independent of what generator you used, variations on the following should work from a command prompt <pre> cmake --build . --target ALL_BUILD --config Release </pre>
Summary:
Please note that all contributions to STIR may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
STIR:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width