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: #include rbus headers using quotes instead of angle brackets #169

Merged
merged 2 commits into from
Nov 9, 2023

Conversation

sheabot
Copy link
Contributor

@sheabot sheabot commented Oct 13, 2023

The rbus includes are using angle brackets like #include <rbus_value.h>, which causes the compiler to search for these includes in the system include paths or the include paths explicitly specified in CFLAGS. Since the rbus includes are installed in a subdirectory /usr/include/rbus, the compiler cannot find them unless the rbus include directory is added to CFLAGS. Using quotes instead of angle brackets will cause the compiler to look in the same directory as the rbus.h file first.

Here is a basic Dockerfile test case:

Not Working:

FROM ubuntu:20.04

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
    apt-get install -y build-essential cmake git pkg-config

WORKDIR /work

RUN git clone https://github.com/rdkcentral/rbus && \
    cmake -Hrbus -Bbuild/rbus -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_FOR_DESKTOP=ON -DCMAKE_BUILD_TYPE=Debug && \
    make -C build/rbus && \
    make -C build/rbus install

RUN <<EOF cat > main.c
#include <rbus/rbus.h>
int main() {
    return 0;
}
EOF

RUN gcc -o main main.c

Working:

FROM ubuntu:20.04

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
    apt-get install -y build-essential cmake git pkg-config

WORKDIR /work

RUN git clone https://github.com/sheabot/rbus -b bugfix/include-syntax && \
    cmake -Hrbus -Bbuild/rbus -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_FOR_DESKTOP=ON -DCMAKE_BUILD_TYPE=Debug && \
    make -C build/rbus && \
    make -C build/rbus install

RUN <<EOF cat > main.c
#include <rbus/rbus.h>
int main() {
    return 0;
}
EOF

RUN gcc -o main main.c

…search same directory instead of system include paths
@CLAassistant
Copy link

CLAassistant commented Oct 13, 2023

CLA assistant check
All committers have signed the CLA.

@karuna2git
Copy link
Contributor

karuna2git commented Nov 9, 2023

The change looks good and worth accepting it.

My mistake. Its the external application that includes rbus.h gets the build error..

@karuna2git karuna2git merged commit 87bea53 into rdkcentral:main Nov 9, 2023
1 check passed
@sheabot sheabot deleted the bugfix/include-syntax branch November 9, 2023 21:17
karuna2git pushed a commit that referenced this pull request Dec 26, 2023
…search same directory instead of system include paths (#169)
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.

3 participants