what is wrong with my makefile code? - unix

I have a makefile that I needed to change around, and use it to install the program. I can;t figure out why I am getting this error:
v245-2% make install
install -m 555 audit /export/home/student/scort323/bin
sh: install: not found
*** Error code 1
make: Fatal error: Command failed for target `install'
Below is my code, can somebody please give me some advice. I am not good at makefiles so trying to find this error is hard for me until I get a better understanding:
# Make file for audit
# Location to install binary. Default is /usr/local/bin. You may
# prefer to install it in /usr/bin or /sbin
BINDIR = /export/home/student/scort323/bin
#BINDIR=/usr/bin
#BINDIR=/usr/sbin
# Location to install man page. Default is /usr/local/man. You may
# prefer to install it in /usr/man
MANDIR = /export/home/student/scort323/bin
#MANDIR = /usr/man
# Compiler to use
CC = gcc
# Linker to use
LD = gcc
# Preprocessor options
CPPFLAGS = -DGETOPTLONG
# Compile and link options
# On a.out systems you might want to add -N when linking
# RPM_OPT_FLAGS can be set by rpm tool
# ...For production code
CFLAGS = -Wall -O3 $(RPM_OPT_FLAGS)
LDFLAGS = -s
# ...For debug
#CFLAGS = -Wall -g
#LDFLAGS = -g
audit: audit.o
$(LD) $(LDFLAGS) -o audit audit.o
audit.o: audit.c
$(CC) $(CPPFLAGS) $(CFLAGS) -c audit.c
install: audit
install -m 555 audit $(BINDIR)
#/audit
install -m 444 audit.1 $(MANDIR)
#/man1/audit.1
clean:
$(RM) audit audit.o core *~ results
# check in
ci: clean
-ci -l *
dist: clean
cd .. ; tar --exclude RCS -czvf audit-0.2.tar.gz audit-0.2

There is no problem with the makefile. Check if you have install utility
$~ install --help
If you dont have then you can get it from GNU coreutils. If you have install somewhere then export its path in PATH variable
export PATH=$PATH:/path/to/install-utilit

Related

what is the replacement for REGEXP_REPLACE(XXXXXX,' ', '') ; in sqlite? [duplicate]

I installed REGEX support with
apt-get install sqlite3 sqlite3-pcre
now I can use REGEX in my queries on the bash console like
DB="somedb.db"
REGEX_EXTENSION="SELECT load_extension('/usr/lib/sqlite3/pcre.so');"
sqlite3 $DB "$REGEX_EXTENSION select * from sometable where name REGEXP '^[a-z]+$'"
But how can I update a string with an sqlite query using regex?
Sqlite by default does not provide regex_replace function. You need to load it as an extension. Here is how i managed to do it.
Download this C code for the extension (icu_replace)
Compile it using
gcc --shared -fPIC -I sqlite-autoconf-3071100 icu_replace.c -o icu_replace.so
And in sqlite3 runn following command post above mentioned command has run and create a file icu_replace.so
SELECT load_extension(' path to icu_replace.so', 'sqlite3_extension_init') from dual;
After this you will be able to use such a function as :-
select regex_replace('\bThe\b',x,'M') from dual;
The following builds latest sqlite with dynamic library support, and compiles ICU extension and regex_replace extension. It also assumes debian-based linux distributive:
sudo apt build-dep sqlite3 # fetches dependencies to compile sqlite3
mkdir sqlite-compilation
cd sqlite-compilation
wget -O sqlite.tar.gz https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=release
tar xzf sqlite.tar.gz
mkdir build
cd build
../sqlite/configure
make OPTS='-DSQLITE_ENABLE_LOAD_EXTENSION'
./sqlite3 -cmd 'pragma compile_options;' <<< .exit
cd -
# https://sqlite.org/src/dir?name=ext/icu
cd sqlite/ext/icu
sed -i 's/int sqlite3_icu_init(/int sqlite3_extension_init(/' icu.c
sed -i 's/int sqlite3IcuInit(/int sqlite3_extension_init(/' sqliteicu.h
gcc -g -O2 -shared icu.c -fPIC -I ../../../build `pkg-config --libs icu-i18n` -o libSqlite3Icu.so
cp libSqlite3Icu.so ../../../build/
cd -
# https://github.com/gwenn/sqlite-regex-replace-ext
cd sqlite/ext
wget -O sqlite-regex-replace-ext-master.zip https://github.com/gwenn/sqlite-regex-replace-ext/archive/master.zip
unzip sqlite-regex-replace-ext-master.zip
cd sqlite-regex-replace-ext-master
gcc -g -O2 -shared icu_replace.c -fPIC -I ../../../build -o libSqlite3IcuReplace.so
cp libSqlite3IcuReplace.so ../../../build/
cd -
cd ../../
In result you will have:
build/sqlite3 # sqlite3 binary
build/libSqlite3Icu.so # unicode support
build/libSqlite3IcuReplace # regex_replace function
Test:
cd build
sqlite3 <<< "
.load ./libSqlite3Icu
.load ./libSqlite3IcuReplace
select regex_replace('^a', 'aab', 'b');
.exit
" # should output: bab
cd -
For me the above answers didn't work because of some missing parameters in the gcc command.
This works for me:
git clone https://github.com/gwenn/sqlite-regex-replace-ext.git
cd sqlite-regex-replace-ext-master/
./icu_replace.sh
Now you should be able to load the extension using: SELECT LOAD_EXTENSION('path-to-icu_replace.so');

How to make gnatmake tool compile RTS with project?

Is there a way to make gnatmake tool recompile the Ada's runtime library ("RTS") with the project I'm building file by file? I want to integrate my custom preprocessor that adds some features to ada source code and then compiles it with gcc. I'm passing --GCC=<preprocessor> flag to the gnatmake utility, it figures out dependencies automatically and runs my preprocessor for all of my source files. However I want custom preprocessing to be done on code in the RTS as well, is there any way to do it?
The -a flag tells gnatmake to recompile any RTS files that need to be recompiled.
After a little experiment here it seems that if you copy system.ads (and maybe gnat.ads, interfac.ads .. yes) from the compiler’s adainclude/ directory to your source tree (I think you’ll need to touch it whenever you update your preprocessor), gnatmake may be able do what you want.
$ cp /opt/gcc-4.9.0/lib/gcc/x86_64-apple-darwin13/4.9.0/adainclude/system.ads .
$ gnatmake -a int
gcc -c int.adb
gcc -gnatpg -c -I./ -I- /opt/gcc-4.9.0/lib/gcc/x86_64-apple-darwin13/4.9.0/adainclude/s-stalib.adb
gcc -gnatpg -c -I./ -I- /opt/gcc-4.9.0/lib/gcc/x86_64-apple-darwin13/4.9.0/adainclude/a-except.adb
gcc -gnatpg -c -I./ -I- /opt/gcc-4.9.0/lib/gcc/x86_64-apple-darwin13/4.9.0/adainclude/s-valint.adb
gcc -gnatpg -c system.ads
...
gcc -gnatpg -c -I./ -I- /opt/gcc-4.9.0/lib/gcc/x86_64-apple-darwin13/4.9.0/adainclude/s-conca4.adb
gnatbind -x int.ali
gnatlink int.ali
and, after I realised I hadn’t used -gnata,
$ touch int.adb
$ gnatmake -a -gnata int
gcc -c -gnata int.adb
gcc -gnatpg -c -I./ -gnata -I- /opt/gcc-4.9.0/lib/gcc/x86_64-apple-darwin13/4.9.0/adainclude/s-assert.adb
gnatbind -x int.ali
gnatlink int.ali
(I do not want to use -f here, because it’ll rebuild everything.)

Cross-compiling Qt for Pandaboard

I spend weeks trying to cross compile Qt for my Panda board and no way, I can't pass the ./configure. If someone could give me a help I'll appreciate.
My host system is Ubuntu-13.04 ×86_64bit(running un Virtualbox)
My target system is Pandaboard ES Ubuntu-12.04.
All the steps in host box:
sudo apt-get install arm-linux-gnueabihf
sudo mkdir /opt/qt-485-armhf
cd /usr/src
sudo wget http://download.qt-project.org/official_releases/qt/4.8/4.8.5/qt-everywhere-opensource-src-4.8.5.tar.gz
sudo tar xf qt-everywhere-opensource-src-4.8.5.tar.gz
cd /usr/src/qt-everywhere-opensource-src-4.8.5
sudo cp -r mkspecs/qws/linux-arm-gnueabi-g++ mkspecs/qws/linux-arm-gnueabihf-g++
sudo vim mkspecs/qws/linux-arm-gnueabihf-g++/qmake.conf
-------------------------------
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)
#Compiler Flags to take advantage of the ARM architecture
#N.B.:I also tried to uncomment the two following instructions with no success
QMAKE_CFLAGS = -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard
QMAKE_CXXFLAGS = -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard
# modifications to g++.conf
QMAKE_CC = arm-linux-gnueabihf-gcc
QMAKE_CXX = arm-linux-gnueabihf-g++
QMAKE_LINK = arm-linux-gnueabihf-g++
QMAKE_LINK_SHLIB = arm-linux-gnueabihf-g++
# modifications to linux.conf
QMAKE_AR = arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY = arm-linux-gnueabihf-objcopy
QMAKE_STRIP = arm-linux-gnueabihf-strip
load(qt_config)
---------------------------------
sudo sed -i -e "/#if/d" -e "/#error/d" -e "/#endif/d" config.tests/unix/libmng/libmng.cpp (This command fixes detection of libmng 2.0.)
export QTDIR=/opt/qt4-485-armhf
And finally:
sudo ./configure -prefix /opt/qt4-485-armhf -sysconfdir /etc/xdg -embedded arm -little-endian -host-big-endian -no-qt3support -nomake examples -nomake demos -opensource -confirm-license -release -openssl-linked -no-phonon -no-phonon-backend -no-nis -platform qws/linux-x86_64-g++ -xplatform qws/linux-arm-gnueabihf-g++ -optimized-qmake
With this result:
Creating qmake. Please wait...
g++ -c -o option.o -pipe -m64 -DQMAKE_OPENSOURCE_EDITION -O2 -g -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian -Igenerators/integrity -I/usr/src/qt-everywhere-opensource-src-4.8.5/include -I/usr/src/qt-everywhere-opensource-src-4.8.5/include/QtCore -I/usr/src/qt-everywhere-opensource-src-4.8.5/src/corelib/global -I/usr/src/qt-everywhere-opensource-src-4.8.5/src/corelib/xml -I/usr/src/qt-everywhere-opensource-src-4.8.5/tools/shared -DQT_NO_PCRE -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DQLIBRARYINFO_EPOCROOT -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL -DQT_NO_COMPRESS -I/usr/src/qt-everywhere-opensource-src-4.8.5/mkspecs/qws/linux-x86_64-g++ -DHAVE_QCONFIG_CPP -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DEPRECATED option.cpp
g++ -o "/usr/src/qt-everywhere-opensource-src-4.8.5/bin/qmake" project.o property.o main.o makefile.o unixmake2.o unixmake.o mingw_make.o option.o winmakefile.o projectgenerator.o meta.o makefiledeps.o metamakefile.o xmloutput.o pbuilder_pbx.o borland_bmake.o msvc_vcproj.o msvc_vcxproj.o msvc_nmake.o msvc_objectmodel.o msbuild_objectmodel.o symmake.o initprojectdeploy_symbian.o symmake_abld.o symmake_sbsv2.o symbiancommon.o registry.o epocroot.o gbuild.o qtextcodec.o qutfcodec.o qstring.o qtextstream.o qiodevice.o qmalloc.o qglobal.o qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlist.o qfile.o qfilesystementry.o qfilesystemengine_unix.o qfilesystemengine.o qfilesystemiterator_unix.o qfsfileengine_unix.o qfsfileengine.o qfsfileengine_iterator.o qregexp.o qvector.o qbitarray.o qdir.o qdiriterator.o quuid.o qhash.o qfileinfo.o qdatetime.o qstringlist.o qabstractfileengine.o qtemporaryfile.o qmap.o qmetatype.o qsettings.o qsystemerror.o qlibraryinfo.o qvariant.o qvsnprintf.o qlocale.o qlocale_tools.o qlocale_unix.o qlinkedlist.o qnumeric.o qcryptographichash.o qxmlstream.o qxmlutils.o
You have not explicitly asked to use pkg-config and are cross-compiling.
pkg-config will not be used to automatically query cflag/lib parameters for
dependencies
The system floating point format could not be detected.
This may cause data to be generated in a wrong format
Turn on verbose messaging (-v) to see the final report.
OpenSSL support cannot be enabled due to functionality tests!
Turn on verbose messaging (-v) to ./configure to see the final report.
If you believe this message is in error you may use the continue
switch (-continue) to ./configure to continue.
Thanks in advance.
To cross-compile a program on a PC you must have the development files for the same packages installed on the PC as the ARM target. Qt 4.8 depends on OpenSSL, so you must get the correct development files for the ARM release if you wish to compile Qt.
Install a Ubuntu 12.04 PC virtual box. SAME VERSION as the board.
Get the compiler. apt-get install arm-linux-gnueabihf (You knew that).
Get required development packages. apt-get install libssl-dev or apt-get build-dep -aarmhf qt4 (which only works for X11).
Edit your Qt configuration to suit your needs and build it.
The current step you are missing is step 3; but to perform it you need step 1 or some other way to get the OpenSSL development files for Ubuntu 12.04. There is probably some other way to do this using apt.sources. I think the steps above will be easiest for you.
Here is an alternative approach. As you are going to use Qt, you don't necessarily need Ubuntu. Simple rootfs with Qt Embedded could be sufficient.
I'll describe, how you can create rootfs and your application using Buildroot(BR). BR already has a config file for Pandaboard. All you need to is to download BR and execute:
make pandaboard_defconfig
After that you can choose between Qt4 and Qt5 in the menuconfig.
For your application I'd suggest using CMake infrastructure, but it is a matter of taste. This article is about source directory override mechanism in BR.
try to get the version off gcc in your Pandaboard Ubuntu OS and if is the same arm-linux-gnueabihf-gcc version or less like 4.6 hint the config in your qmake.config
#QMAKE_CFLAGS = -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard
#QMAKE_CXXFLAGS = -march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard

Troubles compiling in GPS (Ada IDE) with glib.h

i'm having some troubles when trying to compile Ada code in GPS. GPS says is missing when I include it on a package. I tried installing with apt-get, and it does, but the error is still there. What can I do next? I'm running GPS on a x64 Ubuntu 12.04.
Here's the error message I got:
gprbuild -d -P/media/LUISMUNYOZ/QUINTO/str/pendulum/pendulum_portatil/pendulum.gpr
-XEXTRA=True -XOPENGL=True -XGNOME=True -XBUILD=Production
print_barrier_sync.adb contrib.gpr:1:09: warning: no compiler specified for language "Xml",
ignoring all its sources x86_64-pc-linux-gnu-gcc -c lw.c In file included from
/media/LUISMUNYOZ/QUINTO/str/pendulum/pendulum_portatil/gtkada/testgtk/opengl/lw.c:20:0:
/media/LUISMUNYOZ/QUINTO/str/pendulum/pendulum_portatil/gtkada/testgtk/opengl/lw.h:23:18:
fatal error: glib.h: No such file or directory compilation terminated.
gprbuild:* compilation phase failed
[2012-11-21 13:24:47] process exited with status 4 (elapsed time: 02.06s) [2012-11-21 13:24:56]
Could not locate executable on path: svn SVN error:
[…]
The error triggers at this point:
#ifndef LW_H
#define LW_H
#include <glib.h> <------------------------------------------
#include <GL/gl.h>
#define LW_MAX_POINTS 200
#define LW_MAX_NAME_LEN 500
The file is lw.h, which is defined in the package GtkAda. I downloaded it from GPS page.
I'd pursue #Simon's approach, but a work-around based on 2.4.2. Using the command line might be a temporary alternative while you sort out the underlying problem.
As you are using linux, here's a Makefile for the basic Interaction demo.
# Make shared, static or debug targets.
OS := $(shell uname)
OBJ = obj
TARGET = interaction
GNATMAKE = gnatmake -D $(OBJ)
CARGS = -cargs -O3 -gnatp -gnatwu -gnatf
BARGS = -bargs
LARGS = -largs
.PHONEY: clean cleaner cleanest
all:
#echo ""
#echo "Build targets:"
#echo ""
#echo " shared Use the shared Ada libraries."
#echo " static Link the Ada libraries statically."
#echo " debug Enable debugging."
#echo ""
#echo "Support targets:"
#echo ""
#echo " clean Remove *.ali *.o b~.*"
#echo " cleaner Remove target, too."
#echo " cleanest Remove build directory, too."
#echo ""
shared: $(OBJ)
shared: INCLUDE = $(shell gtkada-config --cflags)
shared: BARGS += -shared
shared: LARGS += $(shell gtkada-config --libs)
shared: LARGS += -dead_strip
shared: *.ad[sb]
#echo "building with shared libraries:"
$(GNATMAKE) $(TARGET) $(INCLUDE) $(CARGS) $(BARGS) $(LARGS)
static: $(OBJ)
static: INCLUDE = $(shell gtkada-config --static --cflags)
static: BARGS += -static
static: LARGS += $(shell gtkada-config --static --libs)
static: LARGS += -dead_strip
static: *.ad[sb]
$(GNATMAKE) $(TARGET) $(INCLUDE) $(CARGS) $(BARGS) $(LARGS)
debug: $(OBJ)
debug: INCLUDE = $(shell gtkada-config --static --cflags)
debug: BARGS += -static
debug: LARGS += $(shell gtkada-config --static --libs)
debug: *.ad[sb]
$(GNATMAKE) -g $(TARGET) $(INCLUDE) $(LARGS)
$(OBJ):
mkdir $(OBJ)
clean:
${RM} $(OBJ)/* b~*
cleaner: clean
${RM} $(TARGET)
cleanest: cleaner
${RM} -r $(OBJ)
For reference, these packages were installed on Ubuntu 12.04:
$ dpkg --get-selections | egrep "gnat|gtkada"
gnat install
gnat-4.6 install
gnat-4.6-base install
gnat-gps install
gnat-gps-common install
gnat-gps-doc install
libgnat-4.6 install
libgnatprj4.6 install
libgnatvsn4.6 install
libgtkada-bin install
libgtkada2.24.1 install
libgtkada2.24.1-dev install
I've never used GtkAda. However ... I googled glib.h and got many hits, suggesting that for plain C builds one should use - for example, from this StackOverflow question -
# Sample Makefile
CFLAGS := $(shell pkg-config --cflags glib-2.0 gtk+-2.0)
LDFLAGS := $(shell pkg-config --libs glib-2.0 gtk+-2.0)
foo: foo.c
$(CC) $(CFLAGS) $< -o $# $(LDFLAGS)
However, we're talking gprbuild here, so perhaps the GtkAda documentation is relevant? It says you need to include with "gtkada"; in your GNAT Project file, and include the location of gtkada.gpr on your ADA_PROJECT_PATH if it isn't there already (see the output of gnatls -v).
If you've already done that, please show us the GPR file.

Problem compiling nginx on Solaris 10

My setup as below
# export PATH=/usr/sbin:/usr/bin:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin
# ./configure --prefix=/usr/local/nginx --user=webservd --group=webservd --with-http_stub_status_module --with-openssl=/usr/local/ssl/bin/openssl --with-debug --with-pcre=/usr/local/bin
and i get error code as such when i execute make
# make
make -f objs/Makefile
make[1]: Entering directory `/export/home/myhome/nginx-0.7.63'
cd /usr/local/bin \
&& if [ -f Makefile ]; then make distclean; fi \
&& CC="gcc" CFLAGS="-O2 -fomit-frame-pointer -pipe " \
./configure --disable-shared
/bin/sh: ./configure: not found
make[1]: *** [/usr/local/bin/Makefile] Error 1
make[1]: Leaving directory `/export/home/myhome/nginx-0.7.63'
make: *** [build] Error 2
any idea how to fix it?
That initial cd to /usr/local/bin looks very strange; are you building it in the global /usr tree?
It looks as if it's cd:ing to the wrong directory, for some reason. Look in the referenced Makefile (objs/Makefile) and try to figure out why.
UPDATE: It seems the problem is that it's trying to build the PCRE library. If you have it pre-built, that seems like an odd decision. This blog post suggests using the --with-cc-opt="-I /usr/include/pcre" option to point out to the configure script where you have headers for PCRE, might be worth trying.

Resources