Unable to use underlay ros2 installation with drake-ros as an external in a Bazel Workspace - ros

Using ros2_local_repository following the ros-humble installation (the debian way) yields errors the following CMAKE errors -
--- captured stderr ---
CMake Warning at /opt/ros/humble/share/quality_of_service_demo_cpp/cmake/ament_cmake_export_include_directories-extras.cmake:11 (message):
Package 'quality_of_service_demo_cpp' exports the include directory
'/opt/ros/humble/share/quality_of_service_demo_cpp/cmake/../../../include/quality_of_service_demo_cpp'
which doesn't exist
Call Stack (most recent call first):
/opt/ros/humble/share/quality_of_service_demo_cpp/cmake/quality_of_service_demo_cppConfig.cmake:41 (include)
CMakeLists.txt:16 (find_package)
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_image_tools" links to target
"sensor_msgs::sensor_msgs__rosidl_generator_c" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_image_tools" links to target
"sensor_msgs::sensor_msgs__rosidl_typesupport_fastrtps_c" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_image_tools" links to target
"sensor_msgs::sensor_msgs__rosidl_generator_cpp" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_image_tools" links to target
"sensor_msgs::sensor_msgs__rosidl_typesupport_fastrtps_cpp" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_image_tools" links to target
"sensor_msgs::sensor_msgs__rosidl_typesupport_introspection_c" but the
target was not found. Perhaps a find_package() call is missing for an
IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_image_tools" links to target
"sensor_msgs::sensor_msgs__rosidl_typesupport_c" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_image_tools" links to target
"sensor_msgs::sensor_msgs__rosidl_typesupport_introspection_cpp" but the
target was not found. Perhaps a find_package() call is missing for an
IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_image_tools" links to target
"sensor_msgs::sensor_msgs__rosidl_typesupport_cpp" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_image_tools" links to target
"sensor_msgs::sensor_msgs__rosidl_generator_py" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_image_tools" links to target
"sensor_msgs::sensor_msgs_library" but the target was not found. Perhaps a
find_package() call is missing for an IMPORTED target, or an ALIAS target
is missing?
CMake Generate step failed. Build files cannot be regenerated correctly.
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_tf2_bullet" links to target "tf2::tf2" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_tf2_bullet" links to target
"geometry_msgs::geometry_msgs__rosidl_generator_c" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_tf2_bullet" links to target
"geometry_msgs::geometry_msgs__rosidl_typesupport_fastrtps_c" but the
target was not found. Perhaps a find_package() call is missing for an
IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_tf2_bullet" links to target
"geometry_msgs::geometry_msgs__rosidl_typesupport_introspection_c" but the
target was not found. Perhaps a find_package() call is missing for an
IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_tf2_bullet" links to target
"geometry_msgs::geometry_msgs__rosidl_typesupport_c" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_tf2_bullet" links to target
"geometry_msgs::geometry_msgs__rosidl_generator_cpp" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_tf2_bullet" links to target
"geometry_msgs::geometry_msgs__rosidl_typesupport_fastrtps_cpp" but the
target was not found. Perhaps a find_package() call is missing for an
IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_tf2_bullet" links to target
"geometry_msgs::geometry_msgs__rosidl_typesupport_introspection_cpp" but
the target was not found. Perhaps a find_package() call is missing for an
IMPORTED target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_tf2_bullet" links to target
"geometry_msgs::geometry_msgs__rosidl_typesupport_cpp" but the target was
not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_tf2_bullet" links to target
"geometry_msgs::geometry_msgs__rosidl_generator_py" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_tf2_bullet" links to target "tf2_ros::tf2_ros" but the
target was not found. Perhaps a find_package() call is missing for an
IMPORTED target, or an ALIAS target is missing?
CMake Generate step failed. Build files cannot be regenerated correctly.
Trying to build my [outdoor_slam_ros2][1] package with drake-ros' bazel rules.
Relevant snippet from WORKSPACE. Is there some other way to pull in packages and use via an overlay workspace?
# Use ROS 2
ros2_local_repository(
name = "ros2",
workspaces = ["/opt/ros/humble/"],
)

I can reproduce the same error after installing ros-humble-desktop. The solution is to include just the packages you need from a workspace with the include_packages option to ros2_local_repository().
ros2_local_repository(
name = "ros2",
include_packages = [
"rclcpp",
],
workspaces = ["/opt/ros/humble/"],
)
In the background ros2_local_repository() uses the CMake File API to "scrape" information about ROS 2 packages to build a BUILD.bazel file for the #ros2 repo. That "scraping" works by generating a CMake package for each package in the ROS 2 workspace. The generated package tries to depend on everything in the ROS 2 package it's responsible for scraping. This can uncover bugs in the CMake logic of the ROS 2 package that might not be seen in typical use.
Take for example this one:
CMake Error at CMakeLists.txt:19 (add_library):
Target "empty_using_tf2_bullet" links to target "tf2_ros::tf2_ros" but the
target was not found. Perhaps a find_package() call is missing for an
IMPORTED target, or an ALIAS target is missing?
The bug is that tf2_bullet publicly depends on tf2_ros::tf2_ros, but does not tell downstream packages to find_package(tf2_ros) to get access to that target. The tf2_bullet package's CMakeLists.txt is missing the line ament_export_dependencies(tf2_ros) which would make downstream packages automatically find_package(tf2_ros) when they find_package(tf2_bullet). The fact that this bug exists probably means that not many developers are using tf2_bullet, or they're also already directly or indirectly calling find_package(tf2_ros).
Using the include_packages option avoids these kinds of bugs by instructing ros2_local_repository() to only scrape the ROS 2 packages that are actually needed, instead of scraping all of them in the workspace.

Related

ld: library not found for -lASIHTTPRequest : XCode13.4

I've opened a old project, I can not able to run the code because of the following error
ld: library not found for -lASIHTTPRequest
I tried
Re Install all the pods
I Opened .WorkSpace
I Tried,
Delete Library Search Paths
I Tried, $(inhereted) in Library paths
Sometimes it happens when the pod gets updated, and the pod owner gets rid of some internal dependencies (in your case ASIHTTPRequest), but the Cocoapods fails to remove all the references to the removed dependency completely for some unknown to me reason.
In such cases you can do that manually.
Open the build settings of your target, and search for "Other Linker Flags".
Double click on it, locate ASIHTTPRequest, and remove both: that line and the line before it: "-framework".

Linking Xcode iOS project with OCMock using cocoaPod

I installed OCMock using cocoapod for my test project
target 'ProjectTests' do
use_frameworks!
pod 'OCMock'
end
In My test project, Build Phases -> Link Binary with Libraries, I added OCMock.framework (Under Pods). But the actual file doesn't seem to exist there. Am I missing something?
In Build setting, updated Header/Library search path with '/Pods/OCMock/Source/**' (recursive).
My headers are getting referenced, but when I try to the tests I get an error
ld: framework not found OCMock
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Can anyone help me resolve the issue?

Xcode: Cannot parse the debug map for .. is a directory

I'm trying to link my iPhone simulator project and I'm getting the following error at link time:
(null): error: cannot parse the debug map for "/Users/admin/Library/Developer/Xcode/DerivedData/TrainTracks-agvvryrtufplkxecblncwedcelck/Build/Products/Debug-iphonesimulator/TrainTracks.app/TrainTracks": Is a directory
Here's the linker output:
GenerateDSYMFile /Users/admin/Library/Developer/Xcode/DerivedData/TrainTracks-agvvryrtufplkxecblncwedcelck/Build/Products/Debug-iphonesimulator/TrainTracks.app.dSYM /Users/admin/Library/Developer/Xcode/DerivedData/TrainTracks-agvvryrtufplkxecblncwedcelck/Build/Products/Debug-iphonesimulator/TrainTracks.app/TrainTracks
cd /Work/TrainTracks/TrainTracks
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/admin/Library/Developer/Xcode/DerivedData/TrainTracks-agvvryrtufplkxecblncwedcelck/Build/Products/Debug-iphonesimulator/TrainTracks.app/TrainTracks -o /Users/admin/Library/Developer/Xcode/DerivedData/TrainTracks-agvvryrtufplkxecblncwedcelck/Build/Products/Debug-iphonesimulator/TrainTracks.app.dSYM
error: cannot parse the debug map for "/Users/admin/Library/Developer/Xcode/DerivedData/TrainTracks-agvvryrtufplkxecblncwedcelck/Build/Products/Debug-iphonesimulator/TrainTracks.app/TrainTracks": Is a directory
What would cause this problem?
I started off with a Game template (Xcode 7.2.1) and deleted the main story board and AppDelegate.* files since this is an SDL cross-platform project.
This problem was caused by a second inclusion of a TrainTracks folder in my project. I already had a yellow TrainTracks group with all of my source but for some reason Xcode was also showing a blue TrackTracks folder as well. This has a duplicate info.plist and other files. I removed the blue folder reference and the project now builds successfully.
If you are using CocoaPods, and you get this error after changing the name of your Target, click on your target, go to the General tab, scroll down to "Linked Frameworks and Libraries" and then delete the following library:
libPods-YourOldTargetName.a
For me this error was the inclusion of the same .m file twice in the project. Happened while moving some files around. Quit Xcode, clean and it told me the file in a linker error.
I ran into this problem trying to run my tests, and it was because my test target required the use of one of the pods I had in my Podfile. To fix it I just added my test target to the Podfile and included the relevant pods, as per the following pattern:
workspace 'myproject.xcworkspace'
platform :ios, '8.0'
use_frameworks!
def shared_pods
pod 'RealmSwift', '~> 2.8'
end
project 'myproject.xcodeproj'
target :MyProject do
project 'myproject.xcodeproj'
shared_pods
end
target :MyProjectTests do
project 'myproject.xcodeproj'
shared_pods
end
In my case, this same error showed up because one of the frameworks used in the app was compiled without Bitcode, so I had to turn off Bitcode for the entire project.
In my case, I had made a duplicate of one of my .m files in the finder to keep as reference, and somehow (most likely my error) it was added to the project explorer. The real error was duplicate definitions since the class appeared twice. Removing the "ClassNameHere_copy.m" fixed the issue.
For me, it was because I changed my target name which made a new cocoa pods .a library but didn't remove the other from linking.
In My case I had to delete my entire repository and clone again, nothing else worked, after fresh cloning, I ran a pod install and it worked.

Getting error while updating and adding new pod ios

I am getting error while anding new pod file to my existing file.
Then i run command to update but it showing the following errro.
The iPhonePoker [Release] target overrides the HEADER_SEARCH_PATHS build setting defined in Pods/Target Support Files/Pods/Pods.release.xcconfig'.
This can lead to problems with the CocoaPods installation
Use the $(inherited) flag, or
Remove the build settings from the target.
[!] The iPhonePoker [AdHoc] target overrides the HEADER_SEARCH_PATHS build setting defined
in Pods/Target Support Files/Pods/Pods.adhoc.xcconfig'.
This can lead to problems with the CocoaPods installation
Use the $(inherited) flag, or
Remove the build settings from the target.
COG-MAC-003:PT
Please check this and let me know where i am wrong
In your project go to project target Build Settings>Other linker flags>double click .
Add $(inherited)

CocaPods importing AFNetworking but not OHAttributedLabel

I am using CocaPods to add AFNetowrking and OHAttributedLabel into my project. I installed both of the libraries. AFNetworking is importing just fine in my project. But OHAttributedLabel isn't. I am not sure why!
Podfile
platform :ios, '6.0'
pod 'AFNetworking'
pod 'OHAttributedLabel'
After installing both the libraries, when I import
#import "AFHTTPClient.h"
#import "AFJSONRequestOperation.h"
#import "UIImageView+AFNetworking.h"
I do not get any errors and everything works just fine
but when I am trying to import
#import <OHAttributedLabel/OHAttributedLabel.h>
#import <OHAttributedLabel/NSAttributedString+Attributes.h>
#import <OHAttributedLabel/OHASBasicMarkupParser.h>
I am getting
'OHAttributedLabel/OHAttributedLabel.h' file not found
error
pod install output
Resolving dependencies of `./Podfile'
Updating spec repositories
Cocoapods 0.17.0.rc7 is available.
Resolving dependencies for target `default' (iOS 6.0)
Downloading dependencies
Using AFNetworking (1.1.0)
Installing OHAttributedLabel (3.4.1)
Generating support files
The suggestion says
Make sure your project is using the Pods.xcconfig. To check this
select your project file, then select it in the second pane again and
open the Info section in the third pane. Under configurations you
should select Pods.xcconfig for each configurations requiring your
installed pods.
I am not sure where to add this. This is how my configurations look like
Edit
After copying pods.xcconfig
It looks like you are missing the proper configurations set.
You project's info should look like this
This might sound silly, but are you trying to build and run the Pods project in your workspace rather than your own app project? I've been guilty of that many times and have seen similar errors!
You encounter these errors when installing pods on a project that has custom compiler/linker flags like HEADER_SEARCH_PATHS and/or OTHER_LDFLAGS (via the 'Header Search Paths' or 'Other linker flags' target settings). These settings will override your pods configuration file, since configuration files have lower priority than target settings.
To fix this you will need to add $(inherited) to the HEADER_SEARCH_PATHS and other changed flags in your target build settings. Just append it to the end like this:
Also to note, when you installed the pods with pod install it should warn you with messages like this if you have set custom flags that would be affected:
[!] From now on use myprojectname.
[!] The target myprojectname [Debug] overrides the OTHER_LDFLAGS
build setting defined in Pods/Pods.xcconfig'.
- Use the$(inherited)` flag, or
- Remove the build settings from the target.
[!] The target myprojectname [Debug] overrides the
HEADER_SEARCH_PATHS build setting defined in Pods/Pods.xcconfig'.
- Use the$(inherited)` flag, or
- Remove the build settings from the target.
[!] The target myprojectname [Debug - Release] overrides the
OTHER_LDFLAGS build setting defined in Pods/Pods.xcconfig'.
- Use the$(inherited)` flag, or
- Remove the build settings from the target.
[!] The target myprojectname [Debug - Release] overrides the
HEADER_SEARCH_PATHS build setting defined in Pods/Pods.xcconfig'.
- Use the$(inherited)` flag, or
- Remove the build settings from the target.
Go to your taget Build Settings -> Other linker flags -> double click . Add $(inherited) to a new line .

Resources