I've been working on this for two days and still haven't been able to get this makefile to work.
This is what I currently have:
INCDIR = inc/pvt inc/pub
SRCDIR = src
OBJDIR = obj
LIBDIR = lib
CC=gcc
CFLAGS := $(foreach d, $(INCDIR), -I$d)
_SRC = teos_event.c teos_init.c teos_linkedlist.c teos_log.c teos_sem.c teos_task.c
_OBJ := $(subst $(SRCDIR),$(OBJDIR),$(_SRC:%.c=%.o))
OBJ := $(patsubst %,$(OBJDIR)/%,$(_OBJ))
build: $(OBJ)
$(CC) -o $# $^ $(CFLAGS) -fmax-errors=1
$(OBJDIR)/%.o: %.c
$(CC) -c -o $# $< $(CFLAGS) -fmax-errors=1
$(OBJ): $(DEPS)
This is the output I get when I run make:
gcc -o build obj/teos_event.o obj/teos_init.o obj/teos_linkedlist.o obj/teos_log
.o obj/teos_sem.o obj/teos_task.o -Iinc/pvt -Iinc/pub -fmax-errors=1
gcc: error: obj/teos_event.o: No such file or directory
gcc: error: obj/teos_init.o: No such file or directory
gcc: error: obj/teos_linkedlist.o: No such file or directory
gcc: error: obj/teos_log.o: No such file or directory
gcc: error: obj/teos_sem.o: No such file or directory
gcc: error: obj/teos_task.o: No such file or directory
gcc: fatal error: no input files
compilation terminated.
makefile:40: recipe for target 'build' failed
make: *** [build] Error 1
I'm trying to get it to build without makefile errors. Any help would be great.
Did you not notice that it isn't building teos_event.o?
Change this:
$(OBJDIR)/%.o: %.c
...
to this:
$(OBJDIR)/%.o: $(SRCDIR)/%.c
...
Related
I run
make
I get this error
mkdir -p build/
mpicc -Wall -fPIC -m64 -O3 -c src/main.c -o build/main.o
make: mpicc: No such file or directory
make: *** [Makefile:24: build/main.o] Error 127
while trying to compile an mpi project. This is for a project for school and we are "required" to download the libopenmpi-dev package for ubuntu. I'm on fedora so I've tried installing openmpi, mpich-devel, lib-openmpi-devel,libmpich but nothing works yet. I still get the same error. I'm not sure where to go from here.I thought it could just be an export error for mpicc but locate mpicc and whereis mpicc returns nothing.
I would like compile a fortran 90 file which use NetCDF. I have installed NetCDF-Fortran and as shown here, to compile the file test_nc.f90:
program test_nc
use netcdf
implicit none
integer :: ncid, nc_err
nc_err = nf90_open('test.nc', nf90_nowrite, ncid)
nc_err = nf90_close(ncid)
end program test_nc
The compilation with gfortran is
gfortran test_nc.f90 -o test_nc `nf-config --fflags --flibs`
where nf-config --fflags --flibs is:
-I/usr/include
-L/usr/lib -lnetcdff -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -lnetcdf -lnetcdf -ldl -lz -lcurl -lm
Replacing program by subroutine is
subroutine test_nc
use netcdf
implicit none
integer :: ncid, nc_err
nc_err = nf90_open('test.nc', nf90_nowrite, ncid)
nc_err = nf90_close(ncid)
end subroutine test_nc
However, When I run
R CMD SHLIB test_nc.f90 `nf-config --fflags --flibs`
results in:
gfortran -fno-optimize-sibling-calls -fpic -g -O2 -fdebug-prefix-map=/build/r-base-k1TtL4/r-base-3.6.1=. -fstack-protector-strong -c test_nc.f90 -o test_nc.o
test_nc.f90:2:8:
2 | use netcdf
| 1
Fatal Error: Cannot open module file ‘netcdf.mod’ for reading at (1): No such file or directory
compilation terminated.
Also, when I try:
R CMD SHLIB test_nc.f90 -I/usr/include -L/usr/lib -lnetcdff -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -lnetcdf -lnetcdf -ldl -lz -lcurl -lm
gfortran -fno-optimize-sibling-calls -fpic -g -O2 -fdebug-prefix-map=/build/r-base-k1TtL4/r-base-3.6.1=. -fstack-protector-strong -c test_nc.f90 -o test_nc.o
results in:
test_nc.f90:2:8:
2 | use netcdf
| 1
Fatal Error: Cannot open module file ‘netcdf.mod’ for reading at (1): No such file or directory
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:195: test_nc.o] Error 1
How can I tell R CMD SHLIB to use the Netcdf-fortran libraries?
?SHLIB shows
R CMD SHLIB -o mylib.so a.f b.f -L/opt/acml3.5.0/gnu64/lib -lacml
So I guess it is possible to do this
In the call to R CMD SHLIB the options you have provided from nf-config are taken only as linker options. The compilation step is failing because setting the search path for the NetCDF Fortran module is required before the link process.
To add the -I... option from nf-config you can use the environment variable PKG_FCFLAGS:
env PKG_FCFLAGS="`nf-config --fflags`" R CMD SHLIB test_nc.f90 `nf-config --flibs`
Alternatively, you can put PKG_FCFLAGS in your Makevars file.
(Note that, unlike C and C++, the include path option for module files is not for the pre-processing stage.)
I have compiled using below parameters
#./configure --prefix=/usr/local CFLAGS=-fPIC --enable-static --enable-shared \
CFLAGS="-g -O2 -DSQLITE_ENABLE_FTS3=1 \
-DSQLITE_ENABLE_COLUMN_METADATA=1 \
-DSQLITE_ENABLE_UNLOCK_NOTIFY=1 \
-DSQLITE_SECURE_DELETE=1 \
-DSQLITE_ENABLE_DBSTAT_VTAB=1"
# make -j 8
# make install
After using sqlite I get below error message:
/usr/bin/g++ -o utools/utools.so -Wl,-Bsymbolic -g -O2 -shared -Wl,-z,defs utools/utools.plugin.o utools/lib/libutools.a core/lib/libunv.a fv/lib/libfv.a sb/lib/libsb.a -lz -ldl
/usr/bin/ld: /usr/local/sqlite/lib/libsqlite3.a(sqlite3.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/sqlite/lib/libsqlite3.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
scons: *** [stdarm/stdarm.so] Error 1
scons: building terminated because of errors.
inside /usr/local/lib/ directory, deleting following files worked for me
libsqlite3.a
libsqlite3.la
libsqlite3.o.0.bak
libsqlite3.so
I think these files are from the older versions of libsqlite3,
because when you type and check dpkg -L libsqlite3-dev, none goes to /usr/local/lib/
I took the reference from sqlite3 breakage
I have followed all the instructions mentioned in the Apache thrift wiki. I downloaded the thrift source code, then installed the dependencies
sudo yum install automake libtool flex bison pkgconfig gcc-c++ boost-devel libevent-devel zlib-devel python-devel ruby-devel
Then ran
./configure
(didn't run bootstrap.sh because there is no bootstrap.sh in the thrift-0.9.0 codebase). Finally, I get this error. Any idea why this is happening?
libtool: link: ( cd ".libs" && rm -f "libthriftz.la" && ln -s "../libthriftz.la" "libthriftz.la" )
/bin/sh ../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../.. -I/usr/include -I./src -I./src/thrift -DQT_SHARED -I/usr/include/QtCore -I/usr/include/QtNetwork -Wall -g -O2 -MT libthriftqt_la-moc_TQTcpServer.lo -MD -MP -MF .deps/libthriftqt_la-moc_TQTcpServer.Tpo -c -o libthriftqt_la-moc_TQTcpServer.lo `test -f 'src/thrift/qt/moc_TQTcpServer.cpp' || echo './'`src/thrift/qt/moc_TQTcpServer.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../.. -I/usr/include -I./src -I./src/thrift -DQT_SHARED -I/usr/include/QtCore -I/usr/include/QtNetwork -Wall -g -O2 -MT libthriftqt_la-moc_TQTcpServer.lo -MD -MP -MF .deps/libthriftqt_la-moc_TQTcpServer.Tpo -c src/thrift/qt/moc_TQTcpServer.cpp -fPIC -DPIC -o .libs/libthriftqt_la-moc_TQTcpServer.o
src/thrift/qt/moc_TQTcpServer.cpp:14:2: error: #error "This file was generated using the moc from 4.8.1. It"
src/thrift/qt/moc_TQTcpServer.cpp:15:2: error: #error "cannot be used with the include files from this version of Qt."
src/thrift/qt/moc_TQTcpServer.cpp:16:2: error: #error "(The moc has changed too much.)"
src/thrift/qt/moc_TQTcpServer.cpp:47: error: no 'void apache::thrift::async::TQTcpServer::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)' member function declared in class 'apache::thrift::async::TQTcpServer'
src/thrift/qt/moc_TQTcpServer.cpp:62: error: 'const QMetaObjectExtraData apache::thrift::async::TQTcpServer::staticMetaObjectExtraData' is not a static member of 'class apache::thrift::async::TQTcpServer'
src/thrift/qt/moc_TQTcpServer.cpp:63: error: 'qt_static_metacall' was not declared in this scope
src/thrift/qt/moc_TQTcpServer.cpp:64: error: too many initializers for 'const QMetaObjectExtraData'
src/thrift/qt/moc_TQTcpServer.cpp:68: error: 'staticMetaObjectExtraData' was not declared in this scope
src/thrift/qt/moc_TQTcpServer.cpp:69: error: too many initializers for 'QMetaObject::<anonymous struct>'
src/thrift/qt/moc_TQTcpServer.cpp: In member function 'virtual int apache::thrift::async::TQTcpServer::qt_metacall(QMetaObject::Call, int, void**)':
src/thrift/qt/moc_TQTcpServer.cpp:95: error: 'qt_static_metacall' was not declared in this scope
make[4]: *** [libthriftqt_la-moc_TQTcpServer.lo] Error 1
make[4]: Leaving directory `/home/rjain/Downloads/thrift-0.9.0/lib/cpp'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/rjain/Downloads/thrift-0.9.0/lib/cpp'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/rjain/Downloads/thrift-0.9.0/lib'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/rjain/Downloads/thrift-0.9.0'
make: *** [all] Error 2
I download the source from: http://www.apache.org/dyn/closer.cgi?path=/thrift/0.9.0/thrift-0.9.0.tar.gz
Your qt-devel is out of date for thrift. Just remove the qt-devel rpm and rerun the configure script which will skip this part. It works for me.
First of all, check your qt related rpms by executing the following command
rpm -qa | grep qt-devel
If you find qt-devel is installed version below 4.6, please remove this package by executing command
rpm -qa | grep qt-devel | xargs rpm -e
If this is done, the qt part of thrift will be skipped.
It looks like the version of Qt that is on your system is older than what this program expects. Can you try updating Qt to a later version?
sudo yum install qt4-devel
Can some one explain the steps that are needed to include Messaging framework in to a Qt Application?
I have downloaded the Open source Project that contains the Messaging framework from this link:
http://get.qt.nokia.com/qt/solutions/qt-mobility-opensource-src-1.1.0-beta2.tar.gz
UPDATE:
Raised a bug with Nokia.
http://bugreports.qt.nokia.com/browse/QTSDK-229
Running build steps for project
writemessage... Configuration
unchanged, skipping qmake step.
Starting: "/usr/bin/make" -w make:
Entering directory
/Users/xxxxxxx/Qt/qt-mobility-opensource-src-1.1.0-beta2/examples/writemessage-build-simulator'
g++ -c -pipe -g -gdwarf-2 -arch x86_64
-Xarch_x86_64 -mmacosx-version-min=10.5 -arch ppc -arch i386 -Wall -W -DQT_NO_PRINTER -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../../NokiaQtSDK/Simulator/Qt/gcc/mkspecs/macx-g++
-I../writemessage -I../../../../NokiaQtSDK/Simulator/Qt/gcc/lib/QtCore.framework/Versions/4/Headers
-I../../../../NokiaQtSDK/Simulator/Qt/gcc/include/QtCore
-I../../../../NokiaQtSDK/Simulator/Qt/gcc/lib/QtGui.framework/Versions/4/Headers
-I../../../../NokiaQtSDK/Simulator/Qt/gcc/include/QtGui
-I../../../../NokiaQtSDK/Simulator/Qt/gcc/include
-I/Users/xxxxxxx/NokiaQtSDK/Simulator/Qt/gcc/include/QtMessaging
-I/Users/xxxxxxx/NokiaQtSDK/Simulator/Qt/gcc/include/QtMobilitySimulator
-I../../src/global -I../../src/messaging -I/Users/xxxxxxx/install/include -I/Users/xxxxxxx/install/include/QtMobility
-I/Users/xxxxxxx/install/include/QtMessaging
-I../../../../Build/Debug/writemessage/moc
-I. -F/Users/xxxxxxx/NokiaQtSDK/Simulator/Qt/gcc/lib
-o ../../../../Build/Debug/writemessage/messagesender.o
../writemessage/messagesender.cpp g++
-headerpad_max_install_names -arch x86_64 -Xarch_x86_64
-mmacosx-version-min=10.5 -arch ppc -arch i386 -o writemessage.app/Contents/MacOS/writemessage
../../../../Build/Debug/writemessage/messagesender.o
../../../../Build/Debug/writemessage/main.o
../../../../Build/Debug/writemessage/moc_messagesender.o
-F/Users/xxxxxxx/NokiaQtSDK/Simulator/Qt/gcc/lib
-L/Users/xxxxxxx/NokiaQtSDK/Simulator/Qt/gcc/lib
-F/Users/xxxxxxx/lib -L/Users/xxxxxxx/lib -framework Message
-F/Users/xxxxxxx/install/Library/Frameworks
-L/Users/xxxxxxx/install/Library/Frameworks
-framework QtMobilitySimulator -framework QtMessaging -framework QtGui
-L/Installer/______BUILD______PADDED______/ndk/Simulator/Qt/gcc/lib -F/Installer/______BUILD______PADDED______/ndk/Simulator/Qt/gcc/lib -framework QtNetwork -framework QtCore ld: warning: directory
'/Users/xxxxxxx/install/Library/Frameworks'
following -L not found ld: warning:
directory
'/Installer/______BUILD______PADDED______/ndk/Simulator/Qt/gcc/lib'
following -L not found ld: warning:
directory
'/Users/xxxxxxx/install/Library/Frameworks'
following -F not found ld: warning:
directory
'/Installer/______BUILD______PADDED______/ndk/Simulator/Qt/gcc/lib'
following -F not found ld: framework
not found QtMobilitySimulator
collect2: ld returned 1 exit status
ld: warning: directory
'/Users/xxxxxxx/install/Library/Frameworks'
following -L not found ld: warning:
directory
'/Installer/______BUILD______PADDED______/ndk/Simulator/Qt/gcc/lib'
following -L not found ld: warning:
directory
'/Users/xxxxxxx/install/Library/Frameworks'
following -F not found ld: warning:
directory
'/Installer/______BUILD______PADDED______/ndk/Simulator/Qt/gcc/lib'
following -F not found ld: framework
not found QtMobilitySimulator
collect2: ld returned 1 exit status
ld: warning: directory
'/Users/xxxxxxx/install/Library/Frameworks'
following -L not found ld: warning:
directory
'/Installer/______BUILD______PADDED______/ndk/Simulator/Qt/gcc/lib'
following -L not found ld: warning:
directory
'/Users/xxxxxxx/install/Library/Frameworks'
following -F not found ld: warning:
directory
'/Installer/______BUILD______PADDED______/ndk/Simulator/Qt/gcc/lib'
following -F not found ld: framework
not found QtMobilitySimulator
collect2: ld returned 1 exit status
lipo: can't open input file:
/var/folders/CP/CP8sR5YZGx0b2xA2gYP5YE+++TI/-Tmp-//ccoxcfz2.out
(No such file or directory) make: ***
[writemessage.app/Contents/MacOS/writemessage]
Error 1 make: Leaving directory
/Users/xxxxxxx/Qt/qt-mobility-opensource-src-1.1.0-beta2/examples/writemessage-build-simulator'
The process "/usr/bin/make" exited
with code %2. Error while building
project writemessage (target: Qt
Simulator) When executing build step
'Make'
Add this to your .pro file:
macx {
LIBS += -framework Message
}
And include headers this way:
#include <Message/MessageExport.h>
This should work with Qt 4.7.