cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
pmccumber
Visitor
Visitor
4,230 Views
Registered: ‎02-06-2019

BitBake: Cannot Find Header File

Jump to solution

I started with the "Hello World" myapp demo.  That compiled and built. 

1) I get this error:

[pmccumbe@srv-fpga olympus_012519]$ petalinux-build -c myapp
[INFO] building myapp
[INFO] sourcing bitbake
INFO: bitbake myapp
. . . . . .
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: myapp-1.0-r0 do_compile: oe_runmake failed
ERROR: myapp-1.0-r0 do_compile: Function failed: do_compile (log file is located at /data/fpga_designs/pmccumbe/olympus/olympus_012519/build/tmp/work/aarch64-xilinx-linux/myapp/1.0-r0/temp/log.do_compile.80418)
ERROR: Logfile of failure stored in: /data/fpga_designs/pmccumbe/olympus/olympus_012519/build/tmp/work/aarch64-xilinx-linux/myapp/1.0-r0/temp/log.do_compile.80418
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: make -j 32
| aarch64-xilinx-linux-g++ --sysroot=/data/fpga_designs/pmccumbe/olympus/olympus_012519/build/tmp/work/aarch64-xilinx-linux/myapp/1.0-r0/recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/data/fpga_designs/pmccumbe/olympus/olympus_012519/build/tmp/work/aarch64-xilinx-linux/myapp/1.0-r0=/usr/src/debug/myapp/1.0-r0 -fdebug-prefix-map=/data/fpga_designs/pmccumbe/olympus/olympus_012519/build/tmp/work/aarch64-xilinx-linux/myapp/1.0-r0/recipe-sysroot-native= -fdebug-prefix-map=/data/fpga_designs/pmccumbe/olympus/olympus_012519/build/tmp/work/aarch64-xilinx-linux/myapp/1.0-r0/recipe-sysroot= -fvisibility-inlines-hidden -c -o cosmic_example.o cosmic_example.cpp
| In file included from cosmic.h:33:0,
| from cosmic_example.cpp:32:
| cosmic/core.h:32:10: fatal error: cosmic/core/counting_semaphore.h: No such file or directory
| #include "cosmic/core/counting_semaphore.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| compilation terminated.
| make: *** [<builtin>: cosmic_example.o] Error 1
| ERROR: oe_runmake failed

2) I modified the .bb to include those paths:

SRC_URI = "file://cosmic_example.cpp \
file://cosmic.h \
file://cosmic_custom.h \
file://cosmic/ \
file://cosmic/core \
file://cosmic/core/*.h \
file://cosmic/core/counting_semaphore.h \
file://Makefile \
"

S = "${WORKDIR}"
#CFLAGS_prepend = "-I ${S}/cosmic/core"
do_compile() {
oe_runmake
}

3) I added the source off  myapp/files like this:

[pmccumbe@srv-fpga files]$ pwd
/data/fpga_designs/pmccumbe/olympus/olympus_012519/project-spec/meta-user/recipes-apps/myapp/files

[pmccumbe@srv-fpga files]$ ls
cosmic cosmic_custom.h cosmic_example.cpp cosmic.h Makefile Makefile.org myapp.cpp.org

[pmccumbe@srv-fpga files]$ ls cosmic
core core.h drivers support support.h tcpip tcpip.h udp udp.h

[pmccumbe@srv-fpga files]$ ls cosmic/core
binary_semaphore.cpp counting_semaphore.h mutex.cpp packet_processor_thread.h telemetry_packet_queue.cpp
binary_semaphore.h file_descriptor.cpp mutex.h packet_queue.cpp thread.cpp
callback.cpp file_descriptor.h output_stream_thread.cpp packet_queue.h thread.h
callback.h file_descriptor_manager.cpp output_stream_thread.h private time.cpp
command.cpp file_descriptor_manager.h packet.cpp queue.cpp time.h
command_list.cpp input_stream_thread.cpp packet.h queue.h
command_processor_thread.cpp input_stream_thread.h packet_list.cpp system.cpp
command_queue.cpp logger.cpp packet_list.h system.h
counting_semaphore.cpp logger.h packet_processor_thread.cpp telemetry_packet.cpp

4) I'm at a loss of what to do here.  I found the issue on this forum that says to just add it to SRC_URI and that doesn't change the behavior at all.  The log file gives no feedback.  Although it does show a invocation of the ARM compiler without ANY added include paths so I don't see what modifications to SRC_URI does.  

0 Kudos
1 Solution

Accepted Solutions
hokim
Scholar
Scholar
4,165 Views
Registered: ‎10-21-2015

Could you show your Makefile?

I think  your makefile doesn't use CXXFLAGS to compile source file

It should include the lines like this

.cpp.o:
    $(CXX) -c $(CXXFLAGS) $< -o $@

In bb file, use 

CXXFLAGS_prepend = "-I${S} "

instead of

CFLAGS_prepend = "-I${S} "

 because your souce code is c++

 

Try it again with the following makefile

SRCS = cosmic_example.cpp

OBJS = $(SRCS:.cpp=.o)

all: cosmic_example

cosmic_example: $(OBJS)
    $(CXX) -o $@ $(OBJS) $(LDFLAGS)

.cpp.o:
    $(CXX) -c $(CXXFLAGS) $< -o $@

View solution in original post

5 Replies
hokim
Scholar
Scholar
4,197 Views
Registered: ‎10-21-2015

Hi 

gcc is not given include path

You should pass include path to gcc through bb file

S = "${WORKDIR}"
CFLAGS_prepend = "-I${S} "

 

0 Kudos
pmccumber
Visitor
Visitor
4,175 Views
Registered: ‎02-06-2019

Thanks for the suggestion.  I got the exact same thing.  What makes this so hard is I get no feedback.  I have the log but nothing I do to the .bb file seems to have an impact.  How can adding "-I{S} " not have any effect on the actual compilation?  There doesn't appear to be ANY -I include paths in what is subsequently fed to cc.

I don't understand where the Makefile comes in to play.  How the SRC_URI feeds the Makefile.  I see suggestions where people say "Oh just add your include directory to SRC_URI" and that clearly isn't helping.

1) When I run wo 'do_compile' entry in my .bb file AND run '$ petalinux-build -c myapp' I get this:

| DEBUG: Executing shell function do_compile
| NOTE: make -j 32

2) If I have a 'do_compile' entry in my .bb like this I get the same thing.

do_compile() {
   oe_runmake
}

This seems so simple.  I have a myapp.cpp file and it includes some headers.  I cannot specify an include path.  And then I fear I won't be able to add more source files to the compilation.  I don't see where you get any feedback.  The log just has this same error.

 

Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: make -j 32
| aarch64-xilinx-linux-g++ --sysroot=/data/fpga_designs/pmccumbe/olympus/olympus_012519/build/tmp/work/aarch64-xilinx-linux/myapp/1.0-r0/recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/data/fpga_designs/pmccumbe/olympus/olympus_012519/build/tmp/work/aarch64-xilinx-linux/myapp/1.0-r0=/usr/src/debug/myapp/1.0-r0 -fdebug-prefix-map=/data/fpga_designs/pmccumbe/olympus/olympus_012519/build/tmp/work/aarch64-xilinx-linux/myapp/1.0-r0/recipe-sysroot-native= -fdebug-prefix-map=/data/fpga_designs/pmccumbe/olympus/olympus_012519/build/tmp/work/aarch64-xilinx-linux/myapp/1.0-r0/recipe-sysroot= -fvisibility-inlines-hidden -c -o cosmic_example.o cosmic_example.cpp
| In file included from cosmic.h:33:0,
| from cosmic_example.cpp:32:
| cosmic/core.h:32:10: fatal error: cosmic/core/counting_semaphore.h: No such file or directory
| #include "cosmic/core/counting_semaphore.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| compilation terminated.
| make: *** [<builtin>: cosmic_example.o] Error 1

0 Kudos
hokim
Scholar
Scholar
4,166 Views
Registered: ‎10-21-2015

Could you show your Makefile?

I think  your makefile doesn't use CXXFLAGS to compile source file

It should include the lines like this

.cpp.o:
    $(CXX) -c $(CXXFLAGS) $< -o $@

In bb file, use 

CXXFLAGS_prepend = "-I${S} "

instead of

CFLAGS_prepend = "-I${S} "

 because your souce code is c++

 

Try it again with the following makefile

SRCS = cosmic_example.cpp

OBJS = $(SRCS:.cpp=.o)

all: cosmic_example

cosmic_example: $(OBJS)
    $(CXX) -o $@ $(OBJS) $(LDFLAGS)

.cpp.o:
    $(CXX) -c $(CXXFLAGS) $< -o $@

View solution in original post

pmccumber
Visitor
Visitor
4,147 Views
Registered: ‎02-06-2019

Well that was enormous progress.   Thank you.

At least now I'm on to "undefined references" which is nice because I'm editing files and seeing consequence. 

0 Kudos
sandeepg
Moderator
Moderator
4,132 Views
Registered: ‎04-24-2017

Hi @pmccumber,

I see in your recipes you have included "/*.h" files this bad practice of writing recipes.

SRC_URI = "file://cosmic_example.cpp \
file://cosmic.h \
file://cosmic_custom.h \
file://cosmic/ \
file://cosmic/core \
file://cosmic/core/*.h \
file://cosmic/core/counting_semaphore.h \
file://Makefile \
"

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos