rules for programname.c not found - autoconf

I am trying to run automake and autoconf in my project. However when I run make, I get an error "no rules to make inz.c required by inz.o". However I don't have inz.c in my project. I guess it might by an error in configuration, but it is my first time using autoconf/automake, so I'd like to kindly ask for assistance. I am running under Linux
The sturcture is as following:
inz (main folder)
-configure.ac
-inz.cbp
-inz.depend
-inz.layout
-Makefile.am
--src\main.cpp
--src\main.hpp
--src\packetcapture.cpp
--src\packetcapture.hpp
--src\packetprocess.cpp
--src\packetprocess.hpp
--src\Makefile.am
configure.ac:
AC_INIT([inz], 1.0)
AC_CONFIG_AUX_DIR([build])
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT
Makefile.am:
SUBDIRS = src
dist_doc_DATA = README.md
src\Makefile.am:
bin_PROGRAMS = inz
inz_sources = main.cpp packetcapture.cpp packetprocess.cpp
include_HEADERS = main.hpp packetcapture.hpp packetprocess.hpp
commands to compile the project itself: (it also uses -lndpi -lpthread and -lpcap)
g++ -Wall -std=c++0x -Wunused -g -Wno-deprecated-declarations -Iinclude -I./ -c /inz/src/main.cpp -o obj/Debug/src/main.o
g++ -Wall -std=c++0x -Wunused -g -Wno-deprecated-declarations -Iinclude -I./ -c /inz/src/packetcapture.cpp -o obj/Debug/src/packetcapture.o
commands I run to confiugre automake/autoconf (from the main folder):
autoreconf --install
cd build
../configure
make

You need to be careful with variable names because they are case sensitive.
You're declaring inz_sources, but that's not a special variable for automake. inz_SOURCES would be.
Without a special _SOURCES variable, automake will go on to assume that inz is built from inz.c. But you don't have that file so it fails.

Related

Qt error: c: command not found / qmake could not locate g++ compiler

I have 2 versions of SDK for Qt Creator: Compiled from Open Source and Compiled from bitbake.
The Open Source SDK is working fine, but the bitbake one is having trouble recognizing the compiler. I have added the g++ compiler to build & Run and source environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabias well.
make: c: Command not found make: [moc_utils.o] Error 127 (ignored)
make:
Wl,-rpath-link,/opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/lib:
Command not found make: [quicknanobrowser] Error 127 (ignored)
Here is the error one Compiler Log:
14:27:55: Running steps for project quicknanobrowser...
14:27:55:
Starting:
"/opt/poky/charles/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake"
/home/hbulab/Qt5.5.1/Examples/Qt-5.5/webengine/quicknanobrowser/quicknanobrowser.pro
-r -spec linux-oe-g++ CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug
14:27:55: The process
"/opt/poky/charles/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake"
exited normally.
14:27:55: Starting: "/usr/bin/make"
c -pipe -g
-DLINUX=1 -DEGL_API_FB=1 -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WEBENGINE_LIB -DQT_QUICK_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I.
and here is the one without error, we could see that the make could not find the g++ compiler. How do I fix it?
14:29:08: Running steps for project quicknanobrowser... 14:29:08:
Starting: "/opt/hio-imx6dl-board/opt/Qt5daisy/bin/qmake"
/home/hbulab/Qt5.5.1/Examples/Qt-5.5/webengine/quicknanobrowser/quicknanobrowser.pro
-r -spec devices/linux-imx6-g++ CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug
14:29:09: The process
"/opt/hio-imx6dl-board/opt/Qt5daisy/bin/qmake" exited normally.
14:29:09: Starting: "/usr/bin/make"
/opt/poky/1.6.1/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++
-c -pipe -march=armv7-a -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard -g -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WEBENGINE_LIB -DQT_QUICK_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I.
MakeFile Information:
MAKEFILE = Makefile
####### Compiler, tools and options
CC = $(OE_QMAKE_CC)
CXX = $(OE_QMAKE_CXX)
DEFINES = -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WEBENGINE_LIB -DQT_QUICK_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB
CFLAGS = -pipe $(OE_QMAKE_CFLAGS) -g -DLINUX=1 -DEGL_API_FB=1 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
CXXFLAGS = -pipe $(OE_QMAKE_CXXFLAGS) -g -DLINUX=1 -DEGL_API_FB=1 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
INCPATH = -I../../../Qt5.5.1/Examples/Qt-5.5/webengine/quicknanobrowser -I. -isystem /opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5 -isystem /opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWebEngine -isystem /opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtQuick -isystem /opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWidgets -isystem /opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtGui -isystem /opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtQml -isystem /opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtNetwork -isystem /opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtCore -I. -I/opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/linux-oe-g++
QMAKE = /opt/poky/charles/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake
As ${OE_QMAKE_CXX} is empty, that indicates to me that you haven't source environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabiasenvironment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi.
This should work to compile by hand:
. /opt/poky/charles/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
echo $OE_QMAKE_CXX
qmake
make
(Assuming you don't need to pass any extra arguments to qmake).
Then do the following:
. /opt/poky/charles/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
echo $OE_QMAKE_CXX
qtcreator
Note that you should start qtcreator from the same shell that you source environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi in.
This should get you going. Otherwise I'd suggest starting by getting a small, simple Qt appliction building correctly.
For more in configuring QtCreator, you could for instance have a look at how to setup QtCreator for cross-compilation.
Update
As it seems that Qt5 isn't included in the SDK at all, we first have to generate a suitable SDK. My preferred way:
bitbake your-image -c populate_sdk
This works, as long as your image recipe includes
inherit populate_sdk_qt5
That would give you an SDK, whose sysroot would match your image.
The "older" way, is to use a special toolchain recipe. For Qt5 that would be meta-toolchain-qt5, or some recipe that includes/requires that one. In this case, you would run:
bitbake meta-toolchain-qt5
Though, the recommended way is to use the image specific SDK.

Cross Compile ncurses application for ARM linux

I want to cross compile an application from my workstation (x86, linux) for an ARM application processor. First I build for my system:
gcc -static -g -Wall -c main.c -o main.o
gcc -g -Wall main.o -o myApplication -lncurses
this build like I want and also work. If I want to build this for arm
arm-linux-gnueabi-gcc -static -g -Wall -c main.c -o main.o
arm-linux-gnueabi-gcc -g -Wall main.o -o myApplication -lncurses
But this will not compile.
/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/bin/ld: cannot find -lncurses
collect2: Error
So: how to cross-compile a ncurses Application in this way?
One easy way to do it would be to download a binary release of ELLCC. It comes with a pre-built libraries, including ncurses. The download page is here. If you grab e.g. http://ellcc.org/releases/ellcc-x86_64-linux-eng-0.1.27.tgz (The version number will change over time), you can untar it. For the ARM, your build lines would look like:
~/ellcc/bin/ecc -target arm-linux-engeabihf -g -Wall -c main.c -o main.o
~/ellcc/bin/ecc -target arm-linux-engeabihf -g -Wall main.o -o myApplication -lncurses
It creates a static binary, so you don't have to worry about shared library versions.

Linux using lapack library

I have an error making a code project because of what I believe is a missing routine from lapack:
HomographyInit.cc:(.text+0x385): undefined reference to `dgesvd_'
I think I need to add lapack library somehow to my Makefile. Here is part of my Makefile:
CC = g++
COMPILEFLAGS = -I MY_CUSTOM_INCLUDE_PATH -D_LINUX -D_REENTRANT -Wall -O3 -march=nocona -msse3
LINKFLAGS = -L MY_CUSTOM_LINK_PATH -lGVars3 -lcvd
I tried doing the following to no avail:
CC = g++
COMPILEFLAGS = -I MY_CUSTOM_INCLUDE_PATH -D_LINUX -D_REENTRANT -Wall -O3 -march=nocona -msse3
LINKFLAGS = -L MY_CUSTOM_LINK_PATH -lGVars3 -lcvd **-llapack**
Result:
make
...
/usr/bin/ld: cannot find -llapack
collect2: ld returned 1 exit status
How can I add lapack to my project? I am pretty sure I installed it correctly, though would be willing to double-check that somehow.
It looks like liblapack isn't in the path that ld can find. I would suggest two things:
Establish a symbolic link manually. It is possible (and sometimes common) that ld cannot recognize liblapack.so.3gf or liblapack.so.3.0.1 or so are essentially liblapack.so. You can set up a link by ln -s liblapack.so.3gf liblapack.so
Install liblapack-dev package instead if you're using ubuntu or debian repos. For some unclear reasons, liblapack3gf is not the same as liblapack-dev. I am not sure if in any circumstances, both will do or not do the same thing.
I think the first item should be able to resolve your problem (hopefully).
On my computer the dynamic library is in /usr/lib64/liblapack.so.3.4.1 and contains the requested symbol:
$ nm -D /usr/lib64/liblapack.so.3.4.1 | grep dgesvd
0000000000189200 T dgesvd_
So I would guess that the place where your lapack is installed is not in the linker search path. You should add the flag -L/path/to/the/lapackdir to LINKFLAGS

configure finds library, but ldd does not

I am making use of a logging library, named liblogger, (that I've implemented) within another library, libmsg. For both of them, I'm using the autotools. I successfully install the liblogger library in my system, under the /usr/local/lib directory.
Within the configure.ac script of the other libmsg, I verify that liblogger is installed in the system, as follows:
AC_CHECK_LIB([logger],
[log_init],
[],
[
echo "Error: Could not find liblogger."
exit 1
])
And add the "-L/usr/local/lib" path to the LDFLAGS variable.
The AC_CHECK_LIB test finds the library, and both the libmsg library and its check_PROGRAMS using are successfully compiled.
However, when I try to execute the test programs, I get the error:
error while loading shared libraries: liblogger.so.0: cannot open shared object file: No such file or directory
Indeed, ldd does not find the library either:
$ ldd msgs
linux-vdso.so.1 => (0x00007fff543ff000)
liblogger.so.0 => not found
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fdf329ad000)
But the library is actually there, in /usr/local/lib.
For linking the test program, libtool is being called with the instruction:
$ /bin/bash ../libtool --tag=CC --mode=link gcc -I../include -I../msg -L/usr/local/lib -O2 -Wall -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/local/include -I/usr/local/lib -L/usr/local/lib -o msgs msgs.o message.o base64.o misc.o -llogger -lglib-2.0
Which actually echoes the following:
libtool: link: gcc -I../include -I../msg -O2 -Wall -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/local/include -I/usr/local/lib -o msgs msgs.o message.o base64.o misc.o -L/usr/local/lib /usr/local/lib/liblogger.so -lglib-2.0
So, the -llogger flag is being substituted by -L[..] /usr/local/liblogger.so (I suppose this is a correct behavior? I haven't been able yet to determine it...)
Actually, if I call the test program with:
LDPRELOAD=/usr/local/lib/liblogger.so msgs
It actually works.
Can anyone tell me what is it what I'm missing?
You need to check if:
/usr/local/lib is in /etc/ld.so.conf (it usually is these days).
ldconfig was run when you installed liblogger. If not, run it.
liblogger.so.0 is actually in /usr/local/lib.

CommandT installation problems on windows

After completing all installation steps for the CommandT plugin, I get the error command-t.vim could not load the C extension when starting it. The ComamndT troubleshooting section gives this advice:
If a problem occurs the first thing you should do is inspect the output of:
ruby extconf.rb
make
During the installation, and:
vim --version
And compare the compilation and linker flags that were passed to the
extension and to Vim itself when they were built. If the Ruby-related
flags or architecture flags are different then it is likely that something
has changed in your Ruby environment and the extension may not work until
you eliminate the discrepancy.
And it does indeed seem that there is discrepancy for me.
Output from make suggests cygwin's gcc is using ruby 1.8:
gcc -I. -I/usr/lib/ruby/1.8/i386-cygwin -I/usr/lib/ruby/1.8/i386-cygwin -I. -DHA
VE_RUBY_H -g -O2 -std=c99 -Wall -Wextra -Wno-unused-parameter -c ext.c
gcc -I. -I/usr/lib/ruby/1.8/i386-cygwin -I/usr/lib/ruby/1.8/i386-cygwin -I. -DHA
VE_RUBY_H -g -O2 -std=c99 -Wall -Wextra -Wno-unused-parameter -c match.c
gcc -I. -I/usr/lib/ruby/1.8/i386-cygwin -I/usr/lib/ruby/1.8/i386-cygwin -I. -DHA
VE_RUBY_H -g -O2 -std=c99 -Wall -Wextra -Wno-unused-parameter -c matcher.c
gcc -shared -s -o ext.so ext.o match.o matcher.o -L. -L/usr/lib -L. -Wl,--enabl
e-auto-image-base,--enable-auto-import,--export-all -lruby -ldl -lcrypt
Output from vim's :version contains this output:
-DDYNAMIC_RUBY_VER=191 -DDYNAMIC_RUBY_DLL=\"msvcrt-ruby191.dll\"
The troubleshooting guide suggests using a combination of Vim 7.2, Ruby 1.8.7-p299, and DevKit 3.4.5r3-20091110. However this is not a good solution for me for a number of reasons:
I'm using Vim 7.3 and would like to continue doing so.
Ruby 1.9.3 is installed on my system, and I need it in my PATH for other projects.
So is there any way to get this working, while keeping the latest version of ruby and the latest version of vim?
UPDATE
Having followed AndrewMarshall's advice, I installed Ruby191 and DevKit-4.5.0-20100819-1536-sfx.exe according to this tutorial and ran ruby extconf.rb through that version. The make cmd executed successfully with this output:
gcc -I. -IC:/Ruby191/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby191/include/ruby-1
.9.1/ruby/backward -I/C/Ruby191/include/ruby-1.9.1 -I. -DHAVE_RUBY_H -O2 -g -
Wall -Wno-parentheses -std=c99 -Wall -Wextra -Wno-unused-parameter -o ext.o -c
ext.c
gcc -I. -IC:/Ruby191/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby191/include/ruby-1
.9.1/ruby/backward -I/C/Ruby191/include/ruby-1.9.1 -I. -DHAVE_RUBY_H -O2 -g -
Wall -Wno-parentheses -std=c99 -Wall -Wextra -Wno-unused-parameter -o match.o
-c match.c
gcc -I. -IC:/Ruby191/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby191/include/ruby-1
.9.1/ruby/backward -I/C/Ruby191/include/ruby-1.9.1 -I. -DHAVE_RUBY_H -O2 -g -
Wall -Wno-parentheses -std=c99 -Wall -Wextra -Wno-unused-parameter -o matcher.
o -c matcher.c
gcc -shared -s -o ext.so ext.o match.o matcher.o -L. -LC:/Ruby191/lib -L. -Wl,-
-enable-auto-image-base,--enable-auto-import -lmsvcrt-ruby191 -lshell32 -lws2
_32
and running :CommandT in vim works now, but as soon as I start typing to search for a file, and then hit enter to select and open it, I get this:
not a real answer but you may wanna try ctrlp instead.
written in vimscript (no dependency, no compiling)
as fast as CommandT (subjective to me)
has probably more features than CommandT (does CommandT have most recent file?)
there is also the good old FuzzyFinder which I haven't tried. seems like it hasn't got updated for about 2 years but it may still be working.
I successfully installed newest command-t on vim 8.0 on windows 10. And I find this question when I'm working on it so I'm gonna post my solution although it's a little late.
Ruby version for vim 8.0 is Ruby 2.2. So download and install Ruby 2.2 and Ruby Devkit (remember to execute ruby dk.rb init and ruby dk.rb install for devkit ).
Then I follow the command-t instruction to execute ruby extconf.conf, but it failed -- it output You have to install development tools first. even though I did install it:
I googled this issue find RubyInstaller wiki says that I should execute this command by add -rdevkit and I did it. It succeed when I execute ruby -rdevkit extconf.rb but failed when make. So I googled again and find another way to compile it:
rake make -rdevkit
And it worked. Here is my screenshot:

Resources