I have the following makefile
#makefile for building Linux 64b executable
FC = ifort
MPPD = -DAUTODOUBLE -4R8 -4I8
FLAGS = -safe_cray_ptr -assume byterecl,buffered_io,protect_parens -warn nousage -zero -ftz -fp-model precise -mP2OPT_hpo_dist_factor=21 -diag-disable 10212,10010 -fimf-arch-consistency=true -traceback -pad -DLINUX -DIFORT -DNET_SECURITY -DADDR64 -DINTEL -DXEON64 -DFCC80 -DTIMER=cycle_time -DSSE2 -DOVERRIDE -DMPP -DMPICH -DHPMPI -DAUTODOUBLE -DNEWIO -DEXTENDED -DLSTCODE -DENABLE_HASH3 -DFFTW -DZMF2 -DUSES_CXX -DPFEM -DSPRNG -DUSE_SPRNG -DUSES_CPP -DPTHREADS -nodps -i8 -r8 -DSPRNG_MPI -DUSE_MPI -DINTEL -DAdd_ -xSSE2 -align array16byte -fPIC -O2
TARGET = mppdyna
MPICH_LIB = /opt/intel/impi/4.1.3.048/mic/lib/libmpi.so
MPICH_INC = /opt/intel/impi/4.1.3.048/mic/include/
FFLAGS = $(FLAGS) -I. -I$(MPICH_INC) -I/opt/ibm/platform_mpi/include/
LINKLIBS = libgcrypt.so.20 libgpg-error.so.0 libpthread.so.0 libtriboformplugin.so
OBJS = dyn21.o dyn21b.o couple2other_user.o triboform_lsdyna_plugin.o
$(TARGET): $(OBJS)
$(FC) -w -o mppdyna.out $(OBJS) $(LINKLIBS)
init_dyn21.o: init_dyn21.f nhisparm.inc
$(FC) -c $(FFLAGS) init_dyn21.f
dyn21.o: dyn21.f nhisparm.inc
$(FC) -c $(FFLAGS) dyn21.f
dyn21b.o: dyn21b.f nhisparm.inc
$(FC) -c $(FFLAGS) dyn21b.f
couple2other_user.o: couple2other_user.f
$(FC) -c $(FFLAGS) couple2other_user.f
dynrfn_user.o: dynrfn_user.f
$(FC) -c $(FFLAGS) dynrfn_user.f
triboform_lsdyna_plugin.o: triboform_lsdyna_plugin.f
$(FC) -c $(FFLAGS) triboform_lsdyna_plugin.f
clean:
-#rm mppdyna 2>/dev/null || :
rm -rf *.o
And it gives me the following error message
...
...
dyn21b.f:(.text+0x90cd2): undefined reference to `adios_'
dyn21b.o: In function `umat48c_':
dyn21b.f:(.text+0x90dc2): undefined reference to `adios_'
dyn21b.o:dyn21b.f:(.text+0x90eb2): more undefined references to `adios_' follow
dyn21b.o: In function `thumat12_':
dyn21b.f:(.text+0x961ed): undefined reference to `crvval_'
dyn21b.f:(.text+0x96260): undefined reference to `crvval_'
dyn21b.o: In function `thumat13_':
dyn21b.f:(.text+0x963bc): undefined reference to `adios_'
...
...
libtriboformplugin.so: undefined reference to `do_license_check'
libtriboformplugin.so: undefined reference to `write_processing_file'
libtriboformplugin.so: undefined reference to `strerror_s'
libtriboformplugin.so: undefined reference to `fopen_s'
libtriboformplugin.so: undefined reference to `freopen_s'
make: *** [mppdyna] Error 1
I'm relatively new with ifort, can anyone point to me where my fault is?
which ifort points to /opt/intel/composer_xe_2013_sp1.2.144/bin/intel64/ifort and I'm also using platform_mpi.
I've created libtriboformplugin.so with another makefile (succesfully) that's from a C project.
Related
When I run python eval.py, it comes to the error::
ImportError: /home/aa/EAST/lanms/adaptor.so: undefined
symbol:_ZTVN10__cxxabiv121__vmi_class_type_infoE
I uses $make clean && make but it is still give me the same error and with some warring during execute the make
This is the makefile::
CXXFLAGS = -I include -std=c++11 -O3 $(shell python3-config --cflags)
LDFLAGS = $(shell python3-config --ldflags)
DEPS = lanms.h $(shell find include -xtype f)
CXX_SOURCES = adaptor.cpp include/clipper/clipper.cpp
LIB_SO = adaptor.so
$(LIB_SO): $(CXX_SOURCES) $(DEPS)
$(CXX) -o $# $(CXXFLAGS) $(LDFLAGS) $(CXX_SOURCES) --shared -fPIC
clean:
rm -rf $(LIB_SO)
when I use make command it show these warning::
/usr/bin/gcc-7 -o adaptor.so -I include -std=c++11 -O3 -I/home/ashwaq/anaconda3/include/python3.5m -I/home/aa/anaconda3/include/python3.5m -Wno-unused-result -Wsign-compare -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O3 -pipe -flto -fuse-linker-plugin -ffat-lto-objects -DNDEBUG -fwrapv -O3 -Wall -Wstrict-prototypes -L/home/ashwaq/anaconda3/lib/python3.5/config-3.5m -L/home/ashwaq/anaconda3/lib -lpython3.5m -lpthread -ldl -lutil -lrt -lm -Xlinker -export-dynamic adaptor.cpp include/clipper/clipper.cpp --shared -fPIC
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from include/pybind11/pytypes.h:12:0,
from include/pybind11/cast.h:13,
from include/pybind11/attr.h:13,
from include/pybind11/pybind11.h:43,
from adaptor.cpp:1:
adaptor.cpp: In function ‘PyObject* PyInit_adaptor()’:
include/pybind11/common.h:232:34: warning: ‘PyObject* pybind11_init()’ is deprecated: PYBIND11_PLUGIN is deprecated, use PYBIND11_MODULE [-Wdeprecated-declarations]
return pybind11_init(); \
^
adaptor.cpp:53:1: note: in expansion of macro ‘PYBIND11_PLUGIN’
PYBIND11_PLUGIN(adaptor) {
^~~~~~~~~~~~~~~
include/pybind11/common.h:217:22: note: declared here
static PyObject *pybind11_init(); \
^
adaptor.cpp:53:1: note: in expansion of macro ‘PYBIND11_PLUGIN’
PYBIND11_PLUGIN(adaptor) {
^~~~~~~~~~~~~~~
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
include/clipper/clipper.cpp: In member function ‘void ClipperLib::Clipper::FixupFirstLefts3(ClipperLib::OutRec*, ClipperLib::OutRec*)’:
include/clipper/clipper.cpp:3665:13: warning: unused variable ‘firstLeft’ [-Wunused-variable]
OutRec* firstLeft = ParseFirstLeft(outRec->FirstLeft);
I use::
ubuntu-17.4
tensorflow-1.4.0
python-3.5
gcc-7.0.1
cuda-8.0
Hopefully someone can help with this.
After rebuilding OpenCV 2.4.6 with Cuda Toolkit 5.5 on linux, an attempt was made to build a single c++ file that references OpenCV and CUDA using via make and a CLI g++ command. The input and output from each approach are shown below.
The Makefile attempts to reference the *.a files from OpenCV, but is not successful. The CLI g++ command attempts to reference *.so files, which it seems to do, however, some methods appear to be undefined.
Is it necessary for the Makefile to access only the OpenCV *.a files?
Makefile:
CFLAGS = -g Wall
LIBPATH = /data/content/cuda/opencv-2.4.6/lib
LIBS = -lopencv_calib3d_pch_dephelp -lopencv_contrib_pch_dephelp -lopencv_core_pch_dephelp -lopencv_features2d_pch_dephelp -lopencv_flann_pch_dephelp -lopencv_gpu_pch_dephelp -lopencv_haartraining_engine -lopencv_highgui_pch_dephelp -lopencv_imgproc_pch_dephelp -lopencv_legacy_pch_dephelp -lopencv_ml_pch_dephelp -lopencv_nonfree_pch_dephelp -lopencv_objdetect_pch_dephelp -lopencv_perf_calib3d_pch_dephelp -lopencv_perf_core_pch_dephelp -lopencv_perf_features2d_pch_dephelp -lopencv_perf_gpu_pch_dephelp -lopencv_perf_highgui_pch_dephelp -lopencv_perf_imgproc_pch_dephelp -lopencv_perf_nonfree_pch_dephelp -lopencv_perf_objdetect_pch_dephelp -lopencv_perf_photo_pch_dephelp -lopencv_perf_stitching_pch_dephelp -lopencv_perf_superres_pch_dephelp -lopencv_perf_video_pch_dephelp -lopencv_photo_pch_dephelp -lopencv_stitching_pch_dephelp -lopencv_superres_pch_dephelp -lopencv_test_calib3d_pch_dephelp -lopencv_test_contrib_pch_dephelp -lopencv_test_core_pch_dephelp -lopencv_test_features2d_pch_dephelp -lopencv_test_flann_pch_dephelp -lopencv_test_gpu_pch_dephelp -lopencv_test_highgui_pch_dephelp -lopencv_test_imgproc_pch_dephelp -lopencv_test_legacy_pch_dephelp -lopencv_test_ml_pch_dephelp -lopencv_test_nonfree_pch_dephelp -lopencv_test_objdetect_pch_dephelp -lopencv_test_photo_pch_dephelp -lopencv_test_stitching_pch_dephelp -lopencv_test_superres_pch_dephelp -lopencv_test_video_pch_dephelp -lopencv_ts_pch_dephelp -lopencv_video_pch_dephelp -lopencv_videostab_pch_dephelp -lopencv_gpu -lopencv_highgui
INCLUDEPATH1 = /usr/include/opencv2/core
INCLUDEPATH2 = /usr/include/opencv2/highgui
INCLUDEPATH3 = /usr/include/opencv2/gpu
all: tiff2png1.so
tiff2png1.so: main.o
g++ -o tiff2png1.so main.o **-L $(LIBPATH) $(LIB)**
main.o: main.cpp
g++ -c main.cpp -g -Wall -I $(INCLUDEPATH1) -I $(INCLUDEPATH2) -I $(INCLUDEPATH3) $(LIBPATH)
.PHONY: clean
clean:
rm -vf tiff2png1.so *.o
Makefile Output:
g++ -o tiff2png1.so main.o -L /data/content/cuda/opencv-2.4.6/lib
main.o: In function main':
/home/.../main.cpp:13: undefined reference tocv::gpu::getCudaEnabledDeviceCount()'
/home/.../main.cpp:15: undefined reference to cv::gpu::getDevice()'
/home/.../main.cpp:21: undefined reference tocv::imread(std::basic_string, std::allocator > const&, int)'
/home/.../main.cpp:27: undefined reference to cv::gpu::GpuMat::GpuMat(cv::Mat const&)'
/home/.../main.cpp:29: undefined reference tocv::gpu::Stream::Null()'
/home/.../main.cpp:29: undefined reference to cv::gpu::resize(cv::gpu::GpuMat const&, cv::gpu::GpuMat&, cv::Size_<int>, double, double, int, cv::gpu::Stream&)'
/home/.../main.cpp:42: undefined reference tocv::Mat::Mat(cv::gpu::GpuMat const&)'
/home/.../main.cpp:49: undefined reference to cv::_InputArray::_InputArray(cv::Mat const&)'
...
main.o: In function~GpuMat': /usr/include/opencv2/core/gpumat.hpp:374: undefined reference to `cv::gpu::GpuMat::release()'
collect2: ld returned 1 exit status
make: * [tiff2png1.so] Error 1
Command Line Build
$ g++ -o tx.exe main.o -L/data/content/cuda/opencv-2.4.6/lib -lopencv_gpu
Command Line Build Output
/data/content/cuda/opencv-2.4.6/lib/libopencv_gpu.so: undefined reference to `cv::gpu::convertTo(cv::gpu::GpuMat const&, cv::gpu::GpuMat&, double, double, CUstream_st*)'
/data/content/cuda/opencv-2.4.6/lib/libopencv_gpu.so: undefined reference to `cv::gpu::setTo(cv::gpu::GpuMat&, cv::Scalar_, cv::gpu::GpuMat const&, CUstream_st*)'
/data/content/cuda/opencv-2.4.6/lib/libopencv_gpu.so: undefined reference to `cv::gpu::setTo(cv::gpu::GpuMat&, cv::Scalar_, CUstream_st*)'
collect2: ld returned 1 exit status
It looks like you may have omitted an 'S' at the end of your variable in the linker target
**LIBS** = -lopencv_calib3d_pch_dephelp ...
tiff2png1.so: main.o
g++ -o tiff2png1.so main.o -L $(LIBPATH) $(**LIB**)
and so the -l options aren't being passed to the linker
g++ -o tiff2png1.so main.o -L /data/content/cuda/opencv-2.4.6/lib **should be here** main.o
I'm struggling with this Makefile. It bombs out on the last line. Can't figure out what I am doing wrong. Can anyone see it? Thanks!
CC = gcc
CFLAGSFUSE = `pkg-config fuse --cflags`
LLIBSFUSE = `pkg-config fuse --libs`
CFLAGS = -c -g -Wall -Wextra
LFLAGS = -g -Wall -Wextra
encfs: encfs.o log.o xattr_new.o
$(CC) $(LFLAGS) $^ -o $# $(LLIBSFUSE)
xattr_new: xattr_new.o
$(CC) $(LFLAGS) $^ -o $#
encfs.o: encfs.c log.h params.h xattr_new.c
gcc -g -Wall `pkg-config fuse --cflags` -c pa4-encfs.c
log.o : log.c log.h params.h
$(CC) $(CFLAGS) $(CFLAGSFUSE) log.c
xattr_new.o: xattr_new.c
$(CC) $(CFLAGS) $<
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation
0 has invalid symbol index 11
/usr/bin/ld:/usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation
1 has invalid symbol index 12
/usr/bin/ld:/usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation
2 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation
3 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation
4 has invalid symbol index 11
...
I wrote a soap-client with gsoap++ library. once i compiled this one as a stand-alone test app it was compiled fine, but when i try to compile these classes including in my project i get a lot of linking errors:
../common/UserGausClient/UserGausClient.o: In function `GAUS::SSLInit()':
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/UserGausClient.h:11: undefined reference to `soap_ssl_init'
../common/UserGausClient/soapC.o: In function `soap_faultdetail':
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:117: undefined reference to `soap_malloc'
../common/UserGausClient/soapC.o: In function `soap_getelement':
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:152: undefined reference to `soap_peek_element'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:154: undefined reference to `soap_lookup_type'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:155: undefined reference to `soap_lookup_type'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:215: undefined reference to `soap_match_tag'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:219: undefined reference to `soap_match_tag'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:223: undefined reference to `soap_match_tag'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:227: undefined reference to `soap_match_tag'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:231: undefined reference to `soap_match_tag'
../common/UserGausClient/soapC.o:/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:235: more undefined references to `soap_match_tag' follow
../common/UserGausClient/soapC.o: In function `soap_ignore_element(soap*)':
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:333: undefined reference to `soap_peek_element'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:337: undefined reference to `soap_match_tag'
/home/milo/src/pinmoney/src/registrator/../common/UserGausClient/soapC.cpp:354: undefined reference to `soap_element_end_in'
../common/UserGausClient/soapC.o: In function `soap_class_id_enter(soap*, char const*, void*, int, unsigned int, char const*, char const*)':
and so on. In Codeblocks it linking fined... Here is my Makefile:
CC=g++
RM=rm
CFLAGS=-c -g -Wall -DWITH_OPENSSL
LDFLAGS=-lpcrecpp -lpq -lcryptopp -lprotobuf -lrt -lgsoapssl++ -lssl -lcrypto -L/usr/lib/ -L/usr/local/lib/ -lgsoap
SOURCES=../common/PgConnectionManager.cpp \
../common/RSADecryptor.cpp \
../common/RSAEncryptor.cpp \
../common/RSAKeyGenerator.cpp \
../common/RSAKeyLoaderBase.cpp \
../common/RSAManager.cpp \
../common/TcpServer.cpp \
../common/UserGausClient/UserGausClient.cpp \
../common/UserGausClient/soapC.cpp \
../common/UserGausClient/soapuserBindingProxy.cpp \
../proto/BalanceHistory.pb.cc \
../proto/Bio.pb.cc \
../proto/ClientRegistration.pb.cc \
../proto/EmployeePermissions.pb.cc \
../proto/OperatorAuthentication.pb.cc \
../proto/Passport.pb.cc \
../proto/Ping.pb.cc \
../proto/SearchForBill.pb.cc \
../proto/UpdateClientData.pb.cc \
RequestDispatcher.cpp \
SQLStorage.cpp \
SessionManager.cpp \
main.cpp \
OBJECTS_SEARCHER=$(SOURCES:.cpp=.o)
OBJECTS=$(OBJECTS_SEARCHER:.cc=.o)
SEARCHER=registrator
INCLUDE=-I ../
all: $(SEARCHER)
$(SEARCHER): $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $#
clean:
$(RM) -f $(OBJECTS)
.cpp.o:
$(CC) $(CFLAGS) $(INCLUDE) $< -o $#
I linked against all necessary libraries (-lgsoapssl++ -lssl -lcrypto) and I checked out requesting functions in these ones:
$ nm /usr/lib/libgsoapssl++.a | grep soap_begin_count
00018da0 T soap_begin_count
and there are in libraries. so, what a problem?
I believe you have to compile one of gSoap's stdsoap2.* files in your make. The generated soapC file depends on the core gSoap code.
One possible reason for this is the order that the libraries are specified to the linker, some linkers require that the libarary containing the definition of a function appears after the object or library that requires it. Try re-arranging the library definitions so that this is the case here and check your linkers documentaion to see if it requires this.
'stdsoap2.cpp' needs to be from the gsoap source directory.
PATH_TO_GSOAP_BUILD/gsoap-2.8/gsoap/stdsoap2.cpp (assuming gsoap-2.8)
I'm having trouble compiling wmii v3.9.2 on Fedora 15; Here's the interesting part (things break down at the linking stage):
% bmake -de
MAKE all libbio/
MAKE all libfmt/
MAKE all libregexp/
MAKE all libutf/
MAKE all libixp/
MAKE all doc/
MAKE all man/
MAKE all cmd/
MAKE all cmd/wmii/
MAKE all cmd/menu/
LD cmd/wmii9menu.out
/usr/bin/ld: wmii/xext.o: undefined reference to symbol 'XRenderFindVisualFormat'
/usr/bin/ld: note: 'XRenderFindVisualFormat' is defined in DSO /usr/lib64/libXrender.so.1 so try adding it to the linker command line
/usr/lib64/libXrender.so.1: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
*** Failed target: wmii9menu.out
*** Failed command: ../util/link "cc" "$(pkg-config --libs 2>/dev/null) -g -L../lib -L/usr/lib64 ../lib/libregexp9.a ../lib/libbio.a ../lib/libfmt.a ../lib/libutf.a -L../lib -L/usr/lib64 ../lib/libregexp9.a ../lib/libbio.a ../lib/libfmt.a ../lib/libutf.a" wmii9menu.out wmii9menu.o clientutil.o wmii/x11.o wmii/xext.o wmii/geom.o wmii/map.o util.o ../lib/libixp.a $(pkg-config --libs xft xrandr xinerama) -lXext
*** Error code 1
Stop.
bmake: stopped in /srv/redhat/BUILD/wmii+ixp-3.9.2/cmd
*** Failed target: dall
*** Failed command: dirs="libbio libfmt libregexp libutf libixp doc man cmd libwmii_hack rc alternative_wmiircs"; set -e; targ=dall; targ=${targ#d}; for i in $dirs; do export WMII_HGVERSION=""; export BASE=$i/; if [ ! -d $i ]; then echo Skipping nonexistent directory: $i 1>&2; else echo MAKE $targ $BASE; (cd $i && bmake $targ) || exit ; fi; done
*** Error code 1
Stop.
bmake: stopped in /srv/redhat/BUILD/wmii+ixp-3.9.2
Finally, in config.mk, I have the following settings:
...
INCLUDES = -I. -I$(ROOT)/include -I$(INCLUDE) -I/usr/include
LIBS = -L$(ROOT)/lib -L/usr/lib64
...
LDFLAGS += -g $(LIBS)
SOLDFLAGS += $(LDFLAGS)
SHARED = -shared -Wl,-soname=$(SONAME)
STATIC = -static
...
With a little more manual resolution, the statement generating the error is essentially as follows:
gcc \
-o wmii9menu.out\
-L../lib -L/usr/lib $(pkg-config --libs xft xrandr xinerama xext)\
../lib/libregexp9.a ../lib/libbio.a ../lib/libfmt.a\
../lib/libutf.a ../lib/libixp.a\
wmii9menu.o clientutil.o util.o\
wmii/x11.o wmii/xext.o wmii/geom.o wmii/map.o
Here, the pkg-config resolves to the following, which by itself is perfectly correct:
-lXft -lXrandr -lXinerama -lXext
And the solution is as follows:
--- wmii+ixp-3.9.2/config.mk 2011-06-03 14:03:22.950163074 +1000
+++ wmii+ixp-3.9.2/config.mk 2011-06-03 14:03:16.086129011 +1000
## -32 +32 ##
-X11PACKAGES = xft
+X11PACKAGES = xft xext xrandr xrender xinerama