-
-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ubuntu linux installation doesn't place .h files in correct subfolders #106
Comments
Hi, I also faced such a problem. |
Thanks for reporting this. Can I ask you how did you install the project on Ubuntu ? Did you install it with cmake install ? |
first, yes, I installed it as it is written in readme, later manually changed the headers and moved it to usr / local / include. |
I have the exact same issue installing in WSL Ubuntu 18.04.2 LTS. Installed very simply following the install guide: cmake -DCMAKE_BUILD_TYPE=Release -DRP3D_COMPILE_TESTBED=OFF -DRP3D_COMPILE_TESTS=OFF -DRP3D_DOUBLE_PRECISION_ENABLED=ON
make
sudo make install No subfolders in Related to this, when I manually create the folder structure, the program compiles, but fails during linking while using the
UPDATE: The linking issue was resolved by setting |
I use the following diff on the cmakefile of 0.7.1:
This provides both source and headers into the CMAKE INSTALL INCLUDEDIR. Changes this as needed |
Thanks for your feedback. I will try to fix this for the next release. |
Hello. Thanks everyone for reporting this issue. Yes, the issue is that cmake will copy the headers in the ${CMAKE_INSTALL_INCLUDEDIR}/reactphysics3d/ in a flat way (without the subfolders) which is not working. I have just pushed a fix in the "master" branch that will copy the headers in the ${CMAKE_INSTALL_INCLUDEDIR}/reactphysics3d/ with the correct hierarchy of subdirectories. Note that you might need to add the ${CMAKE_INSTALL_INCLUDEDIR}/reactphysics3d/ directory as an "include directory" for your project so that the compiler correctly finds the ReactPhysics3D headers. This is a temporary fix. For the next release of the library, I will change a little the structure of headers in the project so that it will be installed correctly with cmake. |
I think the correct solution would be to use file-relative include directives in each internal header. That is, rather than in, say, src/body/RigidBody.h:
you instead write:
This would mean users would not need to add an include path for this library, and it would also mean not risking collisions with some other library of your top-level folder names (eg some other library might also have an "engine/" subdirectory.) If you would like, I have the tools to execute this refactoring relatively quickly. Would you like me to make a PR? |
Can you explain why
would not need an include path ? I think this won't work because if the Joint.h header file is installed at /usr/local/include/reactphysics3d/constraint/Join.h". I think that in your example, the compiler will try to find the file /usr/local/include/../constraint/Joint.h" that does not exist. Am I wrong ? According to me, the proper way to fix this is to have all the public headers of the library in a src/include/reactphysics3d directory. and to include the header with:
The Joint.h header file will then be installed at /usr/local/include/reactphysics3d/Joint.h in Ubuntu. |
Sure - so include directives are handled by the C preprocessor. There are two kinds of include directives:
For the first (quoted) form, the first place the preprocessor looks for an included file is relative to the current file. See: https://docs.microsoft.com/en-us/cpp/preprocessor/hash-include-directive-c-cpp?view=vs-2019 and: https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html Therefore when the line:
is encountered in the file:
The first place it will search for it is at:
(ie relative to the body subdirectory which is the parent of the origin source file RigidBody.h) and it will find it there. ie the .. is to go up from the body directory. I think you'll be happier using this technique for internal includes (that's what it's there for) because it will mean you can preserve the nested header structure in both the git repository and in the installed include folder. It reduces the risk of conflicts and it also means that you don't have to add an include path for the library. |
Ok I see but with your technique, how is a user of the library supposed to include the main header file reactphysics3d.h without an "include directory directive" ? For instance with my proposition, the user will be able to do this:
The compiler will then find the file at /usr/local/include/reactphysics3d/reactphysics3d.h. |
Under my proposal the user is also able to do this:
and it will work, as the headers are installed into the include folder with the same hierarchical/nested structure as they are in the git-repo/src folder. So:
is installed to
Yes there needs to be an implicit or explicit include path for that to work, and there is for ie With the current structure of the internal include directives, if you install them hierarchically then you need to add an include path just for this library (-I "/usr/include/reactphysics3d") so that the internal includes (which are Hope that makes sense now? |
The version v0.8.0 of ReactPhysics3D has been released. In this version, this issue is now fixed. Note that this version contains some public API changes. Please read carefully the change log before upgrading to this new version and do not hesitate to take a look at the user manual. Thanks a lot for reporting this issue. I am now closing this issue. |
On installing on ubuntu linux 18.04 I get the following install messages
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/lib/libreactphysics3d.so.0.7.1
-- Installing: /usr/local/lib/libreactphysics3d.so.0.7
-- Installing: /usr/local/lib/libreactphysics3d.so
-- Installing: /usr/local/include/reactphysics3d/configuration.h
-- Installing: /usr/local/include/reactphysics3d/decimal.h
-- Installing: /usr/local/include/reactphysics3d/reactphysics3d.h
-- Installing: /usr/local/include/reactphysics3d/Body.h
-- Installing: /usr/local/include/reactphysics3d/CollisionBody.h
-- Installing: /usr/local/include/reactphysics3d/RigidBody.h
-- Installing: /usr/local/include/reactphysics3d/ContactPointInfo.h
-- Installing: /usr/local/include/reactphysics3d/ContactManifoldInfo.h
-- Installing: /usr/local/include/reactphysics3d/BroadPhaseAlgorithm.h
-- Installing: /usr/local/include/reactphysics3d/DynamicAABBTree.h
-- Installing: /usr/local/include/reactphysics3d/CollisionDispatch.h
-- Installing: /usr/local/include/reactphysics3d/DefaultCollisionDispatch.h
-- Installing: /usr/local/include/reactphysics3d/VoronoiSimplex.h
-- Installing: /usr/local/include/reactphysics3d/GJKAlgorithm.h
-- Installing: /usr/local/include/reactphysics3d/SATAlgorithm.h
-- Installing: /usr/local/include/reactphysics3d/NarrowPhaseAlgorithm.h
-- Installing: /usr/local/include/reactphysics3d/SphereVsSphereAlgorithm.h
-- Installing: /usr/local/include/reactphysics3d/CapsuleVsCapsuleAlgorithm.h
-- Installing: /usr/local/include/reactphysics3d/SphereVsCapsuleAlgorithm.h
-- Installing: /usr/local/include/reactphysics3d/SphereVsConvexPolyhedronAlgorithm.h
-- Installing: /usr/local/include/reactphysics3d/CapsuleVsConvexPolyhedronAlgorithm.h
-- Installing: /usr/local/include/reactphysics3d/ConvexPolyhedronVsConvexPolyhedronAlgorithm.h
-- Installing: /usr/local/include/reactphysics3d/AABB.h
-- Installing: /usr/local/include/reactphysics3d/ConvexShape.h
-- Installing: /usr/local/include/reactphysics3d/ConvexPolyhedronShape.h
-- Installing: /usr/local/include/reactphysics3d/ConcaveShape.h
-- Installing: /usr/local/include/reactphysics3d/BoxShape.h
-- Installing: /usr/local/include/reactphysics3d/CapsuleShape.h
-- Installing: /usr/local/include/reactphysics3d/CollisionShape.h
-- Installing: /usr/local/include/reactphysics3d/ConvexMeshShape.h
-- Installing: /usr/local/include/reactphysics3d/SphereShape.h
-- Installing: /usr/local/include/reactphysics3d/TriangleShape.h
-- Installing: /usr/local/include/reactphysics3d/ConcaveMeshShape.h
-- Installing: /usr/local/include/reactphysics3d/HeightFieldShape.h
-- Installing: /usr/local/include/reactphysics3d/RaycastInfo.h
-- Installing: /usr/local/include/reactphysics3d/ProxyShape.h
-- Installing: /usr/local/include/reactphysics3d/TriangleVertexArray.h
-- Installing: /usr/local/include/reactphysics3d/PolygonVertexArray.h
-- Installing: /usr/local/include/reactphysics3d/TriangleMesh.h
-- Installing: /usr/local/include/reactphysics3d/PolyhedronMesh.h
-- Installing: /usr/local/include/reactphysics3d/HalfEdgeStructure.h
-- Installing: /usr/local/include/reactphysics3d/CollisionDetection.h
-- Installing: /usr/local/include/reactphysics3d/NarrowPhaseInfo.h
-- Installing: /usr/local/include/reactphysics3d/ContactManifold.h
-- Installing: /usr/local/include/reactphysics3d/ContactManifoldSet.h
-- Installing: /usr/local/include/reactphysics3d/MiddlePhaseTriangleCallback.h
-- Installing: /usr/local/include/reactphysics3d/BallAndSocketJoint.h
-- Installing: /usr/local/include/reactphysics3d/ContactPoint.h
-- Installing: /usr/local/include/reactphysics3d/FixedJoint.h
-- Installing: /usr/local/include/reactphysics3d/HingeJoint.h
-- Installing: /usr/local/include/reactphysics3d/Joint.h
-- Installing: /usr/local/include/reactphysics3d/SliderJoint.h
-- Installing: /usr/local/include/reactphysics3d/CollisionWorld.h
-- Installing: /usr/local/include/reactphysics3d/ConstraintSolver.h
-- Installing: /usr/local/include/reactphysics3d/ContactSolver.h
-- Installing: /usr/local/include/reactphysics3d/DynamicsWorld.h
-- Installing: /usr/local/include/reactphysics3d/EventListener.h
-- Installing: /usr/local/include/reactphysics3d/Island.h
-- Installing: /usr/local/include/reactphysics3d/Material.h
-- Installing: /usr/local/include/reactphysics3d/OverlappingPair.h
-- Installing: /usr/local/include/reactphysics3d/Timer.h
-- Installing: /usr/local/include/reactphysics3d/Timer.cpp
-- Installing: /usr/local/include/reactphysics3d/CollisionCallback.h
-- Installing: /usr/local/include/reactphysics3d/OverlapCallback.h
-- Installing: /usr/local/include/reactphysics3d/mathematics.h
-- Installing: /usr/local/include/reactphysics3d/mathematics_functions.h
-- Installing: /usr/local/include/reactphysics3d/Matrix2x2.h
-- Installing: /usr/local/include/reactphysics3d/Matrix3x3.h
-- Installing: /usr/local/include/reactphysics3d/Quaternion.h
-- Installing: /usr/local/include/reactphysics3d/Transform.h
-- Installing: /usr/local/include/reactphysics3d/Vector2.h
-- Installing: /usr/local/include/reactphysics3d/Vector3.h
-- Installing: /usr/local/include/reactphysics3d/Ray.h
-- Installing: /usr/local/include/reactphysics3d/MemoryAllocator.h
-- Installing: /usr/local/include/reactphysics3d/DefaultPoolAllocator.h
-- Installing: /usr/local/include/reactphysics3d/DefaultSingleFrameAllocator.h
-- Installing: /usr/local/include/reactphysics3d/DefaultAllocator.h
-- Installing: /usr/local/include/reactphysics3d/MemoryManager.h
-- Installing: /usr/local/include/reactphysics3d/Stack.h
-- Installing: /usr/local/include/reactphysics3d/LinkedList.h
-- Installing: /usr/local/include/reactphysics3d/List.h
-- Installing: /usr/local/include/reactphysics3d/Map.h
-- Installing: /usr/local/include/reactphysics3d/Set.h
-- Installing: /usr/local/include/reactphysics3d/Pair.h
-- Installing: /usr/local/include/reactphysics3d/Profiler.h
-- Installing: /usr/local/include/reactphysics3d/Logger.h
However when linking the library into a project it expects the header files in the subdirectories. For example:
/usr/local/include/reactphysics3d/configuration.h:36:10: fatal error: containers/Pair.h: No such file or directory
#include "containers/Pair.h"
Thanks!
The text was updated successfully, but these errors were encountered: