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

Fix compilation with GCC 10+ #10818

Merged
merged 1 commit into from Sep 4, 2022

Conversation

chris-durand
Copy link
Contributor

@chris-durand chris-durand commented Aug 24, 2022

The current release v2.51.1 fails to compile with more recent GCC versions starting from 10. The header file src/libusb/libusb.h uses a #if 0 preprocessor directive to specify a comment block. That comment contains the Unicode character ´ (Left Single Quotation Mark, U+2018) which is rejected by the compiler.

If gcc versions greater than 9 are used, compilation fails. Here the try to compile librealsense on Ubuntu with gcc 11 (g++ --version: Ubuntu 11.2.0-19ubuntu1):

[ 66%] Building CXX object CMakeFiles/realsense2.dir/src/libusb/context-libusb.cpp.o
In file included from /home/robot/librealsense/src/libusb/context-libusb.h:10,
                 from /home/robot/librealsense/src/libusb/context-libusb.cpp:4:
/home/robot/librealsense/src/libusb/libusb.h:10:82: error: extended character ‘ is not valid in an identifier

This fix replaces the rejected Unicode character with a plain ASCII single quote '.

Remove unicode characters inside an "#if 0" block that cause compilation
to fail with newer gcc versions starting from 10.
@Ar-Ray-code
Copy link

@chris-durand
I encountered the same error in a build on Raspbian-bullseye and solved it with your suggestion.
Thanks.

@Nir-Az
Copy link
Collaborator

Nir-Az commented Sep 4, 2022

Hi @chris-durand,
Nice catch!
We'll take it 🥇

@Nir-Az Nir-Az self-requested a review September 4, 2022 13:11
Copy link
Collaborator

@Nir-Az Nir-Az left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

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

Successfully merging this pull request may close these issues.

None yet

3 participants