Skip to content
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

Compile error due to egm generated files not placed in proto folder #2

Open
AlbertoRemus opened this issue Nov 26, 2019 · 18 comments
Open

Comments

@AlbertoRemus
Copy link

When compiling the software integrated with the abb_libegm library, this error arises:

egm.pb.cc
egm_wrapper.pb.cc
egm_wrapper_trajectory.pb.cc
Generating Code...
C:\Users\aremus\aremus-devel\vcpkg-2019-09\vcpkg\installed\x64-windows\include\google/protobuf/descriptor.h(1865): message :  see declaration of 'std::set<std::string,std::less<_Kty>,std::allocator<_Ty>>'
C:\Users\aremus\aremus-devel\vcpkg-2019-09\vcpkg\installed\x64-windows\include\google/protobuf/descriptor.h(1865): message :         with
C:\Users\aremus\aremus-devel\vcpkg-2019-09\vcpkg\installed\x64-windows\include\google/protobuf/descriptor.h(1865): message :         [
C:\Users\aremus\aremus-devel\vcpkg-2019-09\vcpkg\installed\x64-windows\include\google/protobuf/descriptor.h(1865): message :             _Kty=std::string,
C:\Users\aremus\aremus-devel\vcpkg-2019-09\vcpkg\installed\x64-windows\include\google/protobuf/descriptor.h(1865): message :             _Ty=std::string
C:\Users\aremus\aremus-devel\vcpkg-2019-09\vcpkg\installed\x64-windows\include\google/protobuf/descriptor.h(1865): message :         ]
C:\Users\aremus\aremus-devel\vcpkg-2019-09\vcpkg\installed\x64-windows\include\google/protobuf/descriptor.h(1865): message : Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:
C:\Users\aremus\aremus-devel\vcpkg-2019-09\vcpkg\installed\x64-windows\include\google/protobuf/descriptor.h(1865): message : - add -D_WIN32_WINNT=0x0601 to the compiler command line; or
C:\Users\aremus\aremus-devel\vcpkg-2019-09\vcpkg\installed\x64-windows\include\google/protobuf/descriptor.h(1865): message : - add _WIN32_WINNT=0x0601 to your project's Preprocessor Definitions.
C:\Users\aremus\aremus-devel\vcpkg-2019-09\vcpkg\installed\x64-windows\include\google/protobuf/descriptor.h(1865): message : Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).
C:\Users\aremus\aremus-devel\vcpkg-2019-09\vcpkg\installed\x64-windows\include\google/protobuf/descriptor.h(1865): message : c1xx: fatal error C1083: Cannot open source file: 'C:\Users\aremus\idjl-software\build\_deps\abb_libegm-build\proto\egm.pb.cc': No such file or directory
C:\Users\aremus\aremus-devel\vcpkg-2019-09\vcpkg\installed\x64-windows\include\google/protobuf/descriptor.h(1865): message : c1xx: fatal error C1083: Cannot open source file: 'C:\Users\aremus\idjl-software\build\_deps\abb_libegm-build\proto\egm_wrapper.pb.cc': No such file or directory
C:\Users\aremus\aremus-devel\vcpkg-2019-09\vcpkg\installed\x64-windows\include\google/protobuf/descriptor.h(1865): message : c1xx: fatal error C1083: Cannot open source file: 'C:\Users\aremus\idjl-software\build\_deps\abb_libegm-build\proto\egm_wrapper_trajectory.pb.cc': No such file or directory

As it can be noticed at the beginning 3 source files are generated in ~\idjl-software\build\_deps\abb_libegm-build

egm.pb.cc
egm_wrapper.pb.cc
egm_wrapper_trajectory.pb.cc

but actually VS compiler complains since it cannot find those files in ~\idjl-software\build\_deps\abb_libegm-build\proto, so the workaround to solve the problem is to manually place those 3 files in the latter folder, naturally we would like to solve this in an automatic manner

@traversaro
Copy link

I think this is actually due to https://gitlab.kitware.com/cmake/cmake/issues/18828 . A possible workaround is to move the proto files outside of the proto directory and in the main directory of the project, or just overwrite EgmProtoSources with the correct location of the generated files, that I guess is ${CMAKE_CURRENT_BINARY_DIR}/egm.pb.cc .

@traversaro
Copy link

Looking a bit more in the original issue https://gitlab.kitware.com/cmake/cmake/issues/18828 , it seems that the problem is just with relative paths of .proto files, so it could make sense to try to specify the proto files using absolute files, i.e. substiute:

set(EgmProtoFiles proto/egm.proto proto/egm_wrapper.proto proto/egm_wrapper_trajectory.proto)

with:

set(EgmProtoFiles ${CMAKE_CURRENT_SOURCE_DIR}/proto/egm.proto
                  ${CMAKE_CURRENT_SOURCE_DIR}/proto/egm_wrapper.proto
                  ${CMAKE_CURRENT_SOURCE_DIR}/proto/egm_wrapper_trajectory.proto)

@AlbertoRemus
Copy link
Author

I performed the change here: https://github.com/iit-danieli-joint-lab/abb_libegm/tree/fix-proto-relative-paths-issue

But I had the same problem shown here #2 (comment)

@AlbertoRemus
Copy link
Author

Of course when compiling I substituted in the main CMakeLists.txt of idjl-software

include(FetchContent)
FetchContent_Declare(abb_libegm
                     GIT_REPOSITORY https://github.com/iit-danieli-joint-lab/abb_libegm
                     GIT_TAG 036ca4b7009bc4b441cf7ce1dab14e5f365a1032)

where 036ca4b7009bc4b441cf7ce1dab14e5f365a1032 is the tag of the commit in which I did the fix

@traversaro
Copy link

I performed the change here: https://github.com/iit-danieli-joint-lab/abb_libegm/tree/fix-proto-relative-paths-issue

But I had the same problem shown here #2 (comment)

Can you try then the workaround mentioned in #2 (comment) , i.e. moving the .proto files outside of the proto directory?

@traversaro
Copy link

By the way, you are using protobuf 3.10, right? While with protobuf 3.6 everything works fine?

@AlbertoRemus
Copy link
Author

3.9

@AlbertoRemus
Copy link
Author

Can you try then the workaround mentioned in #2 (comment) , i.e. moving the .proto files outside of the proto directory?

It failed, but if egm.pb.cc and friends are moved it always works

@traversaro
Copy link

Can you try then the workaround mentioned in #2 (comment) , i.e. moving the .proto files outside of the proto directory?

It failed, but if egm.pb.cc and friends are moved it always works

Are you sure that you re-configured CMake correctly after the change? It is quite surprising that moving the .proto outside of the proto directory, the .pb.cc are still searched/placed in the wrong location. Can you point to the commit that contains this workaround? After moving the .proto files, did you modified accordingly the CMakeLists.txt file?

@AlbertoRemus
Copy link
Author

036ca4b

here we are

@AlbertoRemus
Copy link
Author

but if I have to put .proto files outside proto folder I shoud do this right?

set(EgmProtoFiles ${CMAKE_CURRENT_SOURCE_DIR}/egm.proto
                  ${CMAKE_CURRENT_SOURCE_DIR}/egm_wrapper.proto
                  ${CMAKE_CURRENT_SOURCE_DIR}/egm_wrapper_trajectory.proto)

@traversaro
Copy link

Yes, that is what I was referring to in

but if I have to put .proto files outside proto folder I shoud do this right?

set(EgmProtoFiles ${CMAKE_CURRENT_SOURCE_DIR}/egm.proto
                  ${CMAKE_CURRENT_SOURCE_DIR}/egm_wrapper.proto
                  ${CMAKE_CURRENT_SOURCE_DIR}/egm_wrapper_trajectory.proto)

Yes, this is what I was referring to in #2 (comment) .

@AlbertoRemus
Copy link
Author

I tried but with this modification the files

egm.pb.cc
egm_wrapper.pb.cc
egm_wrapper_trajectory.pb.cc

are not generated

@traversaro
Copy link

Did you re-run CMake or tried with a clean build (just removing _deps/abb_libegm-* directories would also probably suffice )

@AlbertoRemus
Copy link
Author

It was already a clean build

@traversaro
Copy link

If the commit is ros-industrial@6c81c73 , you also need to move the .proto files outside of the proto directory, otherwise the ${CMAKE_CURRENT_SOURCE_DIR}/egm.proto does not exist.

@AlbertoRemus
Copy link
Author

Got it! Yes indeed it compiles correctly in this case, but still now we have to automatically place protofiles outside protofolder right?

@traversaro
Copy link

Got it! Yes indeed it compiles correctly in this case, but still now we have to automatically place protofiles outside protofolder right?

No, those are part of the abb_libegm repo, so you can move them by removing (git rm) and adding them back (git add) in their new location, and just commit these changes to the repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants