Where is install directory? - c++

I've download LEDA link
but when I do make install ther is a problem: directory incl/LEDA/INCLUDE does not exist.
This is the makefile
SHELL=/bin/sh
cc = $(shell basename $(CURDIR))
sys = $(shell cmd/leda.sys)
instdir = /LEDA/INSTALL/$(sys)/$(cc)
default: lib
kernel:
./kernel_config
$(MAKE) lib xlman
all: lib tests
install: FORCE
cp -r -L incl /LEDA/INSTALL/$(sys)
if [ -f leda.lib ]; then cp leda.lib $(instdir); fi
if [ -f leda.dll ]; then cp leda.dll $(instdir); fi
if [ -f libleda.a ]; then cp libleda.a $(instdir); fi
if [ -f libleda.so ]; then cp libleda.so $(instdir); fi
FORCE: lib
#------------------------------------------------------------------------------
# libraries
#------------------------------------------------------------------------------
lib: .license
#if [ -f .license -a -d src ]; then $(MAKE) -C src; fi
#if [ -f .license -a -d src1 ]; then $(MAKE) -C src1; fi
#if [ -f .license -a -f closelib ]; then ./closelib; fi
#if [ -f .license -a -f static.mk ]; then $(MAKE) static; fi
#if [ -f .license -a -f shared.mk ]; then $(MAKE) shared; fi
touch:
#if [ -f .license -a -d src ]; then $(MAKE) -C src touch; fi
#if [ -f .license -a -d src1 ]; then $(MAKE) -C src1 touch; fi
#if [ -f .license -a -f static.mk ]; then $(MAKE) static; fi
#if [ -f .license -a -f shared.mk ]; then $(MAKE) shared; fi
nogui: .license
mv libleda.a libleda.a.gui
mv libleda.so libleda.so.gui
mv src/graphics src/graphics_
mv src1/graphics src1/graphics_
$(MAKE) touch
mv src/graphics_ src/graphics
mv src1/graphics_ src1/graphics
mv libleda.a libleda.so no_gui
mv libleda.a.gui libleda.a
mv libleda.so.gui libleda.so
gui: .license
$(MAKE) touch
lib0: .license
#if [ -f .license -a -d src ]; then $(MAKE) -C src; fi
#if [ -f .license -a -f closelib ]; then ./closelib; fi
#if [ -f .license -a -f static.mk ]; then $(MAKE) static; fi
#if [ -f .license -a -f shared.mk ]; then $(MAKE) shared; fi
lib1: .license
#if [ -f .license -a -d src1 ]; then $(MAKE) -C src1; fi
#if [ -f .license -a -f closelib ]; then ./closelib; fi
#if [ -f .license -a -f static.mk ]; then $(MAKE) static; fi
#if [ -f .license -a -f shared.mk ]; then $(MAKE) shared; fi
libL1:
cp libL.a libL1.a
mv src/system/_leda.o src/system/_leda_orig.o
$(MAKE) -C src/system -i L=L1 DFLAGS=-DLEDA_CHECK_LICENSE
mv src/system/_leda_orig.o src/system/_leda.o
agd:
$(MAKE) -C AGD
#if [ -f AGD/static.mk ]; then $(MAKE) -f AGD/static.mk; fi
#if [ -f AGD/shared.mk ]; then $(MAKE) -f AGD/shared.mk; fi
shared: .license
#if [ -f .license ]; then \
if [ -f shared.mk ]; then \
echo "$(MAKE) -f shared.mk"; $(MAKE) -f shared.mk; \
if [ -f libAGD.a ]; then \
echo "$(MAKE) -f shared.mk agd"; $(MAKE) -f shared.mk agd; fi; \
else echo "Not configured to build shared libs."; fi; fi
static: .license
#if [ -f .license ]; then $(MAKE) -f static.mk; fi
.license:
#/bin/sh confdir/util/unix/license.sh
#------------------------------------------------------------------------------
# programs
#------------------------------------------------------------------------------
xlman: .license
#if [ -f .license ]; then \
echo "$(MAKE) -C demo/xlman "; $(MAKE) -C demo/xlman; fi
static_xlman: .license
#if [ -f .license ]; then \
echo "$(MAKE) -C demo/xlman "; $(MAKE) -C demo/xlman static_xlman; fi
demos: .license
#if [ -f .license ]; then \
if [ -d demo ]; then $(MAKE) -C demo; fi; fi
tests: .license
#if [ -f .license ]; then \
if [ -d test ]; then $(MAKE) -C test; fi; fi
#------------------------------------------------------------------------------
# manual
#------------------------------------------------------------------------------
man: .license
#if [ -f .license ]; then \
echo "$(MAKE) -C Manual/MANUAL ";\
$(MAKE) -C Manual/MANUAL; fi
pdfman: .license
#if [ -f .license ]; then \
echo "$(MAKE) -C Manual/MANUAL pdf";\
$(MAKE) -C Manual/MANUAL pdf; fi
dvi: .license
#if [ -f .license ]; then \
echo "$(MAKE) -C Manual/MANUAL dvi";\
$(MAKE) -C Manual/MANUAL dvi; fi
#------------------------------------------------------------------------------
# cleaning up
#------------------------------------------------------------------------------
del:
#if [ -d src ]; then $(MAKE) -C src clean; fi
#if [ -d src1 ]; then $(MAKE) -C src1 clean; fi
#if [ -d prog ]; then $(MAKE) -C prog del; fi
#if [ -d test ]; then $(MAKE) -C test del; fi
#if [ -d demo ]; then $(MAKE) -C demo del; fi
rm -f lib*.a lib*.so lib*.sl lib*.lib leda.dll leda.lib
clean:
#if [ -d src ]; then $(MAKE) -C src clean; fi
#if [ -d src1 ]; then $(MAKE) -C src1 clean; fi
#if [ -d prog ]; then $(MAKE) -C prog clean; fi
#if [ -d test ]; then $(MAKE) -C test clean; fi
#if [ -d demo ]; then $(MAKE) -C demo clean; fi
and this the install guide
********************************************************************
* *
* LEDA *
* *
* UNIX OBJECT CODE INSTALLATION *
* *
********************************************************************
Remark: This file describes the situation in a LEDA package.
1. Files and Directories
------------------------
To compile and link your programs with LEDA, the LEDA main directory
should contain at least the following files and subdirectories:
Readme.txt Readme File
Install/unix.txt this file
incl/ the LEDA include directory
libleda.a (libleda.so) basic library
The static library has extension .a. If a shared library is provided
it has extension .so.
2. Preparations
---------------
Unpacking the LEDA distribution file
LEDA-<ver>-<sys>-<cc>.tar.gz will create the LEDA root
directory "LEDA-<ver>-<sys>-<cc>". You might want to rename
it or move it to some different place. Let <LEDA> denote the final
complete path name of the LEDA root directory.
To install and use the Unix object code of LEDA you have to modify
your environment as follows:
a) LEDAROOT:
Set the environment variable LEDAROOT to the LEDA root directory:
csh/tcsh: setenv LEDAROOT <LEDA>
sh/bash: LEDAROOT=<LEDA>
export LEDAROOT
b) Command Search Path:
Include $LEDAROOT/Manual/cmd into your command search path
(environment variable path (csh) or PATH (sh)) and call rehash (if
required by your system).
c) Shared Library: (for solaris, linux, irix, osf1)
If you planning to use shared libraries include $LEDAROOT into the
LD_LIBRARY_PATH search path. Then go to $LEDAROOT and type
make shared. This will construct the shared libraries from the static
libraries.
Please note: Building the shared library is not supported on each
platform.
d) xlman and demos: Go to $LEDAROOT and type make xlman to compile
and link LEDA's interactive manual reader xlman. Now you can start
xlman for reading and printing manual pages, starting demo programs
and browsing more release notes.
3. Compiling and linking application programs
---------------------------------------------
a) Use the -I compiler flag to tell the compiler where to find the
LEDA header files.
CC (g++) -I$LEDAROOT/incl -c file.c
b) Use the -L compiler flag to tell the compiler where to find the
library (libleda.a/so)
CC (g++) -L$LEDAROOT file.o -lleda -lX11 -lm
If using windows on solaris systems you might have to link
with the system socket library and the network services library as
well:
CC (g++) ... -lleda -lX11 -lsocket -lnsl -lm
c) Compile and link simultaneously with
CC (g++) -I$LEDAROOT/incl -L$LEDAROOT file.c -lleda -lX11 -lm
You may want to ask your system adminstrator to install the header
files and library in the system's default directories.
Then you no longer have to specify header and library search paths on
the compiler command line.
4. Example programs and demos
-----------------------------
The source code of all example and demo programs can be found in
$LEDAROOT/test and $LEDAROOT/demo. Goto $LEDAROOT/test or
$LEDAROOT/demo and type "make" to compile and link all test or demo
programs, respectively.
5. User Manual
--------------
Postscript, PDF, and HTML versions of the manual are available at
http://www.algorithmic-solutions.com
I need a Shared Library. But I cant'understend how install it. I'm new from LEDA end makefile. Can you help me end explein step by step?
If i put make share the risult is:
Not configured to build shared libs.
What can I do?

The makefile branches out into two other makefiles, depending on what library you have (static (should always be there) or shared). Your output suggests that you don't have an appropriate shared library in any of the places the makefile is searching in. Did you add the variable $LEDAROOT to LD_LIBRARY_PATH (under sh/bash:export LD_LIBRARY_PATH="$LEDAROOT:$LD_LIBRARY_PATH") as suggested in the installation guide (section 2.c.)?
Otherwise it might be worth a try to build with make static. Only after this build has successfully finished,make install will be able to work.

Related

"undefined reference to" linux with make libnl

I am trying to build a project in Linux and I have many errors of this style:
/usr/bin/ld: //usr/local/lib/libnl-route-3.so: undefined reference to `nlmsg_hdr#libnl_3'.
I have looked at many of the similar threads available but none have worked for me. I have libnl-3-dev and libnl-genl-3-dev installed, but when executing the "make" command I have like 20 erros similar to the above with different references but the same "libnl-route-3.so".
I'm new to Makefiles, I have tried to modified it to see if the result changed, but there have not been improvements.
I leave below the Makefile, it is quite long, and execution shows the errors when it reaches the "server" part.
In order to build, I first "qmake" and then "make", any help is appreciated. It seems that libnl3 package is in /usr/include/libnl3/netlink, I think that the problem is that it is not linked correctly but I have not been able to do it.
MAKEFILE = Makefile
first: make_first
QMAKE = /usr/lib/qt5/bin/qmake
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = cp -f
COPY_DIR = cp -f -R
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = cp -f -R
QINSTALL = /usr/lib/qt5/bin/qmake -install qinstall
QINSTALL_PROGRAM = /usr/lib/qt5/bin/qmake -install qinstall -exe
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
TAR = tar -cf
COMPRESS = gzip -9f
DISTNAME = ost1.0.0
DISTDIR = /home/pi/Desktop/CAF/Ostinato/ostinato_master/.tmp/ost1.0.0
SUBTARGETS = \
client \
server \
sub-common-ostproto-pro \
sub-common-ostprotogui-pro \
sub-rpc-pbrpc-pro \
sub-extra
server-qmake_all: sub-common-ostproto-pro-qmake_all sub-rpc-pbrpc-pro-qmake_all FORCE
#test -d server/ || mkdir -p server/
cd server/ && $(QMAKE) -o Makefile.drone /home/pi/Desktop/CAF/Ostinato/ostinato_master/server/drone.pro
cd server/ && $(MAKE) -f Makefile.drone qmake_all
server: sub-common-ostproto-pro \
sub-rpc-pbrpc-pro FORCE
#test -d server/ || mkdir -p server/
cd server/ && ( test -e Makefile.drone || $(QMAKE) -o Makefile.drone /home/pi/Desktop/CAF/Ostinato/ostinato_master/server/drone.pro ) && $(MAKE) -f Makefile.drone
server-make_first: sub-common-ostproto-pro-make_first sub-rpc-pbrpc-pro-make_first FORCE
#test -d server/ || mkdir -p server/
cd server/ && ( test -e Makefile.drone || $(QMAKE) -o Makefile.drone /home/pi/Desktop/CAF/Ostinato/ostinato_master/server/drone.pro ) && $(MAKE) -f Makefile.drone
server-all: sub-common-ostproto-pro-all sub-rpc-pbrpc-pro-all FORCE
#test -d server/ || mkdir -p server/
cd server/ && ( test -e Makefile.drone || $(QMAKE) -o Makefile.drone /home/pi/Desktop/CAF/Ostinato/ostinato_master/server/drone.pro ) && $(MAKE) -f Makefile.drone all
server-clean: sub-common-ostproto-pro-clean sub-rpc-pbrpc-pro-clean FORCE
#test -d server/ || mkdir -p server/
cd server/ && ( test -e Makefile.drone || $(QMAKE) -o Makefile.drone /home/pi/Desktop/CAF/Ostinato/ostinato_master/server/drone.pro ) && $(MAKE) -f Makefile.drone clean
server-distclean: sub-common-ostproto-pro-distclean sub-rpc-pbrpc-pro-distclean FORCE
#test -d server/ || mkdir -p server/
cd server/ && ( test -e Makefile.drone || $(QMAKE) -o Makefile.drone /home/pi/Desktop/CAF/Ostinato/ostinato_master/server/drone.pro ) && $(MAKE) -f Makefile.drone distclean
server-install_subtargets: sub-common-ostproto-pro-install_subtargets sub-rpc-pbrpc-pro-install_subtargets FORCE
#test -d server/ || mkdir -p server/
cd server/ && ( test -e Makefile.drone || $(QMAKE) -o Makefile.drone /home/pi/Desktop/CAF/Ostinato/ostinato_master/server/drone.pro ) && $(MAKE) -f Makefile.drone install
server-uninstall_subtargets: sub-common-ostproto-pro-uninstall_subtargets sub-rpc-pbrpc-pro-uninstall_subtargets FORCE
#test -d server/ || mkdir -p server/
cd server/ && ( test -e Makefile.drone || $(QMAKE) -o Makefile.drone /home/pi/Desktop/CAF/Ostinato/ostinato_master/server/drone.pro ) && $(MAKE)
server-distdir: FORCE
#test -d server/ || mkdir -p server/
cd server/ && ( test -e Makefile.drone || $(QMAKE) -o Makefile.drone /home/pi/Desktop/CAF/Ostinato/ostinato_master/server/drone.pro ) && $(MAKE) -e -f Makefile.drone distdir DISTDIR=$(DISTDIR)/server
The command output:
make[1]: Entering directory '/home/pi/Desktop/CAF/Ostinato/ostinato_master/server'
g++ -Wl,-O1 -o drone devicemanager.o device.o emuldevice.o drone_main.o drone.o portmanager.o abstractport.o pcapport.o pcapsession.o pcaptransmitter.o pcaprxstats.o pcaptxstats.o pcaptxthread.o bsdhostdevice.o bsdport.o linuxhostdevice.o linuxport.o params.o winhostdevice.o winpcapport.o myservice.o pcapextra.o packetbuffer.o version.o moc_drone.o moc_pcaptransmitter.o moc_myservice.o -lpcap -L../common -lostproto -L../rpc -lpbrpc -lnl-3 -lnl-route-3 -lm -lprotobuf -lQt5Network -lQt5Script -lQt5Xml -lQt5Core -lpthread -latomic
/usr/bin/ld: //usr/local/lib/libnl-route-3.so: undefined reference to `nl_ticks2us#libnl_3'
/usr/bin/ld: //usr/local/lib/libnl-route-3.so: undefined reference to `nla_parse_nested#libnl_3'
/usr/bin/ld: //usr/local/lib/libnl-route-3.so: undefined reference to `nla_get_u32#libnl_3'
/usr/bin/ld: //usr/local/lib/libnl-route-3.so: undefined reference to `nl_cache_pickup#libnl_3'
/usr/bin/ld: //usr/local/lib/libnl-route-3.so: undefined reference to `nl_cache_mngt_register#libnl_3'
/usr/bin/ld: //usr/local/lib/libnl-route-3.so: undefined reference to `nl_addr_get_prefixlen#libnl_3'
/usr/bin/ld: //usr/local/lib/libnl-route-3.so: undefined reference to `__type2str#libnl_3'
/usr/bin/ld: //usr/local/lib/libnl-route-3.so: undefined reference to `nl_cache_alloc_and_fill#libnl_3'
/usr/bin/ld: //usr/local/lib/libnl-route-3.so: undefined reference to `nl_us2ticks#libnl_3'
/usr/bin/ld: //usr/local/lib/libnl-route-3.so: undefined reference to `nl_geterror#libnl_3'
/usr/bin/ld: //usr/local/lib/libnl-route-3.so: undefined reference to `nla_get_string#libnl_3'
/usr/bin/ld: //usr/local/lib/libnl-route-3.so: undefined reference to `nl_str2af#libnl_3'
/usr/bin/ld: //usr/local/lib/libnl-route-3.so: undefined reference to `nl_addr_build#libnl_3'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile.drone:220: drone] Error 1
make[1]: Leaving directory '/home/pi/Desktop/CAF/Ostinato/ostinato_master/server'
make: *** [Makefile:79: server-make_first] Error 2

No moc file is generated by make

I try to compile a qt cpp file but no moc is generated for Q_OBJECT objects. I am using Maya's distribution of qt. My makefile.qt file looks like this and I am compiling with make -f makefile.qt myPlugIn.bundle:
%.mak : %.pro qtconfig
$(QMAKE) -o - QMAKE_CC=$(CC) QMAKE_CXX=$(C++) $< | \
sed -e '/^TARGET.*=/s?=.*$$?= $$(QMAKE_TARGET).$(EXT)?' \
-e 's?-framework QtCore?$$(MAYA_LOCATION)/MacOS/QtCore?' \
-e 's?-framework QtGui?$$(MAYA_LOCATION)/MacOS/QtGui?' \
-e 's?-framework QtOpenGL?$$(MAYA_LOCATION)/MacOS/QtOpenGL?' \
-e 's?-framework QtTest?$$(MAYA_LOCATION)/MacOS/QtTest?' \
-e 's?-framework QtXml?$$(MAYA_LOCATION)/MacOS/QtXml?' \
-e 's?-dynamiclib??' -e 's?-mtune=generic??' >$#
PLUGINS = helixQtCmd.$(EXT) \
qtForms.$(EXT) \
saveSwatchesCmd.$(EXT)
ifeq ($(QMAKE),)
all:
#echo "Qt not found. Qt-based plug-ins will not be built."
else
all: $(PLUGINS)
endif
# For each plugin, make sure that its individual Makefile is up-to-date then
# use that Makefile to build the plugin.
.PHONY: force
%.$(EXT): force
$(MAKE) -f Makefile.qt $(#:.$(EXT)=.mak)
$(MAKE) -f $(#:.$(EXT)=.mak) $#
clean:
rm -f $(PLUGINS:.$(EXT)=.o) $(PLUGINS:.$(EXT)=.mak) \
moc_* ui_* qrc_*
Clean: clean
rm -f $(PLUGINS)
What command am I missing to generate this moc file ?
I finally added the following moc line:
%.$(EXT): force
moc $(#:.$(EXT)=.h) -o moc_$(#:.$(EXT)=.cpp)
$(MAKE) -f Makefile.qt $(#:.$(EXT)=.mak)
$(MAKE) -f $(#:.$(EXT)=.mak) $#

Why does make ignore my modifications?

I am trying to use E²LSH, here is the manual. When untarred, the folder of this library has a Makefile, a bin folder and a source folder (among with other stuff).
In the source folder there is LSHMain.cpp, which I have to modify.
I deleted the project (just to make sure I haven't destroyed something), re-download it, modifying the file and then I hit make, but when I run the executable it is like all my modifications are gone and the original code is taken into account only!
This happens regardless of building the project from scratch or not.
I suspect that this has to do with the scripts inside bin folder, because I have to run it like this:
bin/lsh argument_list
What should I change?
Here is the Makefile (reduced, since some stuff is irrelevant)
SOURCES_DIR:=sources
OBJ_DIR:=bin
OUT_DIR:=bin
TEST_DIR:=$(SOURCES_DIR)
#H_SOURCES:=`find $(SOURCES_DIR) -name "*.h"`
#CPP_SOURCES:=`find $(SOURCES_DIR) -name "*.cpp"`
#TEST_SOURCES:=`find $(TEST_DIR) -name "*.cpp"`
OBJ_SOURCES:=$(SOURCES_DIR)/BucketHashing.cpp \
$(SOURCES_DIR)/Geometry.cpp \
$(SOURCES_DIR)/LocalitySensitiveHashing.cpp \
$(SOURCES_DIR)/Random.cpp \
$(SOURCES_DIR)/Util.cpp \
$(SOURCES_DIR)/GlobalVars.cpp \
$(SOURCES_DIR)/SelfTuning.cpp \
$(SOURCES_DIR)/NearNeighbors.cpp
LSH_BUILD:=LSHMain
TEST_BUILDS:=exactNNs \
genDS \
compareOutputs \
genPlantedDS
GCC:=g++
OPTIONS:=-O3 -DREAL_FLOAT -DDEBUG
# -march=athlon -msse -mfpmath=sse
LIBRARIES:=-lm
#-ldmalloc
all:
bin/compile
c: compile
compile:
#mkdir -p $(OUT_DIR)
$(GCC) -o $(OUT_DIR)/$(LSH_BUILD) $(OPTIONS) $(OBJ_SOURCES) $(SOURCES_DIR)/$(LSH_BUILD).cpp $(LIBRARIES)
chmod g+rwx $(OUT_DIR)/$(LSH_BUILD)
and here are the compile and lsh scripts (inside the bin folder, the Makefile was in the same directory with source and bin folders):
#!/bin/bash
OUT_DIR=bin
SOURCES_DIR=sources
OBJ_SOURCES="$SOURCES_DIR/BucketHashing.cpp \
$SOURCES_DIR/Geometry.cpp \
$SOURCES_DIR/LocalitySensitiveHashing.cpp \
$SOURCES_DIR/Random.cpp \
$SOURCES_DIR/Util.cpp \
$SOURCES_DIR/GlobalVars.cpp \
$SOURCES_DIR/SelfTuning.cpp \
$SOURCES_DIR/NearNeighbors.cpp"
TEST_BUILDS="exactNNs \
genDS \
compareOutputs \
genPlantedDS"
defineFloat=REAL_FLOAT
g++ -o $OUT_DIR/testFloat -DREAL_FLOAT $OBJ_SOURCES $SOURCES_DIR/testFloat.cpp -lm >/dev/null 2>&1 || defineFloat=REAL_DOUBLE
OPTIONS="-O3 -D$defineFloat"
g++ -o $OUT_DIR/LSHMain $OPTIONS $OBJ_SOURCES $SOURCES_DIR/LSHMain.cpp -lm
chmod g+rwx $OUT_DIR/LSHMain
for i in $TEST_BUILDS; do
g++ -o ${OUT_DIR}/$i $OPTIONS ${SOURCES_DIR}/${i}.cpp $OBJ_SOURCES -lm; chmod g+rwx $OUT_DIR/${i};
done
the lsh script
#!/bin/bash
dir=bin
if [ $# -le 2 ]; then
echo Usage: $0 radius data_set_file query_set_file "[successProbability]"
exit
fi
paramsFile=$2.params
if [ $# -ge 4 ]; then
# success probability supplied
$dir/lsh_computeParams $1 "$2" "$3" $4 > "$paramsFile" || exit 1
else
# success probability not supplied
$dir/lsh_computeParams $1 "$2" "$3" > "$paramsFile" || exit 1
fi
chmod g+rw "$paramsFile"
echo "R*******" >/dev/stderr
echo "R*********************" >/dev/stderr
echo "R-NN DS params computed." >/dev/stderr
echo "R*********************" >/dev/stderr
echo "R*******" >/dev/stderr
$dir/lsh_fromParams "$2" "$3" "$paramsFile"
EDIT_1
When I run make I get:
bin/compile
sources/LocalitySensitiveHashing.cpp: In function ‘RNNParametersT readRNNParameters(FILE*)’:
sources/LocalitySensitiveHashing.cpp:62:22: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
(many many warnings, but no errors, I have checked that I can execute the program afterwards)
With make c I got:
g++ -o bin/LSHMain -O3 -DREAL_FLOAT -DDEBUG sources/BucketHashing.cpp sources/Geometry.cpp sources/LocalitySensitiveHashing.cpp sources/Random.cpp sources/Util.cpp sources/GlobalVars.cpp sources/SelfTuning.cpp sources/NearNeighbors.cpp sources/LSHMain.cpp -lm
warnings
chmod g+rwx bin/LSHMain
I really don't get why this didn't work....
With make compile I got:
g++ -o bin/LSHMain -O3 -DREAL_FLOAT -DDEBUG sources/BucketHashing.cpp sources/Geometry.cpp sources/LocalitySensitiveHashing.cpp sources/Random.cpp sources/Util.cpp sources/GlobalVars.cpp sources/SelfTuning.cpp sources/NearNeighbors.cpp sources/LSHMain.cpp -lm
warnings
chmod g+rwx bin/LSHMain
EDIT_2
the lsh_comouteParams is this:
#!/bin/bash
successProbability=0.9
if [ $# -le 1 ]; then
echo Usage: $0 radius data_set_file "{query_set_file | .} [successProbability]"
exit
fi
if [ $# -ge 4 ]; then
# success probability supplied
successProbability=$4
fi
arch=`uname`
nDataSet=` wc -l "$2"`
for x in $nDataSet; do nDataSet=$x; break; done
if [ "$3" != "." ]; then
nQuerySet=` wc -l "$3"`
for x in $nQuerySet; do nQuerySet=$x; break; done
else
nQuerySet=0
fi
dimension=`head -1 "$2" | wc -w`
#echo $nDataSet $nQuerySet $dimension
if [ -e bin/mem ]; then
m=`cat bin/mem`;
elif [ "$arch" = "Darwin" ]
then
#http://discussions.apple.com/thread.jspa?threadID=1608380&tstart=0
m=`top -l 1 | grep PhysMem | awk -F "[M,]" ' {print$10 }'`
let m=m*1024*1024
echo $m > bin/mem
else
s=`free -m | grep "Mem:"`
for i in $s; do m=$i; if [ "$i" != "Mem:" ]; then break; fi; done
m=${m}000000
echo $m > bin/mem
fi
bin/LSHMain $nDataSet $nQuerySet $dimension $successProbability "$1" "$2" "$3" $m -c
I had modified the file as such:
int main(int nargs, char **args){
printf("uoo\n");return 0;
if(nargs < 9){
usage(args[0]);
exit(1);
}
...
}
When E²LSH doesn't receive the correct arguments, it won't run it's LSHMain (regardless the fact that there is a relevant code for that in that file - which what tricked me so badly, because I thought that I was reaching that point inside main()).
There is a script in bin folder which will take over and print the very same message as usage() would print, that's why I thought that I was reaching that call. The function call lies inside if(nargs < 9), which made me to give in purpose less arguments so that it would sure fall inside that if and won't execute the algorithm (which takes time).
In short:
In order to reach the point that the code source/LSHMain.cpp gets executed one must pass the correct arguments to to bin/lsh. If not, bin/lsh script will only be executed, thus shadowing the modifications made in source/LSHMain.cpp.
Hope that this answer will make future users to avoid such a trap. Special thanks to Etan Reisner that helped me and eventually made me think to delete source/LSHMain.cpp, which made me to figure out what was happening.

How to write clean target?

First of all, I am not sure that what I am going to ask is my problem. Perhaps it is something else, so, please, don't hesitate to point that out. I think that the place I went wrong is the clean target of my Makefile, but it could be something else entirely.
Here is what happens: after running make clean and then make few targets, which have their resulting files deleted during the clean don't rebuild. (In addition to my question I'd be interested in a way to cancel entirely all caching GNU/Make does, it has been a major pain since whenever I ever used it, and never had any positive consequences, not even once).
If I then run make again, some of the targets are rebuilt. If I run make one more time, the targets that depend on the targets built in the previous round are rebuilt and so on.
Here's the corresponding Makefile section:
PACKAGE = i-iterate
DOCDST = ${PACKAGE}/docs
HTMLDOCDST = ${PACKAGE}/html-docs
DOCSRC = ${PACKAGE}/info
IC = makeinfo
ICO = --force
TEXI2HTML = texi2html
TEXI2HTMLO = --split section --use-nodes
HTML2WIKI = html2wiki
HTML2WIKIO = --dialect GoogleCode
TEXI = $(wildcard $(DOCSRC)/*.texi)
INFO = $(addprefix $(DOCDST)/,$(notdir $(TEXI:.texi=.info)))
WIKIDST = ../wiki
HTML = $(wildcard $(HTMLDOCDST)/*.html)
WIKI = $(addprefix $(WIKIDST)/,$(notdir $(HTML:.html=.wiki)))
$(DOCDST)/%.info: $(DOCSRC)/%.texi
echo "info builds: $<"
$(IC) $(ICO) -o $# $<
$(TEXI2HTML) $(TEXI2HTMLO) $<
$(WIKIDST)/%.wiki: $(HTMLDOCDST)/%.html
$(HTML2WIKI) $(HTML2WIKIO) $< > $#
default: prepare $(INFO) move-html $(WIKI) rename-wiki byte-compile
cp -r lisp info Makefile README i-pkg.el ${PACKAGE}
prepare:
mkdir -p ${PACKAGE}
mkdir -p ${DOCDST}
mkdir -p ${HTMLDOCDST}
move-html:
$(shell [[ '0' -ne `find ./ -maxdepth 1 -name "*.html" | wc -l` ]] && \
mv -f *.html ${HTMLDOCDST}/)
rename-wiki:
$(shell cd ${WIKIDST} && rename 'i-iterate' 'Iterate' *.wiki)
$(shell find ${WIKIDST} -name "*.wiki" -exec sed -i \
's/\[i-iterate/\[Iterate/g;s/\.html\#/\#/g;s/</\</g;s/>/\>/g' \
'{}' \;)
byte-compile:
emacs -Q -L ./lisp -batch -f batch-byte-compile ./lisp/*.el
clean:
rm -f ./lisp/*.elc
rm -f ./*.html
rm -rf ${DOCDST}
rm -rf ${HTMLDOCDST}
rm -rf ${PACKAGE}
And here's the output:
First run
$ make
mkdir -p i-iterate
mkdir -p i-iterate/docs
mkdir -p i-iterate/html-docs
emacs -Q -L ./lisp -batch -f batch-byte-compile ./lisp/*.el
Wrote /home/wvxvw/Projects/i-iterate/trunk/lisp/i-iterate.elc
cp -r lisp info Makefile README i-pkg.el i-iterate
Second run
$ make
mkdir -p i-iterate
mkdir -p i-iterate/docs
mkdir -p i-iterate/html-docs
echo "info builds: i-iterate/info/i-iterate.texi"
info builds: i-iterate/info/i-iterate.texi
makeinfo --force -o i-iterate/docs/i-iterate.info i-iterate/info/i-iterate.texi
texi2html --split section --use-nodes i-iterate/info/i-iterate.texi
emacs -Q -L ./lisp -batch -f batch-byte-compile ./lisp/*.el
Wrote /home/wvxvw/Projects/i-iterate/trunk/lisp/i-iterate.elc
cp -r lisp info Makefile README i-pkg.el i-iterate
Third run
$ make
mkdir -p i-iterate
mkdir -p i-iterate/docs
mkdir -p i-iterate/html-docs
echo "info builds: i-iterate/info/i-iterate.texi"
info builds: i-iterate/info/i-iterate.texi
makeinfo --force -o i-iterate/docs/i-iterate.info i-iterate/info/i-iterate.texi
texi2html --split section --use-nodes i-iterate/info/i-iterate.texi
html2wiki --dialect GoogleCode i-iterate/html-docs/i-iterate_9.html > ../wiki/i-iterate_9.wiki
# ... a bunch more of the documentation pages ...
/i-iterate_5.wiki
html2wiki --dialect GoogleCode i-iterate/html-docs/i-iterate_2.html > ../wiki/i-iterate_2.wiki
emacs -Q -L ./lisp -batch -f batch-byte-compile ./lisp/*.el
Wrote /home/wvxvw/Projects/i-iterate/trunk/lisp/i-iterate.elc
cp -r lisp info Makefile README i-pkg.el i-iterate
As you can see, the $(INFO) isn't even entered on the first run, even though the directory where it outputs the file was just deleted and created anew. The exact same thing happens later when it (doesn't) rebuild the $(WIKI).
EDIT:
Here's the directory structure, text following # signs is comments.
|- info
| +- documentation.texi
|- lisp
| +- source.el
| +- binary.elc # generated during compile
|- docs # should be deleted and created during the build
| +- documentation.info
|- html-docs # should be deleted and created during the build
| +- documentation.html
|- i-iterate # sources are copied here for distribution
| |- info
| | +- documentation.texi
| |- lisp
| | +- source.el
An update to the original Makefile, but the problem isn't solved
TEXI = $(wildcard $(DOCSRC)/*.texi)
INFO = $(addprefix $(DOCDST)/,$(notdir $(TEXI:.texi=.info)))
WIKIDST = ../wiki
$(DOCDST)/%.info: $(DOCSRC)/%.texi
#echo "info builds: $<"
$(IC) $(ICO) -o $# $<
$(TEXI2HTML) $(TEXI2HTMLO) $<
# This rule is not applied! :(
$(WIKIDST)/%.wiki: $(HTMLDOCDST)/%.html
#echo "Wiki: $<"
$(HTML2WIKI) $(HTML2WIKIO) $< > $#
default: prepare $(INFO) move-html rename-wiki byte-compile
cp -r lisp info Makefile README i-pkg.el ${PACKAGE}
prepare:
mkdir -p ${PACKAGE}
mkdir -p ${DOCDST}
mkdir -p ${HTMLDOCDST}
move-html:
$(shell [[ '0' -ne `find ./ -maxdepth 1 -name "*.html" | wc -l` ]] && \
mv -f *.html ${HTMLDOCDST}/)
$(eval HTML := $(wildcard $(HTMLDOCDST)/*.html))
$(eval WIKI := $(addprefix $(WIKIDST)/,$(notdir $(HTML:.html=.wiki))))
#echo "HTML: $(HTML)" # prints as expected
#echo "WIKI: $(WIKI)" # prints as expected
rename-wiki: $(WIKI) # this dependency never triggers
# the $(WIKIDST)/%.wiki rule
#echo "Renaming: `ls $(HTMLDOCDST)`" # the files are there
$(shell cd ${WIKIDST} && rename 'i-iterate' 'Iterate' *.wiki)
$(shell find ${WIKIDST} -name "*.wiki" -exec sed -i \
's/\[i-iterate/\[Iterate/g;s/\.html\#/\#/g;s/</\</g;s/>/\>/g' \
'{}' \;)
Trying to execute $(WIKI) in this way doesn't trigger the correspondent rule for some reason.
And if I change rename-wiki to look something like:
rename-wiki: ../wiki/file.wiki
I get "no rule to build the target. Even though $(WIKIDIST)/%.wiki is the rule to build the target.
EDIT2:
Finally, I could achieve what I want in doing it like so:
move-html:
$(shell [[ '0' -ne `find ./ -maxdepth 1 -name "*.html" | wc -l` ]] && \
mv -f *.html $(HTMLDOCDST)/)
$(foreach html, $(wildcard $(HTMLDOCDST)/*.html), \
$(HTML2WIKI) $(HTML2WIKIO) $(html) > \
$(addprefix $(WIKIDST)/, $(notdir $(html:.html=.wiki))))
Needless to mention how much I like the solution and the language that makes one devise one.
There are several problems here. This may take a few iterations.
First, when you make clean you delete i-iterate/ and everything in it, including i-iterate/info/whatever.texi. Since there are no texi files, Make deduces that no info files need be made; $(INFO) is an empty list.
I gather that by some black magic the emacs command creates an info/ directory full of texi files out of the ether, which Make then copies into i-iterate/ (in the default rule). Is that correct? If it is correct, then we should do this before the $(INFO) step. I suspect that the same is true of the $(WIKI) step, but let's not get ahead of ourselves.

How to get better error messages in a MAKE?

I run a make command on a CPP code. I get error messages like:
/home/itaymoav/dev/phpext/sitel/build/entities.cpp: In function ‘void googleset_free_storage(void*)’:
As can be seen, except showing me the entry point of the function with errors, it does not give me anymore data. Is there a flag or some other way to get proper error messages?
MakeFile -> I know it is big...
srcdir = /home/itaymoav/dev/phpext/build
builddir = /home/itaymoav/dev/phpext/build
top_srcdir = /home/itaymoav/dev/phpext/build
top_builddir = /home/itaymoav/dev/phpext/build
EGREP = /bin/grep -E
SED = /bin/sed
CONFIGURE_COMMAND = './configure' '--enable-entities'
CONFIGURE_OPTIONS = '--enable-entities'
SHLIB_SUFFIX_NAME = so
SHLIB_DL_SUFFIX_NAME = so
ZEND_EXT_TYPE = zend_extension
RE2C = exit 0;
AWK = gawk
ENTITIES_SHARED_LIBADD = -lstdc++
shared_objects_entities = entities.lo GoogleSet.lo
PHP_PECL_EXTENSION = entities
PHP_MODULES = $(phplibdir)/entities.la
PHP_ZEND_EX =
all_targets = $(PHP_MODULES) $(PHP_ZEND_EX)
install_targets = install-modules install-headers
prefix = /usr
exec_prefix = $(prefix)
libdir = ${exec_prefix}/lib
prefix = /usr
phplibdir = /home/itaymoav/dev/phpext/build/modules
phpincludedir = /usr/include/php5
CC = cc
CFLAGS = -g -O2
CFLAGS_CLEAN = $(CFLAGS)
CPP = cc -E
CPPFLAGS = -DHAVE_CONFIG_H
CXX = g++
CXXFLAGS = -g -O2
CXXFLAGS_CLEAN = $(CXXFLAGS)
EXTENSION_DIR = /usr/lib/php5/20090626+lfs
PHP_EXECUTABLE = /usr/bin/php
EXTRA_LDFLAGS =
EXTRA_LIBS =
INCLUDES = -I/usr/include/php5 -I/usr/include/php5/main -I/usr/include/php5/TSRM -I/usr/include/php5/Zend -I/usr/include/php5/ext -I/usr/include/php5/ext/date/lib -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
LFLAGS =
LDFLAGS =
SHARED_LIBTOOL =
LIBTOOL = $(SHELL) $(top_builddir)/libtool
SHELL = /bin/bash
INSTALL_HEADERS =
mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
INSTALL = $(top_srcdir)/build/shtool install -c
INSTALL_DATA = $(INSTALL) -m 644
DEFS = -DPHP_ATOM_INC -I$(top_builddir)/include -I$(top_builddir)/main -I$(top_srcdir)
COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORKPATH)
all: $(all_targets)
#echo
#echo "Build complete."
#echo "Don't forget to run 'make test'."
#echo
build-modules: $(PHP_MODULES) $(PHP_ZEND_EX)
libphp$(PHP_MAJOR_VERSION).la: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -rpath $(phptempdir) $(EXTRA_LDFLAGS) $(LDFLAGS) $(PHP_RPATHS) $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $#
-#$(LIBTOOL) --silent --mode=install cp $# $(phptempdir)/$# >/dev/null 2>&1
libs/libphp$(PHP_MAJOR_VERSION).bundle: $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
$(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $# && cp $# libs/libphp$(PHP_MAJOR_VERSION).so
install: $(all_targets) $(install_targets)
install-sapi: $(OVERALL_TARGET)
#echo "Installing PHP SAPI module: $(PHP_SAPI)"
-#$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
-#if test ! -r $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME); then \
for i in 0.0.0 0.0 0; do \
if test -r $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME).$$i; then \
$(LN_S) $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME).$$i $(phptempdir)/libphp$(PHP_MAJOR_VERSION).$(SHLIB_DL_SUFFIX_NAME); \
break; \
fi; \
done; \
fi
#$(INSTALL_IT)
install-modules: build-modules
#test -d modules && \
$(mkinstalldirs) $(INSTALL_ROOT)$(EXTENSION_DIR)
#echo "Installing shared extensions: $(INSTALL_ROOT)$(EXTENSION_DIR)/"
#rm -f modules/*.la >/dev/null 2>&1
#$(INSTALL) modules/* $(INSTALL_ROOT)$(EXTENSION_DIR)
install-headers:
-#if test "$(INSTALL_HEADERS)"; then \
for i in `echo $(INSTALL_HEADERS)`; do \
i=`$(top_srcdir)/build/shtool path -d $$i`; \
paths="$$paths $(INSTALL_ROOT)$(phpincludedir)/$$i"; \
done; \
$(mkinstalldirs) $$paths && \
echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \
for i in `echo $(INSTALL_HEADERS)`; do \
if test "$(PHP_PECL_EXTENSION)"; then \
src=`echo $$i | $(SED) -e "s#ext/$(PHP_PECL_EXTENSION)/##g"`; \
else \
src=$$i; \
fi; \
if test -f "$(top_srcdir)/$$src"; then \
$(INSTALL_DATA) $(top_srcdir)/$$src $(INSTALL_ROOT)$(phpincludedir)/$$i; \
elif test -f "$(top_builddir)/$$src"; then \
$(INSTALL_DATA) $(top_builddir)/$$src $(INSTALL_ROOT)$(phpincludedir)/$$i; \
else \
(cd $(top_srcdir)/$$src && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/$$i; \
cd $(top_builddir)/$$src && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/$$i) 2>/dev/null || true; \
fi \
done; \
fi
PHP_TEST_SETTINGS = -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1'
PHP_TEST_SHARED_EXTENSIONS = ` \
if test "x$(PHP_MODULES)" != "x"; then \
for i in $(PHP_MODULES)""; do \
. $$i; $(top_srcdir)/build/shtool echo -n -- " -d extension=$$dlname"; \
done; \
fi; \
if test "x$(PHP_ZEND_EX)" != "x"; then \
for i in $(PHP_ZEND_EX)""; do \
. $$i; $(top_srcdir)/build/shtool echo -n -- " -d $(ZEND_EXT_TYPE)=$(top_builddir)/modules/$$dlname"; \
done; \
fi`
PHP_DEPRECATED_DIRECTIVES_REGEX = '^(define_syslog_variables|register_(globals|long_arrays)?|safe_mode|magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?)[\t\ ]*='
test: all
-#if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
INI_FILE=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r 'echo php_ini_loaded_file();' 2> /dev/null`; \
if test "$$INI_FILE"; then \
$(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_FILE" > $(top_builddir)/tmp-php.ini; \
else \
echo > $(top_builddir)/tmp-php.ini; \
fi; \
INI_SCANNED_PATH=`$(PHP_EXECUTABLE) -d 'display_errors=stderr' -r '$$a = explode(",\n", trim(php_ini_scanned_files())); echo $$a[0];' 2> /dev/null`; \
if test "$$INI_SCANNED_PATH"; then \
INI_SCANNED_PATH=`$(top_srcdir)/build/shtool path -d $$INI_SCANNED_PATH`; \
$(EGREP) -h -v $(PHP_DEPRECATED_DIRECTIVES_REGEX) "$$INI_SCANNED_PATH"/*.ini >> $(top_builddir)/tmp-php.ini; \
fi; \
TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
$(PHP_EXECUTABLE) -n -c $(top_builddir)/tmp-php.ini $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -n -c $(top_builddir)/tmp-php.ini -d extension_dir=$(top_builddir)/modules/ $(PHP_TEST_SHARED_EXTENSIONS) $(TESTS); \
else \
echo "ERROR: Cannot run tests without CLI sapi."; \
fi
clean:
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(OVERALL_TARGET) modules/* libs/*
distclean: clean
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h stamp-h sapi/apache/libphp$(PHP_MAJOR_VERSION).module buildmk.stamp
$(EGREP) define'.*include/php' $(top_srcdir)/configure | $(SED) 's/.*>//'|xargs rm -f
.PHONY: all clean install distclean test
.NOEXPORT:
entities.lo: /home/itaymoav/dev/phpext/build/entities.cpp
$(LIBTOOL) --mode=compile $(CXX) -I. -I/home/itaymoav/dev/phpext/build $(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS) -c /home/itaymoav/dev/phpext/build/entities.cpp -o entities.lo
GoogleSet.lo: /home/itaymoav/dev/phpext/build/GoogleSet.cpp
$(LIBTOOL) --mode=compile $(CXX) -I. -I/home/itaymoav/dev/phpext/build $(COMMON_FLAGS) $(CXXFLAGS_CLEAN) $(EXTRA_CXXFLAGS) -c /home/itaymoav/dev/phpext/build/GoogleSet.cpp -o GoogleSet.lo
$(phplibdir)/entities.la: ./entities.la
$(LIBTOOL) --mode=install cp ./entities.la $(phplibdir)
./entities.la: $(shared_objects_entities) $(ENTITIES_SHARED_DEPENDENCIES)
$(LIBTOOL) --mode=link $(CC) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o $# -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $(shared_objects_entities) $(ENTITIES_SHARED_LIBADD)
You will have to examine your Makefile and any rules files it includes. Find the rule for compiling .cpp into .o and see what sort of filtering it is doing on your compile output. If it is intentionally restricting the output of the compiler to make normal compiles less verbose it will probably have a flag you can set to override that. The Linux kernel (and many related Makefiles) use a QUIET flag for this purpose, so you can do make QUIET='' to disable the terse output and see everything.
If the build rule is hiding errors there is probably a bug in it. If you can find it and add it to your question someone may know how to fix it.
The line you quoted is not the real error message. It is just the first of two lines. The following line contains the really interesting stuff.
And only in the rare case that there isn't a second line should you worry. Because then somebody wrapped the compiler to suppress some of its error messages.