do_install error while running custom bitbake in poky build - linux

I am using latest poky-am335x to build simple helloworld application. With some workaround I can able to compile the application. I am doing lot of trails to install binaries but build is throwing error.
error log :
DEBUG: SITE files ['endian-little', 'bit-32', 'arm-common', 'common-linux', 'common-glibc', 'arm-linux', 'arm-linux-gnueabi', 'common']
DEBUG: Executing shell function do_install
NOTE: make -j 4 DESTDIR=/home/pis1kor/workspace/poky-am335x/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/helloworld-1.0-r0/image install
make: *** No rule to make target `install'. Stop.
ERROR: oe_runmake failed
ERROR: Function failed: do_install (see /home/pis1kor/workspace/poky-am335x/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/helloworld-1.0-r0/temp/log.do_install.29583 for further information)
Bitbake file :
DESCRIPTION = "Simple helloworld application"
SECTION = "examples"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
PR = "r0"
SRC_URI = "file://helloworld.tar"
do_compile () {
make -C ${WORKDIR}/helloworld all
}
do_install() {
oe_runmake install DESTDIR=${D}
}
#do_install() {
# oe_runmake install DESTDIR=${D}
# make -C ${WORKDIR}/helloworld/ install
# oe_runmake 'DESTDIR=${D}' install
# cp -f ${WORKDIR}/helloworld/helloworld ${WORKDIR}/image
# oe_runmake install ${WORKDIR}/helloworld
# make -C ${WORKDIR}/helloworld install
# install -d ${D}${bindir}/ ZZ
#}
inherit autotools gettext
Makefile :
IDIR = ./include
CC = arm-arago-linux-gnueabi-gcc -march=armv7-a -mthumb-interwork -mfloat-abi=softfp -mfpu=neon -mtune=cortex-a8 --sysroot=/home/pis1kor/workspace/poky-am335x/build/tmp/sysroots/am335x-evm
CFLAGS = -I$(IDIR)
LIBS = -lm
FILES = ./src/helloworld.c
OUT_EXE = helloworld
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
all: $(FILES)
$(CC) -o $(OUT_EXE) $(FILES) $(CFLAGS) $(LIBS)
install:
$(INSTALL_DATA) -C helloworld ../image
# sudo cp ./helloworld ../image/
clean:
rm -f *.o helloworld
The commented lines are kept like that because just to mansion all the trails I tried with.

The basic differences are the below.
S = "${WORKDIR}/helloworld/"
EXTRA_OEMAKE = 'all -C ${S}'
"EXTRA_OEMAKE" is the key macro which I didn't used before.
I have changed the bitbake file helloworld.bb file like below.
DESCRIPTION = "Simple helloworld application"
SECTION = "examples"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
PR = "r0"
S = "${WORKDIR}/helloworld/"
EXTRA_OEMAKE = 'all -C ${S}'
SRC_URI = "file://helloworld.tar"
inherit autotools gettext

Related

Yocto add Shared Library

I am trying to compile this GitHub project I found and add the resulting shared library to my SDK.
The project uses CMake. My recipe can download, and build this project. The resulting binary files work as expected, the given .so files contain what I need. When trying to add the .so files to my image I get the errors
ERROR: dbcppp-1.0+gitrAUTOINC+917c925638-r0 do_package_qa: QA Issue: -dev package dbcppp-dev contains non-symlink .so '/usr/lib/libdbcppp.so'
-dev package dbcppp-dev contains non-symlink .so '/usr/lib/libxmlmm.so' [dev-elf]
ERROR: dbcppp-1.0+gitrAUTOINC+917c925638-r0 do_package_qa: QA Issue: dbcppp rdepends on dbcppp-dev [dev-deps]
ERROR: dbcppp-1.0+gitrAUTOINC+917c925638-r0 do_package_qa: QA run found fatal errors. Please consider fixing them.
ERROR: Logfile of failure stored in: /home/michael/Documents/MAIN_Application/build-fb/tmp/work/cortexa7t2hf-neon-poky-linux-gnueabi/dbcppp/1.0+gitrAUTOINC+917c925638-r0/temp/log.do_package_qa.10943
ERROR: Task (/home/michael/Documents/MAIN_Application/MAIN_layers/meta-MAINapplication/recipes-core/dbcppp/dbcppp_0.0.bb:do_package_qa) failed with exit code '1'
My recipe is as follows:
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "gitsm://github.com/xR3b0rn/dbcppp.git;protocol=https;branch=master"
PV = "1.0+gitr${SRCPV}"
SRCREV = "${AUTOREV}"
S = "${WORKDIR}/git"
inherit pkgconfig cmake
INSANE_SKIP:${PN} = "ldflags"
INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_SYSROOT_STRIP = "1"
SOLIBS = ".so"
FILES_SOLIBSDEV = ""
do_install() {
install -d ${D}${bindir}
install -m 0755 ${B}/bin/dbcppp ${D}${bindir}
install -d ${D}${libdir}
install -m 0755 ${B}/src/libdbcppp/libdbcppp.so ${D}${libdir}
install -m 0755 ${B}/libxmlmm.so ${D}${libdir}
install -m 0755 ${B}/third-party/libxml2/libxml2.so.2.9.10 ${D}${libdir}
}
FILES_${PN} += "${libdir}/*"
FILES_${PN}-dev = "${libdir}/* ${includedir}"
I have been searching for a while but I cannot find a solution. What do I need to do for this to work?
Edit 1: I updated my bb file to the following. This works but it does not place the necessary header files into my SDK.
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "gitsm://github.com/xR3b0rn/dbcppp.git;protocol=https;branch=master"
PV = "1.0+gitr${SRCPV}"
SRCREV = "${AUTOREV}"
S = "${WORKDIR}/git"
inherit cmake
INSANE_SKIP:${PN} = "ldflags"
INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_SYSROOT_STRIP = "1"
SOLIBS = ".so"
FILES_SOLIBSDEV = ""
do_install() {
install -d ${D}${bindir}
install -m 0755 ${B}/bin/dbcppp ${D}${bindir}
install -d ${D}${libdir}
install -m 0755 ${B}/src/libdbcppp/libdbcppp.so ${D}${libdir}
install -m 0755 ${B}/libxmlmm.so ${D}${libdir}
install -m 0755 ${B}/third-party/libxml2/libxml2.so ${D}${libdir}
}
FILES_${PN} += "${libdir}/*.so"
FILES_${PN}-dev = "${includedir}"
The dbcppp Cmake file already has an install target that installs everything automatically, so you do not need do_install.
Try the following recipe:
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "gitsm://github.com/xR3b0rn/dbcppp.git;protocol=https;branch=master"
PV = "1.0+gitr${SRCPV}"
SRCREV = "${AUTOREV}"
S = "${WORKDIR}/git"
inherit cmake
FILES_${PN} += "/usr/lib/xml2Conf.sh /usr/lib/lib*.so.*"
SOLIBS = ".so"
FILES_SOLIBSDEV = ""
INSANE_SKIP_${PN} += "dev-so"
The non-versioned shared libraries .so topic is difficult in Yocto, that's why skipping the QA shared library issue is the way to go here if you have no control on the source project's files/libraries.
The above recipe splits into multiple packages:
dbcppp (If you want just the dbcppp binary (.so files are shipped for the binary to run)
dbcppp-dev (If you want the header files and the shared libraries)
dbcppp-doc (If you want the man and html pages)

How to build when multiple source files in rootfs in embedded linux?

I have a simple c application
Ctest.c file
#include <stdio.h>
#include "new.h"
#include "new.c"
int main()
{
switching();
return 0;
}
and i have those new.c and new.h files.
new.h file as
void switching();
and my new.c file as
void switching(){
char grade ='B';
switch(grade){
case 'A':
printf("Excellent\n");
break;
case 'B':
printf("Super\n");
break;
case 'C':
printf("Well done\n");
break;
case 'D':
printf("You passed\n");
break;
case 'F':
printf("Better try again");
break;
default:
printf("invalid grade");
break;
}
printf("your grade is %c \n",grade);
}
When i try to use build commands in my embedded linux tool for compiling and generating a binary , building is failed and here is my changed make file for the application on rootfs.
make file for the app Ctest:
APP = Ctest
# Add any other object files to this list below
APP_OBJS = Ctest.o
APP_OBJS += new.o
all: build
build: $(APP)
$(APP): $(APP_OBJS)
$(CC) $(LDFLAGS) -o $# $(APP_OBJS) $(LDLIBS)
Here is my error log during compile time
DEBUG: Executing shell function do_compile
NOTE: make -j 4
ERROR: oe_runmake failed
aarch64-xilinx-linux-gcc --sysroot=/home/janani/projects/peta2017.1-zcu102/zcu102/petlnx_zcu102/build/tmp/sysroots/plnx_aarch64 -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/janani/projects/peta2017.1-zcu102/zcu102/petlnx_zcu102/build/tmp/work/aarch64-xilinx-linux/Ctest/1.0-r0=/usr/src/debug/Ctest/1.0-r0 -fdebug-prefix-map=/home/janani/projects/peta2017.1-zcu102/zcu102/petlnx_zcu102/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/home/janani/projects/peta2017.1-zcu102/zcu102/petlnx_zcu102/build/tmp/sysroots/plnx_aarch64= -c -o Ctest.o Ctest.c
aarch64-xilinx-linux-gcc --sysroot=/home/janani/projects/peta2017.1-zcu102/zcu102/petlnx_zcu102/build/tmp/sysroots/plnx_aarch64 -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/janani/projects/peta2017.1-zcu102/zcu102/petlnx_zcu102/build/tmp/work/aarch64-xilinx-linux/Ctest/1.0-r0=/usr/src/debug/Ctest/1.0-r0 -fdebug-prefix-map=/home/janani/projects/peta2017.1-zcu102/zcu102/petlnx_zcu102/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/home/janani/projects/peta2017.1-zcu102/zcu102/petlnx_zcu102/build/tmp/sysroots/plnx_aarch64= -c -o new.o new.c
new.c: In function 'switching':
new.c:5:13: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
printf("Excellent\n");
^~~~~~
new.c:5:13: warning: incompatible implicit declaration of built-in function 'printf'
new.c:5:13: note: include '<stdio.h>' or provide a declaration of 'printf'
new.c:24:5: warning: incompatible implicit declaration of built-in function 'printf'
printf("your grade is %c \n",grade);
^~~~~~
new.c:24:5: note: include '<stdio.h>' or provide a declaration of 'printf'
Ctest.c:33:17: fatal error: new.h: No such file or directory
#include "new.h"
^
compilation terminated.
make: *** [<builtin>: Ctest.o] Error 1
make: *** Waiting for unfinished jobs....
ERROR: Function failed: do_compile (log file is located at /home/janani/projects/peta2017.1-zcu102/zcu102/petlnx_zcu102/build/tmp/work/aarch64-xilinx-linux/Ctest/1.0-r0/temp/log.do_compile.19737)
i understood that i need to do changes in the make file or bitbake file that build the application ie., Ctest.bb file If so what are the changes? And I am using petalinux 2017.1
the bitbake file of the application is
#
# This file is the Ctest recipe.
#
SUMMARY = "Simple Ctest application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://Ctest.c \
file://new.c \
file://Makefile \
"
S = "${WORKDIR}"
do_compile() {
oe_runmake
}
do_install() {
install -d ${D}${bindir}
install -m 0755 Ctest ${D}${bindir}
install -m 0755 new ${D}${bindir}
}
How can i give new.h file into the make file or do i need to change the bitbake file?
Your Ctest.c file includes new.c so you should not be trying to build new.o at all. Remove the line
APP_OBJS += new.o
and
install -m 0755 new ${D}${bindir}
You are not providing the new.h file in your SRC_URI. Change it to
SRC_URI = "file://Ctest.c \
file://new.c \
file://new.h \
file://Makefile \
"

PNaCl & gtest—pnacl-ld: Incompatible object file (X8664 != X8632)

I'm a newbie at this,Please help me ...T_T...
Recently I was building pthreadpool(required by NNPACK) with ninja on my Ubuntu 14.04 64bit.
It requires Google PNaCl(Portable Native Client) and Google Test,and I installed both.
After I run python ./configure.py in pthreadpool root dir,
it generated a file build.ninja:
pnacl_toolchain_dir = $nacl_sdk_dir/toolchain/linux_pnacl
pnacl_cc = $pnacl_toolchain_dir/bin/pnacl-clang
pnacl_cxx = $pnacl_toolchain_dir/bin/pnacl-clang++
pnacl_ar = $pnacl_toolchain_dir/bin/pnacl-ar
pnacl_finalize = $pnacl_toolchain_dir/bin/pnacl-finalize
pnacl_translate = $pnacl_toolchain_dir/bin/pnacl-translate
pnacl_sel_ldr = $nacl_sdk_dir/tools/sel_ldr.py
cflags = -std=gnu11
cxxflags = -std=gnu++11
optflags = -O3
rule cc
command = $pnacl_cc -o $out -c $in -MMD -MF $out.d $optflags $cflags $
$includes
description = CC[PNaCl] $descpath
depfile = $out.d
deps = gcc
rule cxx
command = $pnacl_cxx -o $out -c $in -MMD -MF $out.d $optflags $cxxflags $
$includes
description = CXX[PNaCl] $descpath
depfile = $out.d
deps = gcc
rule ccld
command = $pnacl_cc -o $out $in $libs $libdirs $ldflags
description = CCLD[PNaCl] $descpath
rule cxxld
command = $pnacl_cxx -o $out $in $libs $libdirs $ldflags
description = CXXLD[PNaCl] $descpath
rule ar
command = $pnacl_ar rcs $out $in
description = AR[PNaCl] $descpath
rule finalize
command = $pnacl_finalize $finflags -o $out $in
description = FINALIZE[PNaCl] $descpath
rule translate
command = $pnacl_translate -arch $arch -o $out $in
description = TRANSLATE[PNaCl] $descpath
rule run
command = $pnacl_sel_ldr $in
description = RUN[PNaCl] $descpath
pool = console
rule install
command = install -m $mode $in $out
description = INSTALL $out
build /home/rokim/NNPACK/third-party/pthreadpool/build/pthreadpool.c.bc: cc $
/home/rokim/NNPACK/third-party/pthreadpool/src/pthreadpool.c
descpath = pthreadpool.c
includes = -I$nacl_sdk_dir/include $
-I/home/rokim/NNPACK/third-party/pthreadpool/include $
-I/home/rokim/NNPACK/third-party/pthreadpool/src
build $
/home/rokim/NNPACK/third-party/pthreadpool/artifacts/libpthreadpool.a: $
ar /home/rokim/NNPACK/third-party/pthreadpool/build/pthreadpool.c.bc
descpath = libpthreadpool.a
build $
/home/rokim/NNPACK/third-party/pthreadpool/build/test/pthreadpool.cc.bc: $
cxx /home/rokim/NNPACK/third-party/pthreadpool/test/pthreadpool.cc
descpath = pthreadpool.cc
includes = -I$nacl_sdk_dir/include $
-I/home/rokim/NNPACK/third-party/pthreadpool/include $
-I/home/rokim/NNPACK/third-party/pthreadpool/src
build /home/rokim/NNPACK/third-party/pthreadpool/build/test/pthreadpool.bc: $
cxxld /home/rokim/NNPACK/third-party/pthreadpool/build/pthreadpool.c.bc $
/home/rokim/NNPACK/third-party/pthreadpool/build/test/pthreadpool.cc.bc
libs = -lgtest
libdirs = -L$nacl_sdk_dir/lib/pnacl/Release
descpath = pthreadpool.bc
build $
/home/rokim/NNPACK/third-party/pthreadpool/artifacts/pthreadpool.pexe: $
finalize $
/home/rokim/NNPACK/third-party/pthreadpool/build/test/pthreadpool.bc
descpath = pthreadpool.pexe
build $
/home/rokim/NNPACK/third-party/pthreadpool/artifacts/pthreadpool.nexe: $
translate $
/home/rokim/NNPACK/third-party/pthreadpool/artifacts/pthreadpool.pexe
arch = x86_64
descpath = pthreadpool.pexe
build test: run $
/home/rokim/NNPACK/third-party/pthreadpool/artifacts/pthreadpool.nexe
descpath = pthreadpool.nexe
default $
/home/rokim/NNPACK/third-party/pthreadpool/artifacts/libpthreadpool.a $
/home/rokim/NNPACK/third-party/pthreadpool/artifacts/pthreadpool.nexe
build /usr/local/include/pthreadpool.h: install $
/home/rokim/NNPACK/third-party/pthreadpool/include/pthreadpool.h
mode = 0644
build /usr/local/lib/libpthreadpool.a: install $
/home/rokim/NNPACK/third-party/pthreadpool/build/pthreadpool.c.bc
mode = 0644
build install: phony /usr/local/include/pthreadpool.h $
/usr/local/lib/libpthreadpool.a
But when I run the command ninja,there came the error:
[4/6] CXXLD[PNaCl] pthreadpool.bc
FAILED: /home/rokim/NNPACK/third-party/pthreadpool/build/test/pthreadpool.bc
/toolchain/linux_pnacl/bin/pnacl-clang++ -o /home/rokim/NNPACK/third-party/pthreadpool/build/test/pthreadpool.bc /home/rokim/NNPACK/third-party/pthreadpool/build/pthreadpool.c.bc /home/rokim/NNPACK/third-party/pthreadpool/build/test/pthreadpool.cc.bc -lgtest -L/lib/pnacl/Release
pnacl-ld: Cannot find '-lgtest'
ninja: build stopped: subcommand failed.
I thought it may be the path problem,so I put libgtest.a and libgtest_main.a (Generated from Google Test) in /usr/lib/gtest and modified the build.ninja:
libs = -L/usr/lib/gtest -lgtest_main -lgtest
It seems ninja found the lib files, but there came the error:
[1/3] CXXLD[PNaCl] pthreadpool.bc
FAILED: /home/rokim/NNPACK/third-party/pthreadpool/build/test/pthreadpool.bc
/toolchain/linux_pnacl/bin/pnacl-clang++ -o /home/rokim/NNPACK/third-party/pthreadpool/build/test/pthreadpool.bc /home/rokim/NNPACK/third-party/pthreadpool/build/pthreadpool.c.bc /home/rokim/NNPACK/third-party/pthreadpool/build/test/pthreadpool.cc.bc -L/usr/lib/gtest -lgtest_main -lgtest -L/lib/pnacl/Release
pnacl-ld: /usr/lib/gtest/libgtest_main.a: Incompatible object file (X8664 != X8632)
ninja: build stopped: subcommand failed.
I believe the lib files are good since I tried to use g++ to compile a test.cpp:
g++ test.cpp -lgtest_main -lgtest -lpthread
And it worked.
So I thought it might be something wrong about pnacl or the way I use it.I googled the 32bit 64bit incompatible problem about pnacl and gtest but I got nothing. Now I have totally no idea about what to do since I'm a newbie at this...
So please, any help, idea or suggestions would be greatly appriciate!
For Google PNaCl,I downloaded the nacl_sdk.zip and unziped it to /home/rokim/nacl_sdk and I got sdk_tools and pepper_49 up to date.
For Google Test,I run sudo apt-get install libgtest-dev . After cmake and make I got libgtest.a and libgtest_main.a then I put them into /usr/lib and /usr/local/lib.The gtest include file are put into /usr/include and usr/local/include.
You can't use libgtest from the host system with the NaCl compilers. Everything you link has to be built with the same (NaCl) compiler. So you want to build libgtest with pnacl-clang, and link that with your other PNaCl build.

Qmake - doesn't copy file in linux

That code
defineTest(deployFiles) {
win32 {
to = $$shell_path($$3)
for(entry,1){
from = $$shell_path($$2/$$entry)
QMAKE_POST_LINK += $$quote(cmd /c copy /y $$from $$to $$escape_expand(\n\t))
PRE_TARGETDEPS += $$from
}
export(QMAKE_POST_LINK)
export(PRE_TARGETDEPS)
} else {
to = $$shell_path($$3)
for(entry,1){
from = $$shell_path($$2/$$entry)
QMAKE_POST_LINK += $$quote(cp $$from $$to $$escape_expand(\n\t))
PRE_TARGETDEPS += $$from
}
export(QMAKE_POST_LINK)
export(PRE_TARGETDEPS)
}
}
works only on Windows OS. Where $$from - file; $$to - directory.
And I unfortunately tried that:
QMAKE_POST_LINK += $$quote(xterm -e cp $$from $$to $$escape_expand(\n\t))
And unix instead else
If I put message($$QMAKE_POST_LINK) before export in linux block, in output I have message like that:
cp /home/user/QtProject/projects/Tools/qmldir /home/user/QtProject/qml/Tools/
cp /home/user/QtProject/projects/Tools/Tools.qml /home/user/QtProject/qml/Tools/
And output of grep "qmldir" -C 5 <my_build_dir>/Makefile (same as grep "Tools\.qml" -C 5 <my_build_dir>/Makefile) like that:
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o "$#" "$<"
####### Build rules
$(TARGET): /home/user/QtProject/projects/Tools/qmldir /home/user/QtProject/projects/Tools/Tools.qml $(OBJECTS)
Makefile: ../../../projects/Tools/Tools.pro /home/user/Qt/5.4/gcc_64/mkspecs/linux-g++/qmake.conf /home/user/Qt/5.4/gcc_64/mkspecs/features/spec_pre.prf \
/home/user/Qt/5.4/gcc_64/mkspecs/common/shell-unix.conf \
/home/user/Qt/5.4/gcc_64/mkspecs/common/unix.conf \
The project which does not work is of TEMPLATE type "aux", which is used when no compiler and no linker is involved. Thus the link command is empty.
Looks like QMAKE_POST_LINK is written only if there is a link command.
Makefile from app_sandbox.pro (TEMPLATE = app):
####### Build rules
$(TARGET): $(OBJECTS)
#test -d ../../bin/ || mkdir -p ../../bin/
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: ../../projects/app_sandbox/app_sandbox.pro ../../../Qt/5.4/gcc_64/mkspecs/linux-g++/qmake.conf ../../../Qt/5.4/gcc_64/mkspecs/features/spec_pre.prf \
Makefile from Controls.pro (TEMPLATE = aux):
####### Build rules
$(TARGET): /home/simon/nobackup/app_sandbox/projects/Design/Controls/qmldir /home/simon/nobackup/app_sandbox/projects/Design/Controls/TreeView.qml $(OBJECTS)
Makefile: ../../../projects/Design/Controls/Controls.pro ../../../../Qt/5.4/gcc_64/mkspecs/linux-g++/qmake.conf ../../../../Qt/5.4/gcc_64/mkspecs/features/spec_pre.prf \
As you can see, both specify dependencies for the target (after $(TARGET):) but there is no link command in the seconds Makefile.

make issue on Linux

I'm trying to debug an issue with a makefile I am working on.. What is confusing is that the target works when I run it from the command line, but does not work in my makefile..
Here is the makefile:
DDS_OUT_DIR = $(PWD)
IDL_DIR=/opt/idl/dds
IDL_TYPES=common.idl
GENERATED_SOURCES = $(IDL_TYPES:%.idl=%Support.cxx) $(IDL_TYPES:%.idl=%Plugin.cxx) $(IDL_TYPES:%.idl=%.cxx)
GENERATED_HEADERS = $(IDL_TYPES:%.idl=%Support.h) $(IDL_TYPES:%.idl=%Plugin.h) $(IDL_TYPES:%.idl=%.h)
OBJS_DIR = obj.$(CPUTYPE)
GENERATED_OBJS = $(GENERATED_SOURCES:%.cxx=$(OBJS_DIR)/%.o)
LIBDIR = ../../lib.$(CPUTYPE)
BINDIR = ../../../../bin.$(CPUTYPE)
CC = $(C_COMPILER)
CXX = $(CPP_COMPILER)
OS = $(shell uname)
DDSCOMMON = ../../Common/src
CFLAGS = -m32 -g
CXXFLAGS = -m32 -g
LDFLAGS = -m32 -static-libgcc
SYSLIBS = -ldl -lnsl -lpthread -lm -lc
DEFINES_ARCH_SPECIFIC = -DRTI_UNIX
DEFINES = $(DEFINES_ARCH_SPECIFIC) $(cxx_DEFINES_ARCH_SPECIFIC)
INCLUDES = -I. -I$(NDDSHOME)/include -I$(NDDSHOME)/include/ndds
INCLUDES += -I$(DDSCOMMON)
LIBS = -L$(NDDSLIBDIR) -L$(LIBDIR) -lrt \
-lnddscppz -lnddscz -lnddscorez $(SYSLIBS) $(OS_SPECIFIC_LIBS)
COMMONLIBSRC = $(DDSCOMMON)/dds_common.cxx
COMMONLIBOBJS = $(DDSCOMMON)/obj.$(CPUTYPE)/%.o
$(shell mkdir -p $(OBJS_DIR) $(DDSCOMMON)/obj.$(CPUTYPE))
default: ${IDL_TYPES} $(GENERATED_OBJS)
$(OBJS_DIR)/%.o : %.cxx %.h $(DDSCOMMON)/dds_common.h
$(CPP_COMPILER) -o $# $(DEFINES) $(INCLUDES) $(CXXFLAGS) -c $<
%.idl:
#echo "Generating CXX from $# ..." $(GENERATED_OBJS); \
$(NDDSHOME)/scripts/rtiddsgen ${IDL_DIR}/$# -d $(DDS_OUT_DIR) -I ${IDL_DIR} -replace -language C++;
if I just do this:
make
The %.idl target is called fine, when that finishes I get this output:
Generating CXX from common.idl ... obj.Linux-i686/commonSupport.o obj.Linux-i686/commonPlugin.o obj.Linux-i686/common.o
Running rtiddsgen version 4.5d, please wait ...
Done
make: *** No rule to make target `obj.Linux-i686/commonSupport.o', needed by `default'. Stop.
But then when I re-run it and everything compiles, so it works fine...
Why is this not working in one step?
commonSupport.cxx seems to depend on common.idl. Tell this to make.
commonSupport.cxx: common.idl
#echo "Generating CXX from $# ..." $(GENERATED_OBJS); \
$(NDDSHOME)/scripts/rtiddsgen ${IDL_DIR}/$# -d $(DDS_OUT_DIR) -I ${IDL_DIR} -replace -language C++;
Or, to ensure all dependencies are right:
$(GENERATED_SOURCES): common.idl
.... steps to make GENERATED_SOURCES from common.idl

Resources