0

I have a Makefile which contains a target by name abc-def-ghi. When I compile this particular target in my Linux machine with the command make abc-def-ghi, it builds successfully, but when the same target is tried to built in Yocto using oe_runmake abc-def-ghi command, I get an error which I am not able to find the root cause of it.

Error:
2025年12月20日T09:12:31 | make: *** No rule to make target 'abc-def-ghi'. Stop.
2025年12月20日T09:12:31 | ERROR: oe_runmake failed

Makefile:

LIBNAME = libda
SOLIBNAME = $(LIBNAME).so
BINNAME = abc-def-ghi
SRC_DIR := src
SRCS := $(shell find $(SRC_DIR) -name '*.cpp')
OBJS := $(SRCS:.cpp=.o)
INCLUDES := -I.
CXXFLAGS += $(INCLUDES) -std=c++17 -Wall -Wextra -fPIC
LDFLAGS += \
 -L../libs \
 -lda
all: $(BINNAME)
$(SOLIBNAME): lib.o
 g++ -shared -o $@ $^ $(CXXFLAGS) $(LDFLAGS)
LDFLAGS += \
 -L. \
 -lda
$(BINNAME): $(SOLIBNAME) $(OBJS)
 g++ -o $@ $(OBJS) $(CXXFLAGS) $(LDFLAGS)
install:
 install -Dm 0755 $(SOLIBNAME) /usr/local/lib/
 install -Dm 0755 $(BINNAME) /usr/local/bin/
clean:
 rm -f $(LIBNAME) $(BINNAME) src/*.o

abc.bb:

SUMMARY = "ABC"
DESCRIPTION = "This package contains ABC"
inherit git-utils
inherit tools
inherit ${@'make-qnx' if d.getVar('BUILD_PLATFORM') == 'QNX' else ''}
SRC_URI = "gitsm://gitlab.a.b.com/c/proj;branch=main;protocol=https"
SRCREV_FORMAT = "proj"
SRCREV = "${AUTOREV}"
S = "${WORKDIR}/git/proj/abc"
do_compile() {
 oe_runmake "abc-def-ghi"
}
FILES:${PN} += " \
 ${sysconfdir}/${BPN}/abc-def-ghi \
"
do_compile:prepend:qnx() {
 PATH=$PATH:${QNX_HOST}/usr/bin
 install -d ${RECIPE_SYSROOT}/usr/lib/proj/
}

The Makefile resides inside proj/abc.

Mo_
2,1001 gold badge12 silver badges35 bronze badges
asked Dec 20, 2025 at 9:32
3
  • 1
    There's not enough information here to answer the question. At a guess, however, when you try to build with Yocto, make is executed in a different working directory relative to the source than when you test running make directly. Commented Dec 20, 2025 at 14:30
  • Thanks, now it's possible to make an answer that's not pure guesswork (e.g. John's guess was probably wrong, as you already set S explicilty). Commented Dec 21, 2025 at 19:44
  • Though Harry, I'm curious how you can use the site for years, post hundreds of questions and then post one where you don't even add the actual code you're having an issue with. Not even speaking of "what did you try?". The latter is optional, but without the former it's impossible to help you and the post is of no use to anyone later on. Commented Dec 21, 2025 at 19:46

1 Answer 1

0

Your makefile cannot be used for cross-compilation, because it contains hard coded values. Replace all the hard coded tools like g++ with the variables provided by the Yocto environment.

Also, you may need to inherit some classes in the recipe it you use something like autotools (then it would be inherit autotools). If you use plain makefiles, no explicit inherit is needed, as base class is inhertied automatically.

Side note: that same base.bbclass should also take care of running oe_runmake and adding the binary to FILES, if your makefile contains the needed information.

For example replace this line:

g++ -o $@ $(OBJS) $(CXXFLAGS) $(LDFLAGS)

with

$(CXX) -o $@ $(OBJS) $(CXXFLAGS) $(LDFLAGS)
answered Dec 21, 2025 at 19:33
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.