IfcPlusPlus: Difference between revisions

From FreeCAD Documentation
(→‎Fixes for Linux: This repository is often a few commits behind the main distribution, but the functionality of the sample viewer should be the same in general.)
(in common usage, the names "IfcQuery", "IFC++", and "IfcPlusPlus" may be used interchangeably to refer to the same thing, the C++ library, or more specifically the free IFC viewer.)
 
(21 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Work in progress}}
<translate>
<languages/>
<languages/>
<translate>


== Description ==
== Description == <!--T:1-->


</translate>
</translate>
Line 9: Line 8:
<translate>
<translate>


<!--T:2-->
[[IfcPlusPlus|IFC++]] or [[IfcPlusPlus|IfcPlusPlus]] is a C++ open source (MIT license) library from the IfcQuery project for reading, writing, and viewing [[Arch_IFC|IFC]] files.
[[IfcPlusPlus|IFC++]] or [[IfcPlusPlus|IfcPlusPlus]] is a C++ open source (MIT license) library from the [[IfcPlusPlus|IfcQuery]] project for reading, writing, and viewing [[Arch_IFC|IFC]] files.


<!--T:3-->
The IFC++ library can be used for general purpose, and it also includes a sample IFC visualization application. This viewer is based on Qt 5 and OpenSceneGraph (OSG), and can load big IFC files very fast, and thus can be used to compare the performance of other IFC viewers, like Blender and FreeCAD, which internally use the [[IfcOpenShell|IfcOpenShell]] library.
The IFC++ library can be used for general purpose, and it also includes a sample IFC visualization application. This viewer is based on Qt 5 and OpenSceneGraph (OSG), and can load big IFC files very fast, and thus can be used to compare the performance of other IFC viewers, like Blender and FreeCAD, which internally use the [[IfcOpenShell|IfcOpenShell]] library.


</translate>
== Installing ==
[[File:IfcQuery_viewer_example.png|600px]]
<translate>

<!--T:4-->
{{Caption|The sample IFC viewer included in the source distribution of the IfcQuery/IFC++ libraries.}}

<!--T:5-->
{{Emphasis|Note:}} in common usage, the names "IfcQuery", "IFC++", and "IfcPlusPlus" may be used interchangeably to refer to the same thing, the C++ library, or more specifically the free IFC viewer.

== Installing == <!--T:6-->

<!--T:7-->
The IFC++ distribution is provided as source code, so to use the library and the viewer, the code must be compiled.


<!--T:8-->
The IFC++ distribution is provided as source code, so to use the library and the viewer, the code must be compiled before it can be used.
IFC++ is developed mostly on a Windows platform, so it includes solution ({{incode|.snl}}) and project ({{incode|.vcxproj}}) files to compile the {{incode|IfcPlusPlus.dll}} dynamic library using Visual Studio. A static library {{incode|libIfcPlusPlus.a}} can also be produced for Linux using CMake.


<!--T:9-->
IFC++ is developed mostly on a Windows platform, so it includes solution files ({{incode|.snl}}) to compile the {{incode|IfcPlusPlus.dll}} dynamic library using Visual Studio. A static library {{incode|libIfcPlusPlus.a}} can also be produced for Linux using CMake.
{{Emphasis|Note:}} there is a more complete viewer that uses pre-compiled IFC++ libraries intended for Windows. This viewer is free for use but is not open source. It is available by downloading the {{incode|SimpleViewerExampleQt.zip}} package from {{URL|http://www.ifcquery.com/}}, and running {{incode|SimpleViewerExampleQt.exe}}. This viewer is self-contained, everything that it requires to run is included in the {{incode|.zip}} archive.


== Compiling in Windows ==
== Compiling in Windows == <!--T:10-->


<!--T:11-->
Follow the instructions in the official [https://github.com/ifcquery/ifcplusplus ifcplusplus] repository.
Follow the instructions in the official [https://github.com/ifcquery/ifcplusplus ifcplusplus] repository.


== Compiling in Linux ==
== Compiling in Linux == <!--T:12-->


<!--T:13-->
The general instructions are as follows:
The general instructions are as follows:
# Get the source code of IFC++ from its main repository.
# Get the source code of IFC++ from its main repository.
Line 31: Line 49:
# Install the {{incode|libIfcPlusPlus.a}} and {{incode|libcarve.so}} libraries to the appropriate library path so that they are found by the IFC++ sample viewer.
# Install the {{incode|libIfcPlusPlus.a}} and {{incode|libcarve.so}} libraries to the appropriate library path so that they are found by the IFC++ sample viewer.


=== Prerequisites ===
=== Prerequisites === <!--T:14-->


<!--T:15-->
In a Debian/Ubuntu based distribution, getting the required development files is usually simple.
In a Debian/Ubuntu based distribution, getting the required development files is usually simple.
</translate>
</translate>
Line 41: Line 60:
<translate>
<translate>


<!--T:16-->
Get the source code of the project and place it in a custom directory to which you have full write access.
Get the source code of the project and place it in a custom directory to which you have full write access.
</translate>
</translate>
Line 48: Line 68:
<translate>
<translate>


=== OpenSceneGraph ===
=== OpenSceneGraph === <!--T:17-->


<!--T:18-->
[http://www.openscenegraph.org/ OpenSceneGraph] (OSG) is a collection of C++ libraries that uses OpenGL for 3D visualization; it can be used in games, virtual reality, scientific visualization and modelling.
[http://www.openscenegraph.org/ OpenSceneGraph] (OSG) is a collection of C++ libraries that uses OpenGL for 3D visualization; it can be used in games, virtual reality, scientific visualization and modelling.


Line 58: Line 79:
<translate>
<translate>


<!--T:19-->
If the files are too old in your distribution, you may also compile the libraries yourself. The procedure is outlined in the main repository, [https://github.com/openscenegraph/OpenSceneGraph openscenegraph/OpenSceneGraph]. Compiling is straight forward, although you may need various dependencies like Qt 5, Freetype, Inventor, OpenEXR, COLLADA, ZLIB, GDAL, FFmpeg, Gstreamer, SDL, Cairo, and Poppler.
If the files are too old in your distribution, you may also compile the libraries yourself. The procedure is outlined in the main repository, [https://github.com/openscenegraph/OpenSceneGraph openscenegraph/OpenSceneGraph]. Compiling is straight forward, although you may need various dependencies like Qt 5, Freetype, Inventor, OpenEXR, COLLADA, ZLIB, GDAL, FFmpeg, Gstreamer, SDL, Cairo, and Poppler.


Line 73: Line 95:
<translate>
<translate>


=== Carve ===
=== Carve === <!--T:20-->


<!--T:21-->
Carve is a [[constructive_solid_geometry|constructive solid geometry]] (CSG) C++ library designed to perform boolean operations between two arbitrary polygonal meshes. Together with the IFC++ library, {{incode|libIfcPlusPlus.a}}, Carve is used by the IFC++ sample viewer to open and display IFC files.
Carve is a [[constructive_solid_geometry|constructive solid geometry]] (CSG) C++ library designed to perform boolean operations between two arbitrary polygonal meshes. Together with the IFC++ library, {{incode|libIfcPlusPlus.a}}, Carve is used by the IFC++ sample viewer to open and display IFC files.


<!--T:22-->
* Original repository: [https://code.google.com/archive/p/carve/ carve], GPL2, from 2009 to 2011.
* Original repository: [https://code.google.com/archive/p/carve/ carve], GPL2, from 2009 to 2011.
* New repository: [https://github.com/folded/carve folded/carve], from 2011 onwards; the project changed to the MIT License starting on October, 2015.
* New repository: [https://github.com/folded/carve folded/carve], from 2011 onwards; the project changed to the MIT License starting on October, 2015.


<!--T:23-->
As the project is now MIT licensed, copies of the Carve source files are now included in the IFC++ repository. This means that when compiling IFC++, {{incode|libcarve.so}} will be compiled as well. This library must be available in the system for the IFC++ sample viewer to work properly.
As the project is now MIT licensed, copies of the Carve source files are now included in the IFC++ repository. This means that when compiling IFC++, {{incode|libcarve.so}} will be compiled as well. This library must be available in the system for the IFC++ sample viewer to work properly.


=== CMake configuration ===
=== CMake configuration === <!--T:24-->


<!--T:25-->
It is recommended to perform the configuration and compilation in a specific build directory separate from the source directory.
It is recommended to perform the configuration and compilation in a specific build directory separate from the source directory.


Line 95: Line 121:
<translate>
<translate>


<!--T:26-->
By default the type of build is {{incode|Release}} but it can also be set to {{incode|Debug}}.
By default the type of build is {{incode|Release}} but it can also be set to {{incode|Debug}}.
</translate>
</translate>
Line 102: Line 129:
<translate>
<translate>


=== Actual compilation ===
=== Actual compilation === <!--T:27-->


<!--T:28-->
If there were no error messages during configuration with CMake, a {{incode|Makefile}} should have been created in the build directory, so you can proceed to compile the libraries by running {{incode|make}}.
If there were no error messages during configuration with CMake, a {{incode|Makefile}} should have been created in the build directory, so you can proceed to compile the libraries by running {{incode|make}}.


Line 112: Line 140:
<translate>
<translate>


<!--T:29-->
{{incode|N}} is the number of processors that you assign to the compilation process; choose at least one fewer than the total number of CPU cores that you have.
{{incode|N}} is the number of processors that you assign to the compilation process; choose at least one fewer than the total number of CPU cores that you have.


=== Testing the compilation in the build directory ===
=== Testing the compilation in the build directory === <!--T:30-->


<!--T:31-->
If the build was successful you should have a {{incode|Release/}} subdirectory with the newly compiled libraries.
If the build was successful you should have a {{incode|Release/}} subdirectory with the newly compiled libraries.
</translate>
</translate>
Line 125: Line 155:
<translate>
<translate>


<!--T:32-->
You can launch the {{incode|SimpleViewerExample}} executable with an [[Arch_IFC|IFC]] file as input.
You can launch the {{incode|SimpleViewerExample}} executable with an [[Arch_IFC|IFC]] file as input.
</translate>
</translate>
Line 132: Line 163:
<translate>
<translate>


<!--T:33-->
If the build type was set to {{incode|Debug}}, then the compiled libraries will appear in the {{incode|Debug/}} subdirectory instead.
If the build type was set to {{incode|Debug}}, then the compiled libraries will appear in the {{incode|Debug/}} subdirectory instead.


=== Installation of the compiled libraries ===
=== Installation of the compiled libraries === <!--T:34-->


<!--T:35-->
If the compilation doesn't report any errors, you may run {{incode|make install}} to copy the headers, compiled libraries, and binaries to their corresponding installation directories.
If the compilation doesn't report any errors, you may run {{incode|make install}} to copy the headers, compiled libraries, and binaries to their corresponding installation directories.
</translate>
</translate>
Line 143: Line 176:
<translate>
<translate>


<!--T:36-->
By default, the {{incode|CMAKE_INSTALL_PREFIX}} is {{incode|/usr/local/}}, so all compiled files will be placed under this directory, which normally requires elevated privileges.
By default, the {{incode|CMAKE_INSTALL_PREFIX}} is {{incode|/usr/local/}}, so all compiled files will be placed under this directory, which normally requires elevated privileges.
</translate>
</translate>
{{Code|code=
{{Code|lang=sh|code=
/usr/local/bin/SimpleViewerExample
/usr/local/bin/SimpleViewerExample
/usr/local/lib/libcarve.so
/usr/local/lib/libcarve.so
Line 162: Line 196:
<translate>
<translate>


=== Library path ===
=== Library path === <!--T:37-->


<!--T:38-->
In certain systems {{incode|libcarve.so}} may not be found by the library loader {{incode|ld.so}} if it is installed in the default {{incode|/usr/local/lib}} directory.
Once {{incode|SimpleViewerExample}} is placed in {{incode|/usr/local/bin}}, the executable will be available in the entire system. However, in certain platforms {{incode|libcarve.so}} may not be found if it is installed in the default {{incode|/usr/local/lib}} directory.
</translate>
{{Code|lang=md|code=
SimpleViewerExample: error while loading shared libraries: libcarve.so: cannot open shared object file: No such file or directory
}}
<translate>


<!--T:39-->
If this is the case, you may have to update the cache of libraries:
If this is the case, it may be enough to update the cache of the {{incode|ld.so}} library loader by calling {{incode|ldconfig}}:
</translate>
</translate>
{{Code|code=
{{Code|code=
Line 173: Line 214:
<translate>
<translate>


<!--T:40-->
Or you may have to move it to the correct directory first:
Or you may have to move the library to the correct directory first:
</translate>
</translate>
{{Code|code=
{{Code|code=
Line 182: Line 224:
<translate>
<translate>


<!--T:41-->
Alternatively, you may set the {{incode|LD_LIBRARY_PATH}} variable to the right directory before launching the executable:
Alternatively, you may set the {{incode|LD_LIBRARY_PATH}} variable to the directory containing {{incode|libcarve.so}}, before launching the executable:
</translate>
</translate>
{{Code|code=
{{Code|code=
Line 189: Line 232:
<translate>
<translate>


<!--T:42-->
To make this effect persistent, this environmental variable can be set in the corresponding {{incode|.bashrc}} resource file, so that it is propagated to all terminal instances on startup:
To make this effect persistent, this environmental variable can be set in the shell resource file, for example, {{incode|.bashrc}}, so that it is propagated to all terminal instances on startup:
</translate>
</translate>
{{Code|code=
{{Code|code=
Line 196: Line 240:
<translate>
<translate>


=== Removing the compiled libraries ===
=== Removing the compiled libraries === <!--T:43-->


<!--T:44-->
To remove the installed libraries, just remove the corresponding files that were installed.
To remove the installed libraries, just remove the corresponding files that were installed.
</translate>
</translate>
{{Code|code=
{{Code|lang=sh|code=
sudo rm -rf /usr/local/bin/SimpleViewerExample
sudo rm -rf /usr/local/bin/SimpleViewerExample
sudo rm -rf /usr/local/lib/libcarve.so
sudo rm -rf /usr/local/lib/libcarve.so
Line 210: Line 255:
<translate>
<translate>


== Fixes for Linux ==
== Fixes for Linux == <!--T:45-->


<!--T:46-->
The IFC++ library is developed by its author on a Windows system. This means that even if the code depends on multiplatform libraries like Boost, Qt, and OpenSceneGraph, the code is mostly tested to compile and run on Windows. Nevertheless, over the years other developers have provided fixes to the project so that IFC++ can be compiled and run on Linux distributions.
The IFC++ library is developed by its author on a Windows system. This means that even if the code depends on multiplatform libraries like Boost, Qt, and OpenSceneGraph, the code is mostly tested to compile and run on Windows. Nevertheless, over the years other developers have provided fixes to the project so that IFC++ can be compiled and run on Linux distributions.


<!--T:47-->
In particular, a fork of the main project is maintained with small fixes to compile the code better in Debian.
In particular, a fork of the main project is maintained with small fixes to compile and run better in Debian.
* [https://github.com/berndhahnebach/ifcplusplus/ berndhahnebach/ifcplusplus]
* [https://github.com/berndhahnebach/ifcplusplus/ berndhahnebach/ifcplusplus]


<!--T:48-->
If the official repository does not work or seems to have issues in Linux, try following the same compilation instructions but using the sources from this alternative repository. This repository is often a few commits behind the main distribution, but the functionality of the sample viewer should be the same in general. Nevertheless, it is updated occasionally to keep it in sync with the main repository, and at the same time provide some Linux specific fixes whenever it is required. These improvements are normally submitted to the main repository in order to make the official branch compile in Linux without issues.
If the code of the official repository does not work or seems to have issues in Linux, try following the same compilation instructions but using the sources from this alternative repository. This repository is often some commits behind the main distribution, but it aims to remain up to date, and at the same time provide some Linux specific fixes. These improvements are normally submitted back to the main repository in order to make the official branch compile on Linux without issues.


<!--T:49-->
Unfortunately the main developer of IFC++ does not support Linux directly, so Linux developers should be prepared to troubleshoot problems, fix them, and submit patches when using IFC++ in Linux.
The main developer of IFC++ does not support Linux directly, so Linux developers should be prepared to troubleshoot problems, fix them, and submit patches when using IFC++ in Linux.


=== Invisible icons === <!--T:50-->
== More information ==


<!--T:51-->
For the {{incode|SimpleViewerExample}}, there are two buttons in the main interface which are invisible if the custom style sheet is not found.
</translate>
{{Code|lang=cpp|code=
QIODevice::read (QFile, ":styles.css"): device not open
}}
<translate>

<!--T:52-->
The style must be included in the CMake configuration in the section devoted to the Qt libraries:
</translate>
{{Code|lang=cmake|code=
# ifcplusplus-source/examples/SimpleViewerExampleQt/CMakeLists.txt
...
ADD_DEFINITIONS(${Qt5Widgets_DEFINITIONS})

SET(viewer_dir ${IFCPP_SOURCE_DIR}/examples/SimpleViewerExampleQt)
SET(RESOURCES ${viewer_dir}/Resources/ifcplusplus.qrc)
QT5_ADD_RESOURCES(SimpleViewerExample_RESOURCES_RCC ${RESOURCES})
}}
<translate>

== More information == <!--T:53-->

<!--T:54-->
* [https://www.ifcquery.com/ IFC++ project page]
* [https://www.ifcquery.com/ IFC++ project page]
* [https://github.com/ifcquery/ifcplusplus ifcquery/ifcplusplus] repository
* [https://github.com/ifcquery/ifcplusplus ifcquery/ifcplusplus] repository
* Alternative repository, especially for Debian: [https://github.com/berndhahnebach/ifcplusplus/ berndhahnebach/ifcplusplus]
* Forum thread: [https://forum.freecadweb.org/viewtopic.php?f=39&t=5101 IFC Viewer ifcplusplus] (2013 to 2020)
* Forum thread: [https://forum.freecadweb.org/viewtopic.php?f=39&t=5101 IFC Viewer ifcplusplus] (2013 to 2020)
* [https://forum.freecadweb.org/viewtopic.php?f=39&t=33254 IfcPlusPlus compiled on Gentoo - questions and alternatives?]
* [https://forum.freecadweb.org/viewtopic.php?f=39&t=33254 IfcPlusPlus compiled on Gentoo - questions and alternatives?]
* German thread: [https://forum.freecadweb.org/viewtopic.php?f=13&t=48648 IfcQuery / IfcPlusPlus selber kompilieren]
* German thread: [https://forum.freecadweb.org/viewtopic.php?f=13&t=48648 IfcQuery / IfcPlusPlus selber kompilieren]

</translate>
</translate>
{{Arch Tools navi{{#translation:}}}}
{{Arch Tools navi{{#translation:}}}}
{{FEM Tools navi{{#translation:}}}}
{{FEM Tools navi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{Userdocnavi{{#translation:}}}}
{{clear}}

Latest revision as of 06:29, 25 August 2020

Other languages:

Description

IFC++ or IfcPlusPlus is a C++ open source (MIT license) library from the IfcQuery project for reading, writing, and viewing IFC files.

The IFC++ library can be used for general purpose, and it also includes a sample IFC visualization application. This viewer is based on Qt 5 and OpenSceneGraph (OSG), and can load big IFC files very fast, and thus can be used to compare the performance of other IFC viewers, like Blender and FreeCAD, which internally use the IfcOpenShell library.

The sample IFC viewer included in the source distribution of the IfcQuery/IFC++ libraries.

Note: in common usage, the names "IfcQuery", "IFC++", and "IfcPlusPlus" may be used interchangeably to refer to the same thing, the C++ library, or more specifically the free IFC viewer.

Installing

The IFC++ distribution is provided as source code, so to use the library and the viewer, the code must be compiled.

IFC++ is developed mostly on a Windows platform, so it includes solution (.snl) and project (.vcxproj) files to compile the IfcPlusPlus.dll dynamic library using Visual Studio. A static library libIfcPlusPlus.a can also be produced for Linux using CMake.

Note: there is a more complete viewer that uses pre-compiled IFC++ libraries intended for Windows. This viewer is free for use but is not open source. It is available by downloading the SimpleViewerExampleQt.zip package from http://www.ifcquery.com/, and running SimpleViewerExampleQt.exe. This viewer is self-contained, everything that it requires to run is included in the .zip archive.

Compiling in Windows

Follow the instructions in the official ifcplusplus repository.

Compiling in Linux

The general instructions are as follows:

  1. Get the source code of IFC++ from its main repository.
  2. Gather all dependencies for compiling, including a C++ compiler, CMake, and Make, and the development files for Boost, Qt 5, as well as the OpenSceneGraph (OSG) library for visualization.
  3. Run cmake to generate a Makefile, then start the compilation by running make.
  4. Install the libIfcPlusPlus.a and libcarve.so libraries to the appropriate library path so that they are found by the IFC++ sample viewer.

Prerequisites

In a Debian/Ubuntu based distribution, getting the required development files is usually simple.

sudo apt install git cmake gcc g++ libboost-all-dev
sudo apt install qt5-qmake qtbase5-dev qttools5-dev libqt5widgets5 libqt5opengl5-dev

Get the source code of the project and place it in a custom directory to which you have full write access.

git clone https://github.com/ifcquery/ifcplusplus ifcplusplus-source

OpenSceneGraph

OpenSceneGraph (OSG) is a collection of C++ libraries that uses OpenGL for 3D visualization; it can be used in games, virtual reality, scientific visualization and modelling.

sudo apt install libopenscenegraph-3.4-dev

If the files are too old in your distribution, you may also compile the libraries yourself. The procedure is outlined in the main repository, openscenegraph/OpenSceneGraph. Compiling is straight forward, although you may need various dependencies like Qt 5, Freetype, Inventor, OpenEXR, COLLADA, ZLIB, GDAL, FFmpeg, Gstreamer, SDL, Cairo, and Poppler.

git clone https://github.com/openscenegraph/OpenSceneGraph OpenSceneGraph-source

mkdir -p OpenSceneGraph-build
cd OpenSceneGraph-build
cmake ../OpenSceneGraph-source

make -j 3
sudo make install

Carve

Carve is a constructive solid geometry (CSG) C++ library designed to perform boolean operations between two arbitrary polygonal meshes. Together with the IFC++ library, libIfcPlusPlus.a, Carve is used by the IFC++ sample viewer to open and display IFC files.

  • Original repository: carve, GPL2, from 2009 to 2011.
  • New repository: folded/carve, from 2011 onwards; the project changed to the MIT License starting on October, 2015.

As the project is now MIT licensed, copies of the Carve source files are now included in the IFC++ repository. This means that when compiling IFC++, libcarve.so will be compiled as well. This library must be available in the system for the IFC++ sample viewer to work properly.

CMake configuration

It is recommended to perform the configuration and compilation in a specific build directory separate from the source directory.

mkdir -p ifcplusplus-build
cd ifcplusplus-build

cmake ../ifcplusplus-source/

By default the type of build is Release but it can also be set to Debug.

cmake -DCMAKE_BUILD_TYPE=Debug ../ifcplusplus-source/

Actual compilation

If there were no error messages during configuration with CMake, a Makefile should have been created in the build directory, so you can proceed to compile the libraries by running make.

make -j N

N is the number of processors that you assign to the compilation process; choose at least one fewer than the total number of CPU cores that you have.

Testing the compilation in the build directory

If the build was successful you should have a Release/ subdirectory with the newly compiled libraries.

Release/libcarve.so
Release/libIfcPlusPlus.a
Release/SimpleViewerExample

You can launch the SimpleViewerExample executable with an IFC file as input.

Release/SimpleViewerExample IfcOpenHouse.ifc

If the build type was set to Debug, then the compiled libraries will appear in the Debug/ subdirectory instead.

Installation of the compiled libraries

If the compilation doesn't report any errors, you may run make install to copy the headers, compiled libraries, and binaries to their corresponding installation directories.

sudo make install

By default, the CMAKE_INSTALL_PREFIX is /usr/local/, so all compiled files will be placed under this directory, which normally requires elevated privileges.

/usr/local/bin/SimpleViewerExample
/usr/local/lib/libcarve.so
/usr/local/lib/libIfcPlusPlus.a
/usr/local/include/carve/*.{h, hpp}
/usr/local/include/ifcpp/geometry/*.h
/usr/local/include/ifcpp/geometry/Carve/*.h
/usr/local/include/ifcpp/geometry/OCC/*.h
/usr/local/include/ifcpp/IFC4/*.h
/usr/local/include/ifcpp/IFC4/include/*.h
/usr/local/include/ifcpp/model/*.h
/usr/local/include/ifcpp/reader/*.h
/usr/local/include/ifcpp/writer/*.h
/usr/local/share/IFCPP/cmake/*.cmake

Library path

Once SimpleViewerExample is placed in /usr/local/bin, the executable will be available in the entire system. However, in certain platforms libcarve.so may not be found if it is installed in the default /usr/local/lib directory.

SimpleViewerExample: error while loading shared libraries: libcarve.so: cannot open shared object file: No such file or directory

If this is the case, it may be enough to update the cache of the ld.so library loader by calling ldconfig:

sudo ldconfig

Or you may have to move the library to the correct directory first:

sudo mkdir -p /usr/local/lib/x86_64-linux-gnu/
sudo mv /usr/local/lib/libcarve.so /usr/local/lib/x86_64-linux-gnu/libcarve.so
sudo ldconfig

Alternatively, you may set the LD_LIBRARY_PATH variable to the directory containing libcarve.so, before launching the executable:

LD_LIBRARY_PATH=/usr/local/lib SimpleViewerExample

To make this effect persistent, this environmental variable can be set in the shell resource file, for example, .bashrc, so that it is propagated to all terminal instances on startup:

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

Removing the compiled libraries

To remove the installed libraries, just remove the corresponding files that were installed.

sudo rm -rf /usr/local/bin/SimpleViewerExample
sudo rm -rf /usr/local/lib/libcarve.so
sudo rm -rf /usr/local/lib/libIfcPlusPlus.a
sudo rm -rf /usr/local/include/carve
sudo rm -rf /usr/local/include/ifcpp
sudo rm -rf /usr/local/share/IFCPP/cmake/

Fixes for Linux

The IFC++ library is developed by its author on a Windows system. This means that even if the code depends on multiplatform libraries like Boost, Qt, and OpenSceneGraph, the code is mostly tested to compile and run on Windows. Nevertheless, over the years other developers have provided fixes to the project so that IFC++ can be compiled and run on Linux distributions.

In particular, a fork of the main project is maintained with small fixes to compile and run better in Debian.

If the code of the official repository does not work or seems to have issues in Linux, try following the same compilation instructions but using the sources from this alternative repository. This repository is often some commits behind the main distribution, but it aims to remain up to date, and at the same time provide some Linux specific fixes. These improvements are normally submitted back to the main repository in order to make the official branch compile on Linux without issues.

The main developer of IFC++ does not support Linux directly, so Linux developers should be prepared to troubleshoot problems, fix them, and submit patches when using IFC++ in Linux.

Invisible icons

For the SimpleViewerExample, there are two buttons in the main interface which are invisible if the custom style sheet is not found.

QIODevice::read (QFile, ":styles.css"): device not open

The style must be included in the CMake configuration in the section devoted to the Qt libraries:

# ifcplusplus-source/examples/SimpleViewerExampleQt/CMakeLists.txt
...
ADD_DEFINITIONS(${Qt5Widgets_DEFINITIONS})

SET(viewer_dir ${IFCPP_SOURCE_DIR}/examples/SimpleViewerExampleQt)
SET(RESOURCES ${viewer_dir}/Resources/ifcplusplus.qrc)
QT5_ADD_RESOURCES(SimpleViewerExample_RESOURCES_RCC ${RESOURCES})

More information