ament / uncrustify_vendor

CMake shim over the uncrustify library: https://github.com/uncrustify/uncrustify
Apache License 2.0
0 stars 9 forks source link

Compile error:use of undeclared identifier 'rindex' #35

Open Chris-166 opened 1 year ago

Chris-166 commented 1 year ago
chris@chris-166:~/Projects/ros2-android/src$ colcon build --packages-select uncrustify_vendor
Starting >>> uncrustify_vendor
--- stderr: uncrustify_vendor                            
/home/chris/Projects/ros2-android/src/build/uncrustify_vendor/uncrustify-0.72.0-prefix/src/uncrustify-0.72.0/src/log_rules.cpp:51:12: error: use of undeclared identifier 'rindex'
   where = rindex(func, ':');
           ^
1 error generated.
gmake[5]: *** [CMakeFiles/uncrustify.dir/build.make:797: CMakeFiles/uncrustify.dir/src/log_rules.cpp.o] Error 1
gmake[5]: *** Waiting for unfinished jobs....
gmake[4]: *** [CMakeFiles/Makefile2:1048: CMakeFiles/uncrustify.dir/all] Error 2
gmake[3]: *** [Makefile:166: all] Error 2
gmake[2]: *** [CMakeFiles/uncrustify-0.72.0.dir/build.make:89: uncrustify-0.72.0-prefix/src/uncrustify-0.72.0-stamp/uncrustify-0.72.0-build] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:140: CMakeFiles/uncrustify-0.72.0.dir/all] Error 2
gmake: *** [Makefile:149: all] Error 2
---
Failed   <<< uncrustify_vendor [0.68s, exited with code 2]

Summary: 0 packages finished [1.12s]
  1 package failed: uncrustify_vendor
  1 package had stderr output: uncrustify_vendor
  1. Version or commit hash commit ec8f8b4d03483671e8ea2b3039f1015f92b0ef89 (HEAD -> humble, tag: 2.0.2, origin/humble)
  2. Compilation environment:22.04.1-Ubuntu
clalancette commented 1 year ago

So this is a bit of a tricky situation.

The immediate cause of the failure is that the Android libc likely doesn't have rindex.

But really, we shouldn't be compiling this particular package on Android at all, as you want to compile this on the host. We just don't have a good way to express that in our package.xml.

For now, I'm going to mark this as 'backlog' since Android isn't a supported platform.

Chris-166 commented 1 year ago

Can I switch the branch from humble to galactic to temporarily work around this issue?

clalancette commented 1 year ago

Can I switch the branch from humble to galactic to temporarily work around this issue?

I doubt that will make a difference, as you'll be in a similar situation.

NicolARun06 commented 4 months ago

@Chris-166 I met the same issue, and I modified workspace/src/build/uncrustify_vendor/uncrustify-0.72.0-prefix/src/uncrustify-0.72.0/src/log_rules.cpp:51 . from: where = rindex(func, ':'); to: where = strrchr(func, ':');

after that, the package 'uncrustify_vendor' could be built sucessfully...