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.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 10 months ago.
Improve this question
I'm trying to create a Dockerfile that read some URLs from an online file but when I try to use wget with the URL in a variable, it fails. If I print the variables in a console message the result is the corrects URLs.
If the variables are declared with ENV or initialized with the URL I don't have problems to use it in the wget; the problem only happens when reading URLs from a file.
FROM openjdk:8
USER root
RUN mkdir /opt/tools /aplicaciones /deployments \
&& wget -q "www.url_online_file.com" -O url.txt \
&& while IFS== read -r name url; do if [ $name = "url1" ]; then export URL1=$url; fi; if [ $name = "url2" ]; then export URL2=$url; fi; done < url.txt \
&& echo "DEBUG URL1=$URL1"; echo "DEBUG URL2=$URL2"; \
&& wget -q $URL1 -O url1.zip
Error:
DEBUG URL1=www.prueba1.com
DEBUG URL2=www.prueba2.com
The command '/bin/sh -c mkdir /opt/tools /aplicaciones /deployments && wget -q "www.url_online_file.com" -O url.txt && while IFS== read -r name url; do if [ $name = "url1" ]; then export URL1=$url; fi; if [ $name = "url2" ]; then export URL2=$url; fi; done < url.txt && echo "DEBUG URL1=$URL1"; echo "DEBUG URL2=$URL2"; && wget -q $URL1 -O url1.zip' returned a non-zero code: 8
The file.txt structure in online_file is:
url1=www.prueba1.com
url2=www.prueba2.com
The solution was used the command wget -i to the www.url_online_file.com and modified the content of the file to:
www.prueba1.com
www.prueba2.com
The dockerfile:
FROM openjdk:8
USER root
RUN mkdir /opt/tools /aplicaciones /deployments \
&& wget -i "www.url_online_file.com" \
&& && rm url* \
&& mv url1* url1.zip \
&& mv url2* url2.zip \
&& unzip url1.zip -d /opt/tools \
&& unzip url2.zip -d /opt/tools \
&& rm url1.zip \
&& rm url2.zip
I recently inherited a build server that was running fine until last week and now I'm getting some "file not found" errors. I am using "rpmbuilder" as my non-root user. When I run my build command I get the following errors:
$ rpmbuild -bb -v rpmbuild/SPECS/mist.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.fUrkkG
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.edkQrN
Processing files: mist-2.0.2-1.x86_64
error: File not found: /home/rpmbuilder/rpmbuild/BUILDROOT/mist-2.0.2-1.x86_64/opt/mist
error: File not found: /home/rpmbuilder/rpmbuild/BUILDROOT/mist-2.0.2-1.x86_64/opt/mist/database/config.pyc
error: File not found: /home/rpmbuilder/rpmbuild/BUILDROOT/mist-2.0.2-1.x86_64/opt/mist/database/mist_db.sql
error: File not found: /home/rpmbuilder/rpmbuild/BUILDROOT/mist-2.0.2-1.x86_64/opt/mist/database/.password_complexity.conf
RPM build errors:
File not found: /home/rpmbuilder/rpmbuild/BUILDROOT/mist-2.0.2-1.x86_64/opt/mist
File not found: /home/rpmbuilder/rpmbuild/BUILDROOT/mist-2.0.2-1.x86_64/opt/mist/database/config.pyc
File not found: /home/rpmbuilder/rpmbuild/BUILDROOT/mist-2.0.2-1.x86_64/opt/mist/database/mist_db.sql
File not found: /home/rpmbuilder/rpmbuild/BUILDROOT/mist-2.0.2-1.x86_64/opt/mist/database/.password_complexity.conf
I used to get a ton of output under %prep but now there's nothing. I tried using %setup without -q and still get the same output.
As far as I can tell my source files are still where they should be:
[rpmbuilder#coams-db SOURCES]$ pwd
/home/rpmbuilder/rpmbuild/SOURCES
[rpmbuilder#coams-db SOURCES]$ ls -la
total 66124
drwxr-xr-x. 3 rpmbuilder rpmbuilder 4096 Jun 23 10:08 .
drwxr-xr-x. 8 rpmbuilder rpmbuilder 4096 Feb 25 2016 ..
drwxrwxr-x. 8 rpmbuilder rpmbuilder 4096 Jun 23 10:08 mist-2.0.2
-rw-rw-r--. 1 rpmbuilder rpmbuilder 67681925 Jun 23 10:09 mist-2.0.2.tar.gz
Has anyone seen this issue before? Are there some nitpicky things I didn't know to check? Like I said I don't recall changing anything but who knows...
My spec file is below:
Name: mist
Version: 2.0.2
Release: 1
Summary: <snip>
Group: <snip>
License: GPL
URL: http://<snip>
Source0: mist-2.0.2.tar.gz
BuildArch: x86_64
BuildRoot: /home/rpmbuilder/rpmbuild/%{name}-%{version}
Requires(pre): shadow-utils
Requires: python, mysql-server, python-sqlalchemy, MySQL-python, python-requests, python-lxml, pytz, python-jsonschema
%description
Installs the MIST application.
%pre
if [ $1 = 1 ]; then
getent group mist > /dev/null || groupadd -r mist
getent passwd mist > /dev/null || useradd -r -g mist -d /opt/mist -c "MIST Console User" mist -p '<snip>'
# echo "Starting Cron Setup........."
#echo "Create temp file to hold cron currnet data"
#%define tempFile `mktemp`
#store temp file name
#TEMP_FILE_NAME=%{tempFile}
#echo "Storing crontab current data in temp file %{tempFile}"
#CRON_OUT_FILE=`crontab -l > $TEMP_FILE_NAME`
#echo "Add required cron detalis in cron temp file"
#ADD_TO_CRON=`echo "#Schedule the following cron job to <snip>:" >> $TEMP_FILE_NAME`
#Replace the http://servername.com/file.php with file path or link
#ADD_TO_CRON=`echo "*/30 * * * * python /opt/mist/assets/pull_assets.py > /dev/null 2>&1" >> $TEMP_FILE_NAME`
#echo "Storing temp cron to the crontab"
#ADD_TEMP_TO_CRON=`crontab $TEMP_FILE_NAME`
#echo "Remove %{tempFile} temp file"
#rm -r -f $TEMP_FILE_NAME
#get current crontab list for email
#%define cornDataNow `crontab -l`
#exit 0
fi
if [ $1 = 2 ]; then
/sbin/service mist stop
#cp -r /opt/mist/frontend/server/conf /opt
#rm -rf /opt/mist/frontend/server/work
fi
%preun
if [ $1 = 0 ]; then
/sbin/service mist stop
fi
%prep
%setup -q
%install
# rm -rf "$RPM_BUILD_ROOT"
echo $RPM_BUILD_ROOT
mkdir -p "$RPM_BUILD_ROOT/opt/mist"
cp -R . "$RPM_BUILD_ROOT/opt/mist"
mkdir -p "$RPM_BUILD_ROOT/var/log/MIST"
exit 0
%files
%attr(750,mist,mist) /opt/mist
%attr(400,mist,mist) /opt/mist/database/config.pyc
%attr(640,mist,mist) /opt/mist/database/mist_db.sql
%attr(640,mist,mist) /opt/mist/database/.password_complexity.conf
#/opt/mist
%doc
%post
if [ $1 = 1 ]; then
mv /opt/mist/mist_base/mist /etc/init.d
chmod 755 /etc/init.d/mist
chkconfig mist on --level 345
mv /opt/mist/database/my.cnf /etc
/usr/sbin/usermod -a -G mist mysql
/usr/sbin/setsebool allow_user_mysql_connect 1
/bin/mkdir -p /var/log/MIST/frontend
chown -R root.mist /var/log/MIST
chmod -R 775 /var/log/MIST
fi
if [ $1 = 2 ]; then
#cp -r /opt/conf /opt/mist/frontend/server
#rm -r /opt/conf
#rm /opt/mist/frontend/mist
if [ -d /opt/mist/frontend ]; then
rm -rf /opt/mist/frontend
fi
mv /opt/mist/mist_base/mist /etc/init.d
rm /opt/mist/database/my.cnf
/sbin/service mist start
fi
mv /opt/mist/mist_logging.py /usr/lib/python2.6/site-packages
chmod 644 /usr/lib/python2.6/site-packages/mist_logging.py
%postun
if [ $1 = 0 ]; then
/bin/rm -r /opt/mist
chkconfig --del mist
/bin/rm /etc/init.d/mist
/bin/rm /etc/my.cnf
/bin/rm /usr/lib/python2.6/site-packages/mist_logging.py
/bin/rm -r /var/log/MIST
/usr/sbin/userdel --force mist 2> /dev/null; true
/usr/sbin/groupdel mist
/sbin/service mysqld stop
/bin/rm -r /var/lib/mysql
/bin/sed -i '/mistDB/d' /etc/hosts
#/usr/bin/crontab -l | grep -v "#Schedule the following cron job to <snip>:" | /usr/bin/crontab -
#/usr/bin/crontab -l | grep -v "python /opt/mist/assets/pull_assets.py" | /usr/bin/crontab -
fi
%changelog
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.
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.
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.