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

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.

Related

do_install error while running custom bitbake in poky build

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

How to include a shared library (.so) or library in a R package?

1.I have a library fpmpi . I made the shared library fpmpi.so from this library.I am using ubuntu .
2.Now, I want to use in my R package .My R package has src folder the there is makevars.in file I
### Setup R source code and objects.
PKG_CPPFLAGS = #PKG_CPPFLAGS#
PKG_LIBS = -L/home/g/Desktop/Project -fpmpip
### For user configuration.
USER_CONF = Makeconf
### Start making here.
all: $(SHLIB)
#echo "MPIRUN = #MPIRUN#" > $(USER_CONF)
#echo "MPIEXEC = #MPIEXEC#" >> $(USER_CONF)
#echo "ORTERUN = #ORTERUN#" >> $(USER_CONF)
#echo "TMP_INC = #TMP_INC#" >> $(USER_CONF)
#echo "TMP_LIB = #TMP_LIB#" >> $(USER_CONF)
#echo "MPI_ROOT = #MPI_ROOT#" >> $(USER_CONF)
#echo "MPITYPE = #MPITYPE#" >> $(USER_CONF)
#echo "MPI_INCLUDE_PATH = #MPI_INCLUDE_PATH#" >> $(USER_CONF)
#echo "MPI_LIBPATH = #MPI_LIBPATH#" >> $(USER_CONF)
#echo "MPI_LIBS = #MPI_LIBS#" >> $(USER_CONF)
#echo "MPI_DEFS = #MPI_DEFS#" >> $(USER_CONF)
#echo "MPI_INCL2 = #MPI_INCL2#" >> $(USER_CONF)
#echo "PKG_CPPFLAGS = #PKG_CPPFLAGS#" >> $(USER_CONF)
#echo "PKG_LIBS = #PKG_LIBS#" >> $(USER_CONF)
$(SHLIB): $(OBJECTS)
clean:
#rm -rf *.o *.d *.rc *.so* *.dll *.dylib *.a *.lib \
Makedeps Makevars $(USER_CONF) $(SHLIB) $(OBJECTS)
where do i define the shared library path in it. And how would i verify it has been loaded.
The library is dynamic i have check using ldd fpmpi.so
I am using R CMD INSTALL package_name command to install package ?
The output of the R CMD INSTALL package_name is:
g#G:~/Documents/igauravsehrawat.github.io$ sudo R CMD INSTALL pbdMPI/
* installing to library ‘/home/g/R/x86_64-pc-linux-gnu-library/2.15’
* installing *source* package ‘pbdMPI’ ...
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking for mpirun... mpirun
checking for mpiexec... mpiexec
checking for orterun... orterun
checking for sed... /bin/sed
checking for mpicc... mpicc
checking for ompi_info... ompi_info
checking for mpich2version... mpich2version
found sed, mpicc, and ompi_info ...
gcc: error: unrecognized option '--showme:incdirs'
>> TMP_INC_DIRS =
gcc: error: unrecognized option '--showme:libdirs'
>> TMP_LIB_DIRS =
I am here /usr/lib/openmpi and it is OpenMPI
Trying to find mpi.h ...
Found in /usr/lib/openmpi/include
Trying to find libmpi.so or libmpich.a ...
Found libmpi in /usr/lib/openmpi/lib
checking for openpty in -lutil... yes
checking for main in -lpthread... yes
******************* Results of pbdMPI package configure *****************
>> TMP_INC = F
>> TMP_LIB = F
>> MPI_ROOT = /usr/lib/openmpi
>> MPITYPE = OPENMPI
>> MPI_INCLUDE_PATH = /usr/lib/openmpi/include
>> MPI_LIBPATH = /usr/lib/openmpi/lib
>> MPI_LIBS = -lutil -lpthread
>> MPI_DEFS = -DMPI2
>> MPI_INCL2 =
>> PKG_CPPFLAGS = -I/usr/lib/openmpi/include -DMPI2 -DOPENMPI
>> PKG_LIBS = -L/usr/lib/openmpi/lib -lmpi -lutil -lpthread
*************************************************************************
configure: creating ./config.status
config.status: creating src/Makevars
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating R/zzz.r
** libs
installing via 'install.libs.R' to /home/g/R/x86_64-pc-linux-gnu-library/2.15/pbdMPI
** R
** data
** moving datasets to lazyload DB
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
‘pbdMPI-guide.Rnw’
** testing if installed package can be loaded
* DONE (pbdMPI)
Thanks

Link error undefined reference to `dgels_' in Lapack

I followed this below webpage to install ATLAS + Lapack in linux :
http://math-atlas.sourceforge.net/atlas_install/node6.html
bunzip2 -c atlas3.10.1.tar.bz2 | tar xfm - # create SRCdir
mv ATLAS ATLAS3.10.1 # get unique dir name
cd ATLAS3.10.1 # enter SRCdir
mkdir Linux_C2D64SSE3 # create BLDdir
cd Linux_C2D64SSE3 # enter BLDdir
../configure -b 64 -D c -DPentiumCPS=2400 \ # configure command
--prefix=/home/whaley/lib/atlas \ # install dir
--with-netlib-lapack-tarfile=/home/whaley/dload/lapack-3.4.2.tgz
make build # tune & build lib
make check # sanity check correct answer
make ptcheck # sanity check parallel
make time # check if lib is fast
make install # copy libs to install dir
After that , I try to run an sample in
http://www.netlib.org/lapack/lapacke.html
the sample code :
#include <stdio.h>
#include <lapacke.h>
int main (int argc, const char * argv[])
{
double a[5*3] = {1,2,3,4,5,1,3,5,2,4,1,4,2,5,3};
double b[5*2] = {-10,12,14,16,18,-3,14,12,16,16};
lapack_int info,m,n,lda,ldb,nrhs;
int i,j;
m = 5;
n = 3;
nrhs = 2;
lda = 5;
ldb = 5;
info = LAPACKE_dgels(LAPACK_COL_MAJOR,'N',m,n,nrhs,a,lda,b,ldb);
for(i=0;i<n;i++)
{
for(j=0;j<nrhs;j++)
{
printf("%lf ",b[i+ldb*j]);
}
printf("\n");
}
return(info);
}
I have found out the build library has no iblapacke.a , so I build this library by myslef
cd lapack-3.4.2
cp make.inc.example make.inc
cd lapacke
make
Then , finally I have the iblapacke.a now , so I compile the sample above by :
g++ test3.cpp liblapacke.a -o test3.exe
I get the following errors :
liblapacke.a(lapacke_dgels_work.o): In function `LAPACKE_dgels_work':
lapacke_dgels_work.c:(.text+0x1dd): undefined reference to `dgels_'
lapacke_dgels_work.c:(.text+0x2b7): undefined reference to `dgels_'
After I google , I have found :
http://www.netlib.org/lapack/explore-html/d7/d3b/group__double_g_esolve.html
Functions/Subroutines
subroutine dgels (TRANS, M, N, NRHS, A, LDA, B, LDB, WORK, LWORK, INFO)
DGELS solves overdetermined or underdetermined systems for GE matrices
There is a function dgels , without underline , and in
http://shtools.ipgp.fr/www/faq.html#l4
I think the underline is added for accident ,
nm -A liblapacke.a |grep "dgels_"
liblapacke.a:lapacke_dgels.o: U LAPACKE_dgels_work
liblapacke.a:lapacke_dgels_work.o: U LAPACKE_dge_trans
liblapacke.a:lapacke_dgels_work.o:0000000000000000 T LAPACKE_dgels_work
liblapacke.a:lapacke_dgels_work.o: U LAPACKE_xerbla
liblapacke.a:lapacke_dgels_work.o: U dgels_
liblapacke.a:lapacke_dgels_work.o: U free
liblapacke.a:lapacke_dgels_work.o: U malloc
I think I should try to not avoid underline like build "dgels" not to "dgels" while build liblapack.a ,means I should change something build Lapack and ATLAS ,
just don't know how to do it ....Any suggestion is appreciated !!
Update : http://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mkl_lapack_examples/c_bindings.htm
I have no idea if related , -Ddgels=dgels_ is added , the same link error !!
see:
http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=12&t=3336
for example:
gcc LinearEquation.c -Ilapack-3.5.0/lapacke/include/ -Llapack-3.5.0 -llapacke -llapack -lrefblas -lgfortran -o LinearEquation
the order of lapacke > lapack > refblas is important... also if you don't want to use the double step gcc gfortran, use -lgfortran
I had the exact same problem. You need to do it as follows:
gcc(or g++) -c -O3 -I ../include -o test.o test.c
and then
gfortran test.o ../liblapacke.a ../liblapack.a ../blas.a -o test.exe
You can then run it like so:
./test.exe
Basically, you need to follow the gcc compile with a gfortran compile. The -c option in the first command forces gcc to skip the linker. gfortran is then used to link the libraries.
You can learn more by looking at the makefile for the examples provided with LAPACKE.
I had the same problem (using g++), but fixed my problems by adding a -lblas and -lgfortran.
To resolve the issue, here are the steps I have done.
sudo apt-get install libblas-dev liblapack-dev gfortran
linking a -lblas and -lgfortran when it runs

Compiling wmii on Fedora 15 x86_64

I'm having trouble compiling wmii v3.9.2 on Fedora 15; Here's the interesting part (things break down at the linking stage):
% bmake -de
MAKE all libbio/
MAKE all libfmt/
MAKE all libregexp/
MAKE all libutf/
MAKE all libixp/
MAKE all doc/
MAKE all man/
MAKE all cmd/
MAKE all cmd/wmii/
MAKE all cmd/menu/
LD cmd/wmii9menu.out
/usr/bin/ld: wmii/xext.o: undefined reference to symbol 'XRenderFindVisualFormat'
/usr/bin/ld: note: 'XRenderFindVisualFormat' is defined in DSO /usr/lib64/libXrender.so.1 so try adding it to the linker command line
/usr/lib64/libXrender.so.1: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
*** Failed target: wmii9menu.out
*** Failed command: ../util/link "cc" "$(pkg-config --libs 2>/dev/null) -g -L../lib -L/usr/lib64 ../lib/libregexp9.a ../lib/libbio.a ../lib/libfmt.a ../lib/libutf.a -L../lib -L/usr/lib64 ../lib/libregexp9.a ../lib/libbio.a ../lib/libfmt.a ../lib/libutf.a" wmii9menu.out wmii9menu.o clientutil.o wmii/x11.o wmii/xext.o wmii/geom.o wmii/map.o util.o ../lib/libixp.a $(pkg-config --libs xft xrandr xinerama) -lXext
*** Error code 1
Stop.
bmake: stopped in /srv/redhat/BUILD/wmii+ixp-3.9.2/cmd
*** Failed target: dall
*** Failed command: dirs="libbio libfmt libregexp libutf libixp doc man cmd libwmii_hack rc alternative_wmiircs"; set -e; targ=dall; targ=${targ#d}; for i in $dirs; do export WMII_HGVERSION=""; export BASE=$i/; if [ ! -d $i ]; then echo Skipping nonexistent directory: $i 1>&2; else echo MAKE $targ $BASE; (cd $i && bmake $targ) || exit ; fi; done
*** Error code 1
Stop.
bmake: stopped in /srv/redhat/BUILD/wmii+ixp-3.9.2
Finally, in config.mk, I have the following settings:
...
INCLUDES = -I. -I$(ROOT)/include -I$(INCLUDE) -I/usr/include
LIBS = -L$(ROOT)/lib -L/usr/lib64
...
LDFLAGS += -g $(LIBS)
SOLDFLAGS += $(LDFLAGS)
SHARED = -shared -Wl,-soname=$(SONAME)
STATIC = -static
...
With a little more manual resolution, the statement generating the error is essentially as follows:
gcc \
-o wmii9menu.out\
-L../lib -L/usr/lib $(pkg-config --libs xft xrandr xinerama xext)\
../lib/libregexp9.a ../lib/libbio.a ../lib/libfmt.a\
../lib/libutf.a ../lib/libixp.a\
wmii9menu.o clientutil.o util.o\
wmii/x11.o wmii/xext.o wmii/geom.o wmii/map.o
Here, the pkg-config resolves to the following, which by itself is perfectly correct:
-lXft -lXrandr -lXinerama -lXext
And the solution is as follows:
--- wmii+ixp-3.9.2/config.mk 2011-06-03 14:03:22.950163074 +1000
+++ wmii+ixp-3.9.2/config.mk 2011-06-03 14:03:16.086129011 +1000
## -32 +32 ##
-X11PACKAGES = xft
+X11PACKAGES = xft xext xrandr xrender xinerama

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