ALL,
I'm trying to manually compile wxWidgets library - trying to add a new file source to it.
I successfully did compilation:
/Users/AlenaKorot/wxWidgets3.0/buildMac/bk-deps g++ -mmacosx-version-min=10.6 -c -o coredll_desktopenvcmn.o -I./.pch/wxprec_coredll -D__WXOSX_COCOA__ -DWXBUILDING -I/Users/AlenaKorot/wxWidgets3.0/buildMac/src/tiff/libtiff -I../src/tiff/libtiff -I../src/jpeg -I../src/png -I../src/regex -DWXUSINGDLL -DWXMAKINGDLL_CORE -DwxUSE_BASE=0 -dynamic -fPIC -DPIC -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wno-deprecated-declarations -D_FILE_OFFSET_BITS=64 -I/Users/AlenaKorot/wxWidgets3.0/buildMac/lib/wx/include/osx_cocoa-unicode-3.0 -I../include -arch i386 -DWX_PRECOMP -ggdb -O0 -arch i386 -fno-common -fvisibility=hidden -fvisibility-inlines-hidden ../src/common/desktopenvcmn.cpp
/Users/AlenaKorot/wxWidgets3.0/buildMac/bk-deps g++ -mmacosx-version-min=10.6 -c -o coredll_osx_cocoa_desktopenv.o -I./.pch/wxprec_coredll -D__WXOSX_COCOA__ -DWXBUILDING -I/Users/AlenaKorot/wxWidgets3.0/buildMac/src/tiff/libtiff -I../src/tiff/libtiff -I../src/jpeg -I../src/png -I../src/regex -DWXUSINGDLL -DWXMAKINGDLL_CORE -DwxUSE_BASE=0 -dynamic -fPIC -DPIC -D_FILE_OFFSET_BITS=64 -I/Users/AlenaKorot/wxWidgets3.0/buildMac/lib/wx/include/osx_cocoa-unicode-3.0 -I../include -arch i386 -ggdb -O0 -arch i386 -fvisibility=hidden -fvisibility-inlines-hidden ../src/osx/cocoa/desktopenv.mm
And linking:
g++ -mmacosx-version-min=10.6 -dynamiclib -single_module -headerpad_max_install_names -o /Users/AlenaKorot/wxWidgets3.0/buildMac/lib/libwx_osx_cocoau_core-3.0.0.3.0.dylib coredll_desktopenvcmn.o coredll_osx_cocoa_desktopenv.o coredll_event.o coredll_fs_mem.o coredll_msgout.o coredll_utilscmn.o coredll_osx_cocoa_utils.o coredll_artmac.o coredll_osx_brush.o coredll_dialog_osx.o coredll_osx_fontutil.o coredll_osx_imaglist.o coredll_osx_minifram.o coredll_nonownedwnd_osx.o coredll_osx_palette.o coredll_osx_pen.o coredll_toplevel_osx.o coredll_uiaction_osx.o coredll_utils_osx.o coredll_window_osx.o coredll_core_bitmap.o coredll_core_colour.o coredll_core_dcmemory.o coredll_core_display.o coredll_core_fontenum.o coredll_hid.o coredll_printmac.o coredll_core_timer.o coredll_utilsexc_cf.o coredll_apptraits.o coredll_anybutton_osx.o coredll_bmpbuttn_osx.o coredll_button_osx.o coredll_checkbox_osx.o coredll_checklst_osx.o coredll_choice_osx.o coredll_combobox_osx.o coredll_dnd_osx.o coredll_gauge_osx.o coredll_listbox_osx.o coredll_menu_osx.o coredll_menuitem_osx.o coredll_notebook_osx.o coredll_printdlg_osx.o coredll_radiobox_osx.o coredll_radiobut_osx.o coredll_scrolbar_osx.o coredll_slider_osx.o coredll_spinbutt_osx.o coredll_srchctrl_osx.o coredll_statbox_osx.o coredll_statline_osx.o coredll_stattext_osx.o coredll_textentry_osx.o coredll_textctrl_osx.o coredll_tglbtn_osx.o coredll_toolbar_osx.o coredll_webkit.o coredll_colordlgosx.o coredll_fontdlgosx.o coredll_osx_accel.o coredll_carbon_clipbrd.o coredll_carbon_cursor.o coredll_carbon_fontdlg.o coredll_carbon_gdiobj.o coredll_carbon_icon.o coredll_carbon_app.o coredll_carbon_combobox.o coredll_carbon_control.o coredll_carbon_dataobj.o coredll_carbon_dcclient.o coredll_carbon_dcprint.o coredll_carbon_dcscreen.o coredll_glgrab.o coredll_carbon_graphics.o coredll_carbon_font.o coredll_carbon_frame.o coredll_carbon_mdi.o coredll_carbon_metafile.o coredll_carbon_overlay.o coredll_carbon_popupwin.o coredll_carbon_renderer.o coredll_carbon_settings.o coredll_statbrma.o coredll_carbon_region.o coredll_utilscocoa.o coredll_generic_caret.o coredll_clrpickerg.o coredll_collpaneg.o coredll_colrdlgg.o coredll_dirdlgg.o coredll_generic_fdrepdlg.o coredll_filedlgg.o coredll_filepickerg.o coredll_fontdlgg.o coredll_fontpickerg.o coredll_generic_listctrl.o coredll_prntdlgg.o coredll_generic_statusbr.o coredll_generic_textmeasure.o coredll_cocoa_anybutton.o coredll_osx_cocoa_button.o coredll_osx_cocoa_checkbox.o coredll_osx_cocoa_choice.o coredll_osx_cocoa_colour.o coredll_osx_cocoa_combobox.o coredll_osx_cocoa_dialog.o coredll_osx_cocoa_dirdlg.o coredll_cocoa_dnd.o coredll_osx_cocoa_evtloop.o coredll_osx_cocoa_filedlg.o coredll_osx_cocoa_gauge.o coredll_osx_cocoa_listbox.o coredll_osx_cocoa_menu.o coredll_osx_cocoa_menuitem.o coredll_osx_cocoa_msgdlg.o coredll_cocoa_nonownedwnd.o coredll_osx_cocoa_notebook.o coredll_osx_cocoa_radiobut.o coredll_preferences.o coredll_cocoa_printdlg.o coredll_osx_cocoa_scrolbar.o coredll_osx_cocoa_slider.o coredll_osx_cocoa_spinbutt.o coredll_cocoa_srchctrl.o coredll_osx_cocoa_statbox.o coredll_cocoa_statline.o coredll_osx_cocoa_stattext.o coredll_osx_cocoa_textctrl.o coredll_cocoa_tglbtn.o coredll_osx_cocoa_toolbar.o coredll_osx_cocoa_tooltip.o coredll_osx_cocoa_window.o coredll_accelcmn.o coredll_accesscmn.o coredll_anidecod.o coredll_affinematrix2d.o coredll_appcmn.o coredll_artprov.o coredll_artstd.o coredll_arttango.o coredll_bmpbase.o coredll_bmpbtncmn.o coredll_bookctrl.o coredll_btncmn.o coredll_cairo.o coredll_checkboxcmn.o coredll_checklstcmn.o coredll_choiccmn.o coredll_clipcmn.o coredll_clrpickercmn.o coredll_colourcmn.o coredll_colourdata.o coredll_combocmn.o coredll_cmdproc.o coredll_cmndata.o coredll_containr.o coredll_cshelp.o coredll_ctrlcmn.o coredll_ctrlsub.o coredll_dcbase.o coredll_dcbufcmn.o coredll_dcgraph.o coredll_dcsvg.o coredll_dirctrlcmn.o coredll_dlgcmn.o coredll_dndcmn.o coredll_dobjcmn.o coredll_docmdi.o coredll_docview.o coredll_dpycmn.o coredll_dseldlg.o coredll_effects.o coredll_fddlgcmn.o coredll_filectrlcmn.o coredll_filehistorycmn.o coredll_filepickercmn.o coredll_fontpickercmn.o coredll_fldlgcmn.o coredll_fontcmn.o coredll_fontdata.o coredll_graphicc.o coredll_fontenumcmn.o coredll_fontmap.o coredll_fontutilcmn.o coredll_framecmn.o coredll_gaugecmn.o coredll_gbsizer.o coredll_gdicmn.o coredll_geometry.o coredll_gifdecod.o coredll_graphcmn.o coredll_headercolcmn.o coredll_headerctrlcmn.o coredll_helpbase.o coredll_iconbndl.o coredll_imagall.o coredll_imagbmp.o coredll_image.o coredll_imagfill.o coredll_imaggif.o coredll_imagiff.o coredll_imagjpeg.o coredll_imagpcx.o coredll_imagpng.o coredll_imagpnm.o coredll_imagtga.o coredll_imagtiff.o coredll_imagxpm.o coredll_layout.o coredll_lboxcmn.o coredll_listctrlcmn.o coredll_markupparser.o coredll_matrix.o coredll_menucmn.o coredll_modalhook.o coredll_mousemanager.o coredll_nbkbase.o coredll_overlaycmn.o coredll_ownerdrwcmn.o coredll_paper.o coredll_panelcmn.o coredll_persist.o coredll_pickerbase.o coredll_popupcmn.o coredll_preferencescmn.o coredll_prntbase.o coredll_quantize.o coredll_radiobtncmn.o coredll_radiocmn.o coredll_rearrangectrl.o coredll_rendcmn.o coredll_rgncmn.o coredll_scrolbarcmn.o coredll_settcmn.o coredll_sizer.o coredll_slidercmn.o coredll_spinbtncmn.o coredll_spinctrlcmn.o coredll_srchcmn.o coredll_statbar.o coredll_statbmpcmn.o coredll_statboxcmn.o coredll_statlinecmn.o coredll_stattextcmn.o coredll_stockitem.o coredll_tbarbase.o coredll_textcmn.o coredll_textentrycmn.o coredll_textmeasurecmn.o coredll_toplvcmn.o coredll_treebase.o coredll_uiactioncmn.o coredll_valgen.o coredll_validate.o coredll_valtext.o coredll_valnum.o coredll_wincmn.o coredll_windowid.o coredll_wrapsizer.o coredll_xpmdecod.o coredll_busyinfo.o coredll_buttonbar.o coredll_choicdgg.o coredll_choicbkg.o coredll_combog.o coredll_dcpsg.o coredll_dirctrlg.o coredll_dragimgg.o coredll_filectrlg.o coredll_headerctrlg.o coredll_generic_infobar.o coredll_listbkg.o coredll_logg.o coredll_markuptext.o coredll_msgdlgg.o coredll_numdlgg.o coredll_progdlgg.o coredll_preferencesg.o coredll_printps.o coredll_renderg.o coredll_richmsgdlgg.o coredll_scrlwing.o coredll_selstore.o coredll_spinctlg.o coredll_splitter.o coredll_srchctlg.o coredll_statbmpg.o coredll_stattextg.o coredll_textdlgg.o coredll_tipwin.o coredll_toolbkg.o coredll_treectlg.o coredll_treebkg.o coredll_vlbox.o coredll_vscroll.o coredll_xmlreshandler.o -L/Users/AlenaKorot/wxWidgets3.0/buildMac/lib -L/Users/AlenaKorot/wxWidgets3.0/buildMac/lib -install_name /usr/local/lib/libwx_osx_cocoau_core-3.0.0.dylib -compatibility_version 4.0 -current_version 4.0 -arch i386 -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -lwxtiff-3.0 -lwxjpeg-3.0 -lwxpng-3.0 -framework WebKit -lwxregexu-3.0 -arch i386 -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -lz -lpthread -liconv -lwx_baseu-3.0 -lz -lpthread -liconv
Now, here is the strange thing:
Alena-Korots-MacBook:buildMac AlenaKorot$ nm -g coredll_osx_cocoa_desktopenv.o | grep -i desktopenv000001ca T __ZN12wxDesktopEnv15MoveFileToTrashERK8wxString
00019dc8 S __ZN12wxDesktopEnv15MoveFileToTrashERK8wxString.eh
00000444 T __ZN12wxDesktopEnv20MoveDirectoryToTrashERK8wxString
00019df8 S __ZN12wxDesktopEnv20MoveDirectoryToTrashERK8wxString.eh
000000aa T __ZN12wxDesktopEnv20MoveFileToRecycleBinERK8wxString
00019c10 S __ZN12wxDesktopEnv20MoveFileToRecycleBinERK8wxString.eh
0000015a T __ZN12wxDesktopEnvC1Ev
00000000 T __ZN12wxDesktopEnvC2Ev
00000070 T __ZN12wxDesktopEnvD0Ev
00000036 T __ZN12wxDesktopEnvD1Ev
00000190 T __ZN12wxDesktopEnvD2Ev
U __ZN16wxDesktopEnvBase20MoveFileToRecycleBinERK8wxString
0001976c S __ZN16wxDesktopEnvBaseC2Ev
00019ba0 S __ZTI12wxDesktopEnv
U __ZTI16wxDesktopEnvBase
00019b5a S __ZTS12wxDesktopEnv
00019b88 S __ZTV12wxDesktopEnv
U __ZTV16wxDesktopEnvBase
In the object file there are wxDesktopEnv constructor and wxDesktopEnvBase constructor. However:
Alena-Korots-MacBook:lib AlenaKorot$ nm -g libwx_osx_cocoau_core-3.0.dylib | grep -i desktop
Alena-Korots-MacBook:lib AlenaKorot$
those symbols are missing from the dylib.
As you can see I'm linking against the appropriate *.o files.
What do I do to fix it? And where my symbols are?
Thank you.
P.S.: Sorry for such a long post with a bit code quote.
Problem solved.
I tried to do the build with mixed directories.
Sorry for the noise.
Related
darknet
My application is to record sound via microphone, to preprocess like fft, and to classify voice activities. I composed own code that deals with recording,converting into *.wav,and doing learning and predicting in the name of sound.c. At this time, I do not need image processing.
Anyway, followings are what I get during make.
#-desktop:~/darknet_tmp$ make
PATH:=/usr/local/cuda-11.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/cuda/bin:/usr/local/cuda/lib64
g++ -std=c++11 -std=c++11 -Iinclude/ -I3rdparty/stb/include -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DGPU -DCUDNN -I/usr/local/cudnn/include -fPIC obj/sound.o obj/http_stream.o obj/gemm.o obj/utils.o obj/dark_cuda.o obj/convolutional_layer.o obj/list.o obj/image.o obj/activations.o obj/im2col.o obj/col2im.o obj/blas.o obj/crop_layer.o obj/dropout_layer.o obj/maxpool_layer.o obj/softmax_layer.o obj/data.o obj/matrix.o obj/network.o obj/connected_layer.o obj/cost_layer.o obj/parser.o obj/option_list.o obj/darknet.o obj/detection_layer.o obj/captcha.o obj/route_layer.o obj/writing.o obj/box.o obj/nightmare.o obj/normalization_layer.o obj/avgpool_layer.o obj/coco.o obj/dice.o obj/yolo.o obj/detector.o obj/layer.o obj/compare.o obj/classifier.o obj/local_layer.o obj/swag.o obj/shortcut_layer.o obj/activation_layer.o obj/rnn_layer.o obj/gru_layer.o obj/rnn.o obj/rnn_vid.o obj/crnn_layer.o obj/demo.o obj/tag.o obj/cifar.o obj/go.o obj/batchnorm_layer.o obj/art.o obj/region_layer.o obj/reorg_layer.o obj/reorg_old_layer.o obj/super.o obj/voxel.o obj/tree.o obj/yolo_layer.o obj/gaussian_yolo_layer.o obj/upsample_layer.o obj/lstm_layer.o obj/conv_lstm_layer.o obj/scale_channels_layer.o obj/sam_layer.o obj/convolutional_kernels.o obj/activation_kernels.o obj/im2col_kernels.o obj/col2im_kernels.o obj/blas_kernels.o obj/crop_layer_kernels.o obj/dropout_layer_kernels.o obj/maxpool_layer_kernels.o obj/network_kernels.o obj/avgpool_layer_kernels.o -o darknet -lm -pthread -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand -L/usr/local/cudnn/lib64 -lcudnn -lstdc++
obj/darknet.o: In function `main':
darknet.c:(.text.startup+0xae): undefined reference to `show_opencv_info'
obj/network_kernels.o: In function `backward_network_gpu':
tmpxft_00001197_00000000-6_network_kernels.cudafe1.cpp:(.text+0xc90): undefined reference to `resize_window_cv'
obj/network_kernels.o: In function `train_network_datum_gpu':
tmpxft_00001197_00000000-6_network_kernels.cudafe1.cpp:(.text+0x163a): undefined reference to `resize_window_cv'
tmpxft_00001197_00000000-6_network_kernels.cudafe1.cpp:(.text+0x1644): undefined reference to `wait_key_cv'
obj/data.o: In function `load_data_detection':
data.c:(.text+0x4dba): undefined reference to `wait_until_press_key_cv'
obj/data.o: In function `load_data_augment':
data.c:(.text+0x5ad2): undefined reference to `wait_until_press_key_cv'
obj/network.o: In function `train_network_waitkey':
network.c:(.text+0x13db): undefined reference to `wait_key_cv'
obj/writing.o: In function `test_writing':
writing.c:(.text+0x9ae): undefined reference to `wait_until_press_key_cv'
writing.c:(.text+0x9b5): undefined reference to `destroy_all_windows_cv'
obj/coco.o: In function `test_coco':
coco.c:(.text+0x1ac0): undefined reference to `wait_until_press_key_cv'
coco.c:(.text+0x1ac7): undefined reference to `destroy_all_windows_cv'
obj/yolo.o: In function `test_yolo':
yolo.c:(.text+0x1a40): undefined reference to `wait_until_press_key_cv'
yolo.c:(.text+0x1a47): undefined reference to `destroy_all_windows_cv'
obj/detector.o: In function `test_detector':
detector.c:(.text+0x8a0b): undefined reference to `wait_until_press_key_cv'
detector.c:(.text+0x8a12): undefined reference to `destroy_all_windows_cv'
collect2: error: ld returned 1 exit status
Makefile:173: recipe for target 'darknet' failed
make: *** [darknet] Error 1
I need your help and advice.
Makefile
GPU=1
CUDNN=1
CUDNN_HALF=0
OPENCV=0
AVX=0
OPENMP=0
LIBSO=1
ZED_CAMERA=0
ZED_CAMERA_v2_8=0
export PATH:=${PATH}:/usr/local/cuda/bin
export PATH:=${PATH}:/usr/local/cuda/lib64
$(info PATH:=${PATH})
# set GPU=1 and CUDNN=1 to speedup on GPU
# set CUDNN_HALF=1 to further speedup 3 x times (Mixed-precision on Tensor Cores) GPU: Volta, Xavier, Turing and higher
# set AVX=1 and OPENMP=1 to speedup on CPU (if error occurs then set AVX=0)
# set ZED_CAMERA=1 to enable ZED SDK 3.0 and above
# set ZED_CAMERA_v2_8=1 to enable ZED SDK 2.X
USE_CPP=0
DEBUG=0
#ARCH= -gencode arch=compute_30,code=sm_30 \
# -gencode arch=compute_35,code=sm_35 \
# -gencode arch=compute_50,code=[sm_50,compute_50] \
# -gencode arch=compute_52,code=[sm_52,compute_52] \
# -gencode arch=compute_61,code=[sm_61,compute_61]
ARCH= -gencode arch=compute_61,code=sm_61 -gencode arch=compute_61,code=compute_61
OS := $(shell uname)
# Tesla A100 (GA100), DGX-A100, RTX 3080
# ARCH= -gencode arch=compute_80,code=[sm_80,compute_80]
# Tesla V100
# ARCH= -gencode arch=compute_70,code=[sm_70,compute_70]
# GeForce RTX 2080 Ti, RTX 2080, RTX 2070, Quadro RTX 8000, Quadro RTX 6000, Quadro RTX 5000, Tesla T4, XNOR Tensor Cores
# ARCH= -gencode arch=compute_75,code=[sm_75,compute_75]
# Jetson XAVIER
# ARCH= -gencode arch=compute_72,code=[sm_72,compute_72]
# GTX 1080, GTX 1070, GTX 1060, GTX 1050, GTX 1030, Titan Xp, Tesla P40, Tesla P4
# ARCH= -gencode arch=compute_61,code=sm_61 -gencode arch=compute_61,code=compute_61
# GP100/Tesla P100 - DGX-1
# ARCH= -gencode arch=compute_60,code=sm_60
# For Jetson TX1, Tegra X1, DRIVE CX, DRIVE PX - uncomment:
# ARCH= -gencode arch=compute_53,code=[sm_53,compute_53]
# For Jetson Tx2 or Drive-PX2 uncomment:
# ARCH= -gencode arch=compute_62,code=[sm_62,compute_62]
VPATH=./src/
EXEC=darknet
OBJDIR=./obj/
ifeq ($(LIBSO), 1)
LIBNAMESO=libdarknet.so
APPNAMESO=uselib
endif
ifeq ($(USE_CPP), 1)
CC=g++
else
CC=gcc
endif
CPP=g++ -std=c++11
NVCC=nvcc
OPTS=-Ofast
LDFLAGS= -lm -pthread
COMMON= -Iinclude/ -I3rdparty/stb/include
CFLAGS=-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC
ifeq ($(DEBUG), 1)
#OPTS= -O0 -g
#OPTS= -Og -g
COMMON+= -DDEBUG
CFLAGS+= -DDEBUG
else
ifeq ($(AVX), 1)
CFLAGS+= -ffp-contract=fast -mavx -mavx2 -msse3 -msse4.1 -msse4.2 -msse4a
endif
endif
CFLAGS+=$(OPTS)
ifneq (,$(findstring MSYS_NT,$(OS)))
LDFLAGS+=-lws2_32
endif
ifeq ($(OPENCV), 1)
COMMON+= -DOPENCV
CFLAGS+= -DOPENCV
LDFLAGS+= `pkg-config --libs opencv4 2> /dev/null || pkg-config --libs opencv`
COMMON+= `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv`
endif
ifeq ($(OPENMP), 1)
ifeq ($(OS),Darwin) #MAC
CFLAGS+= -Xpreprocessor -fopenmp
else
CFLAGS+= -fopenmp
endif
LDFLAGS+= -lgomp
endif
ifeq ($(GPU), 1)
COMMON+= -DGPU -I/usr/local/cuda/include/
CFLAGS+= -DGPU
ifeq ($(OS),Darwin) #MAC
LDFLAGS+= -L/usr/local/cuda/lib -lcuda -lcudart -lcublas -lcurand
else
LDFLAGS+= -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand
endif
endif
ifeq ($(CUDNN), 1)
COMMON+= -DCUDNN
ifeq ($(OS),Darwin) #MAC
CFLAGS+= -DCUDNN -I/usr/local/cuda/include
LDFLAGS+= -L/usr/local/cuda/lib -lcudnn
else
CFLAGS+= -DCUDNN -I/usr/local/cudnn/include
LDFLAGS+= -L/usr/local/cudnn/lib64 -lcudnn
endif
endif
ifeq ($(CUDNN_HALF), 1)
COMMON+= -DCUDNN_HALF
CFLAGS+= -DCUDNN_HALF
ARCH+= -gencode arch=compute_70,code=[sm_70,compute_70]
endif
ifeq ($(ZED_CAMERA), 1)
CFLAGS+= -DZED_STEREO -I/usr/local/zed/include
ifeq ($(ZED_CAMERA_v2_8), 1)
LDFLAGS+= -L/usr/local/zed/lib -lsl_core -lsl_input -lsl_zed
#-lstdc++ -D_GLIBCXX_USE_CXX11_ABI=0
else
LDFLAGS+= -L/usr/local/zed/lib -lsl_zed
#-lstdc++ -D_GLIBCXX_USE_CXX11_ABI=0
endif
endif
OBJ=sound.o http_stream.o gemm.o utils.o dark_cuda.o convolutional_layer.o list.o image.o activations.o im2col.o col2im.o blas.o crop_layer.o dropout_layer.o maxpool_layer.o softmax_layer.o data.o matrix.o network.o connected_layer.o cost_layer.o parser.o option_list.o darknet.o detection_layer.o captcha.o route_layer.o writing.o box.o nightmare.o normalization_layer.o avgpool_layer.o coco.o dice.o yolo.o detector.o layer.o compare.o classifier.o local_layer.o swag.o shortcut_layer.o activation_layer.o rnn_layer.o gru_layer.o rnn.o rnn_vid.o crnn_layer.o demo.o tag.o cifar.o go.o batchnorm_layer.o art.o region_layer.o reorg_layer.o reorg_old_layer.o super.o voxel.o tree.o yolo_layer.o gaussian_yolo_layer.o upsample_layer.o lstm_layer.o conv_lstm_layer.o scale_channels_layer.o sam_layer.o
ifeq ($(GPU), 1)
LDFLAGS+= -lstdc++
OBJ+=convolutional_kernels.o activation_kernels.o im2col_kernels.o col2im_kernels.o blas_kernels.o crop_layer_kernels.o dropout_layer_kernels.o maxpool_layer_kernels.o network_kernels.o avgpool_layer_kernels.o
endif
OBJS = $(addprefix $(OBJDIR), $(OBJ))
DEPS = $(wildcard src/*.h) Makefile include/darknet.h
all: $(OBJDIR) backup results $(EXEC) $(LIBNAMESO) $(APPNAMESO)
ifeq ($(LIBSO), 1)
CFLAGS+= -fPIC
$(LIBNAMESO): $(OBJDIR) $(OBJS) include/yolo_v2_class.hpp src/yolo_v2_class.cpp
$(CPP) -shared -std=c++11 -fvisibility=hidden -DLIB_EXPORTS $(COMMON) $(CFLAGS) $(OBJS) src/yolo_v2_class.cpp -o $# $(LDFLAGS)
$(APPNAMESO): $(LIBNAMESO) include/yolo_v2_class.hpp src/yolo_console_dll.cpp
$(CPP) -std=c++11 $(COMMON) $(CFLAGS) -o $# src/yolo_console_dll.cpp $(LDFLAGS) -L ./ -l:$(LIBNAMESO)
endif
$(EXEC): $(OBJS)
$(CPP) -std=c++11 $(COMMON) $(CFLAGS) $^ -o $# $(LDFLAGS)
$(OBJDIR)%.o: %.c $(DEPS)
$(CC) $(COMMON) $(CFLAGS) -c $< -o $#
$(OBJDIR)%.o: %.cpp $(DEPS)
$(CPP) -std=c++11 $(COMMON) $(CFLAGS) -c $< -o $#
$(OBJDIR)%.o: %.cu $(DEPS)
$(NVCC) $(ARCH) $(COMMON) --compiler-options "$(CFLAGS)" -c $< -o $#
$(OBJDIR):
mkdir -p $(OBJDIR)
backup:
mkdir -p backup
results:
mkdir -p results
setchmod:
chmod +x *.sh
.PHONY: clean
clean:
rm -rf $(OBJS) $(EXEC) $(LIBNAMESO) $(APPNAMESO)
I can compile all examples of boost:stacktrace. Here is my bash script:
#!/bin/bash
export CXX=~/x-tools/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-g++
export BOOST_INCLUDE=$HOME/x-libs/$($CXX -dumpmachine)/include
export BOOST_LIB=$HOME/x-libs/$($CXX -dumpmachine)/lib
export BOOST_SUFFIX="mt-d"
(ls $BOOST_LIB/*$BOOST_SUFFIX.a | tr "\n" "\0" | xargs -0 -n 1 basename | while read A; do B=-l$(echo $A | sed -e 's/^lib//' | sed -e 's/\.a//'); echo $B; done;) | tr "\n" " " > $BOOST_LIB/list_boost.txt
export BOOST_LIBS="cat $BOOST_LIB/list_boost.txt"
export EXECUTABLE_SUFFIX=""
$CXX -w -g3 -o assert_handler-$($CXX -dumpmachine)$EXECUTABLE_SUFFIX assert_handler.cpp -std=c++11 -static -I$BOOST_INCLUDE -L$BOOST_LIB $(eval $BOOST_LIBS) -ldl
$CXX -w -g3 -o debug_function-$($CXX -dumpmachine)$EXECUTABLE_SUFFIX debug_function.cpp -std=c++11 -static -I$BOOST_INCLUDE -L$BOOST_LIB $(eval $BOOST_LIBS) -ldl
$CXX -w -g3 -o terminate_handler-$($CXX -dumpmachine)$EXECUTABLE_SUFFIX terminate_handler.cpp -std=c++11 -static -I$BOOST_INCLUDE -L$BOOST_LIB $(eval $BOOST_LIBS) -ldl -lrt -lpthread
$CXX -w -g3 -o throwing_st-$($CXX -dumpmachine)$EXECUTABLE_SUFFIX throwing_st.cpp -std=c++11 -static -I$BOOST_INCLUDE -L$BOOST_LIB $(eval $BOOST_LIBS) -ldl
$CXX -w -g3 -o trace_addresses-$($CXX -dumpmachine)$EXECUTABLE_SUFFIX trace_addresses.cpp -std=c++11 -static -I$BOOST_INCLUDE -L$BOOST_LIB $(eval $BOOST_LIBS)
$CXX -w -g3 -o user_config-$($CXX -dumpmachine)$EXECUTABLE_SUFFIX user_config.cpp -std=c++11 -static -I$BOOST_INCLUDE -L$BOOST_LIB $(eval $BOOST_LIBS) -ldl
The generated boost list looks like this:
-lboost_atomic-mt-d -lboost_chrono-mt-d -lboost_container-mt-d -lboost_context-mt-d -lboost_coroutine-mt-d -lboost_date_time-mt-d -lboost_exception-mt-d -lboost_fiber-mt-d -lboost_filesystem-mt-d -lboost_graph-mt-d -lboost_iostreams-mt-d -lboost_locale-mt-d -lboost_log-mt-d -lboost_log_setup-mt-d -lboost_math_c99f-mt-d -lboost_math_c99l-mt-d -lboost_math_c99-mt-d -lboost_math_tr1f-mt-d -lboost_math_tr1l-mt-d -lboost_math_tr1-mt-d -lboost_prg_exec_monitor-mt-d -lboost_program_options-mt-d -lboost_random-mt-d -lboost_regex-mt-d -lboost_serialization-mt-d -lboost_signals-mt-d -lboost_stacktrace_addr2line-mt-d -lboost_stacktrace_basic-mt-d -lboost_stacktrace_noop-mt-d -lboost_system-mt-d -lboost_test_exec_monitor-mt-d -lboost_thread-mt-d -lboost_timer-mt-d -lboost_type_erasure-mt-d -lboost_unit_test_framework-mt-d -lboost_wave-mt-d -lboost_wserialization-mt-d
If I run an example it prints pointers:
./assert_handler-x86_64-unknown-linux-gnu
Expression 'i < N' is false in function 'T& boost::array<T, N>::operator[](boost::array<T, N>::size_type) [with T = int; long unsigned int N = 5ul; boost::array<T, N>::reference = int&; boost::array<T, N>::size_type = long unsigned int]': out of range.
Backtrace:
0# 0x00000000004019B2
1# 0x0000000000401B39
2# 0x0000000000400E3B
3# 0x0000000000400E6B
4# 0x0000000000400E44
5# 0x0000000000400E6B
6# 0x0000000000400E7C
7# 0x000000000045BF2B
8# 0x000000000045C1D1
9# 0x0000000000400CEA
Have I miss something?
Works for me now.
boost::stacktrace needs libbacktrace to print more than pointers
the compiler needs -lbacktrace -DBOOST_STACKTRACE_USE_BACKTRACE
The full line for compilation in the upper bash script example is then:
$CXX -w -g3 -o assert_handler-$($CXX -dumpmachine)$EXECUTABLE_SUFFIX assert_handler.cpp -std=c++11 -static -I$BOOST_INCLUDE -L$BOOST_LIB $(eval $BOOST_LIBS) -ldl -lbacktrace -DBOOST_STACKTRACE_USE_BACKTRACE
boost::stacktrace is new in the current Boost v1.65.1 and Debian Stretch that I use has only v1.62.0 and doesn't provide libbacktrace. So I had to download/compile these two on my own.
I cross compile for x86_64-unknown-linux-gnu and i686-w64-mingw32. It works for Linux but the mingw executables print almost nothing. I will investigate that and maybe post my results later here.
I am trying to compile a Qt project downloaded from Git hub. I got the following error during the compilation.
/bin/sh: 1: Syntax error: EOF in backquote substitution
make: * [mainwindow.o] Error 2
****08:33:27: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project FiniteElements (kit: Desktop)
When executing step 'Make'******
My .pro file is as below,
QT += core gui opengl widgets
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x000000`
TARGET = FiniteElements
TEMPLATE = app
LIBS += -lqwt
INCLUDEPATH += "/usr/include/qwt/"
SOURCES += main.cpp\
mainwindow.cpp \
FiniteElements.cpp \
graph_plot.cpp
HEADERS += mainwindow.h \
FiniteElements.h \
graph_plot.h
Can anyone help me?
Instructions tested on Ubuntu 16.04.1 LTS with qt5-default 5.5.1+dfsg-16ubuntu7 and libqwt-qt5-dev 6.1.2-5 installed:
Clone the repo:
$ git clone https://github.com/MKrishtop/FiniteElements.git
Cloning into 'FiniteElements'...
remote: Counting objects: 17, done.
remote: Total 17 (delta 0), reused 0 (delta 0), pack-reused 17
Unpacking objects: 100% (17/17), done.
Checking connectivity... done.
Port from Qt 4 to Qt 5:
$ cd FiniteElements/
$ find . -type f -exec sed -i 's/QtGui/QtWidgets/g' {} \;
$ find . -type f -exec sed -i 's/toAscii/toLocal8Bit/g' {} \;
$ sed -i 's/-lqwt/-lqwt-qt5/g' FiniteElements.pro
For the reference, here's the full diff:
$ git diff
diff --git a/FiniteElements.pro b/FiniteElements.pro
index a2edb50..610f9f7 100644
--- a/FiniteElements.pro
+++ b/FiniteElements.pro
## -8,7 +8,7 ## QT += core gui opengl
TARGET = FiniteElements
TEMPLATE = app
-LIBS += -lqwt
+LIBS += -lqwt-qt5
INCLUDEPATH += "/usr/include/qwt/"
diff --git a/graph_plot.h b/graph_plot.h
index 551941b..00cf205 100644
--- a/graph_plot.h
+++ b/graph_plot.h
## -1,7 +1,7 ##
#ifndef GRAPH_PLOT_H
#define GRAPH_PLOT_H
-#include <QtGui/QtGui>
+#include <QtWidgets/QtWidgets>
#include <QApplication>
#include <QString>
#include <qwt_plot.h>
diff --git a/main.cpp b/main.cpp
index 6bf7836..338bba0 100644
--- a/main.cpp
+++ b/main.cpp
## -1,4 +1,4 ##
-#include <QtGui/QApplication>
+#include <QtWidgets/QApplication>
#include <qwt_plot.h>
#include "mainwindow.h"
#include "FiniteElements.h"
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 1f0145f..2ecec7d 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
## -1,4 +1,4 ##
-#include <QtGui>
+#include <QtWidgets>
#include "mainwindow.h"
## -25,7 +25,7 ## void MainWindow::browse()
QString filepath = QFileDialog::getOpenFileName(this,tr("Select input datafile"),QDir::currentPath());
if (!filepath.isEmpty()) {
- std::string str = std::string(filepath.toAscii().data());
+ std::string str = std::string(filepath.toLocal8Bit().data());
const char * stuff = str.c_str();
A->SetFN(stuff);
A->evaluate();
diff --git a/mainwindow.h b/mainwindow.h
index fc8f0fb..4bcf0e1 100644
--- a/mainwindow.h
+++ b/mainwindow.h
## -3,7 +3,7 ##
#include <QDialog>
#include <QDir>
-#include <QtGui/QtGui>
+#include <QtWidgets/QtWidgets>
#include <QApplication>
#include <QString>
#include "FiniteElements.h"
Build:
$ qmake -v
QMake version 3.0
Using Qt version 5.5.1 in /usr/lib/x86_64-linux-gnu
$ qmake
$ make
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/include/qwt -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtOpenGL -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o main.o main.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/include/qwt -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtOpenGL -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o mainwindow.o mainwindow.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/include/qwt -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtOpenGL -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o FiniteElements.o FiniteElements.cpp
FiniteElements.cpp: In member function 'int FiniteElements::local_node()':
FiniteElements.cpp:185:6: warning: unused variable 'kf' [-Wunused-variable]
int kf=0,i=bpn,k=0;
^
FiniteElements.cpp:185:11: warning: unused variable 'i' [-Wunused-variable]
int kf=0,i=bpn,k=0;
^
FiniteElements.cpp:185:17: warning: unused variable 'k' [-Wunused-variable]
int kf=0,i=bpn,k=0;
^
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/include/qwt -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtOpenGL -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o graph_plot.o graph_plot.cpp
/usr/lib/x86_64-linux-gnu/qt5/bin/moc -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I/home/jpnurmi/Temp/FiniteElements -I/usr/include/qwt -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtOpenGL -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/include/c++/5 -I/usr/include/x86_64-linux-gnu/c++/5 -I/usr/include/c++/5/backward -I/usr/lib/gcc/x86_64-linux-gnu/5/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include mainwindow.h -o moc_mainwindow.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/include/qwt -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtOpenGL -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o moc_mainwindow.o moc_mainwindow.cpp
/usr/lib/x86_64-linux-gnu/qt5/bin/moc -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I/home/jpnurmi/Temp/FiniteElements -I/usr/include/qwt -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtOpenGL -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/include/c++/5 -I/usr/include/x86_64-linux-gnu/c++/5 -I/usr/include/c++/5/backward -I/usr/lib/gcc/x86_64-linux-gnu/5/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include graph_plot.h -o moc_graph_plot.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -isystem /usr/include/qwt -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtOpenGL -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -o moc_graph_plot.o moc_graph_plot.cpp
g++ -m64 -Wl,-O1 -o FiniteElements main.o mainwindow.o FiniteElements.o graph_plot.o moc_mainwindow.o moc_graph_plot.o -L/usr/X11R6/lib64 -lqwt-qt5 -lQt5OpenGL -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
$
I know I can run qmake from the command line and use:
-spec linux-g++-32
From the .pro file i've tried to add alternatively "-m32" or "-32" to "CFLAGS" or "QMAKE_CXXFLAGS" but it does not work.
CFLAGS += -m32
QMAKE_CXXFLAGS += -m32
What shall I do then ?
EDIT:
this is what is produced with the above flag...
g++ -c -pipe -m32 -g -Wall -W -D_REENTRANT -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_SHARED -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++ -I../fxa_march -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I. -I../fxa_march -I. -o fxa_march.o ../fxa_march/fxa_march.cpp
g++ -c -pipe -m32 -g -Wall -W -D_REENTRANT -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_SHARED -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++ -I../fxa_march -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I. -I../fxa_march -I. -o reports.o ../fxa_march/reports.cpp
g++ -c -pipe -m32 -g -Wall -W -D_REENTRANT -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_SHARED -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++ -I../fxa_march -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I. -I../fxa_march -I. -o fxa_march_params.o ../fxa_march/fxa_march_params.cpp
g++ -c -pipe -m32 -g -Wall -W -D_REENTRANT -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_SHARED -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++ -I../fxa_march -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I. -I../fxa_march -I. -o reportgroup.o ../fxa_march/reportgroup.cpp
g++ -c -pipe -m32 -g -Wall -W -D_REENTRANT -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_SHARED -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++ -I../fxa_march -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I. -I../fxa_march -I. -o db_wrapper.o ../fxa_march/db_wrapper.cpp
../fxa_march/db_wrapper.cpp: In function 'std::string as_string(FX::dbvalue, FX::dbtype)':
../fxa_march/db_wrapper.cpp:17: warning: enumeration value 'dbtype_dbvoid' not handled in switch
../fxa_march/db_wrapper.cpp:17: warning: enumeration value 'dbtype_dbdate' not handled in switch
../fxa_march/db_wrapper.cpp:17: warning: enumeration value 'dbtype_dbmoney' not handled in switch
g++ -Wl,-rpath,/Soft/fox_dev/Qt-4.7.4/lib -o fxa_march fxa_march.o reports.o fxa_march_params.o reportgroup.o db_wrapper.o -L/Soft/fox_dev/Qt-4.7.4/lib -L../../../fx/libfx -lfx -L../../../fx/MQLib -lMQ -L/Soft/fox_dev/boost/boost_bin/lib -lboost_timer -lboost_system -lboost_chrono -lboost_regex -L/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/lib -lxerces-c -lQtXmlPatterns -L/Soft/fox_dev/Qt-4.7.4/lib -lQtNetwork -lQtXml -lQtCore -lpthread
/usr/bin/ld: skipping incompatible ../../../fx/libfx/libfx.so when searching for -lfx
/usr/bin/ld: cannot find -lfx
collect2: ld returned 1 exit status
make: *** [fxa_march] Error 1
Ok, here is the point:
the diff between the generated makefile ( through QtCreator ) and the one generated by my command line is:
INCPATH = -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++-32 -I. -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I.
Vs
INCPATH = -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++ -I../fxa_march -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I. -I../fxa_march -I.
however one can go to "Project-> Build Settings -> [choose configuration to modify] -> And edit the "Qmake step" with additionnal argument:
-spec linux-g++-32
you will also need to add in the .pro file either of:
CFLAGS += -m32
QMAKE_CXXFLAGS += -m32
In .pro file, try writting all commands inside a scope prefixed by win32
win32 {
SOURCES += paintwidget_win.cpp
# ...
}
Commands inside the scope will be run only if the win32 variable is set.
I am triyng to implement Matlab in a c++ program. http://www.cl.cam.ac.uk/~sjeh3/wii/
The application is using gtk a wii mote lib and the Matlab Camera Calibration Toolbox (http://www.vision.caltech.edu/bouguetj/calib_doc/ ). it works perfectly.
I want to use matlab ploting tools to build a graphic provided by the application. But i am having issues building the app with matlab engine .
In the main.cpp i just added the code from the matlab example engdemo.cpp in the main function and included engine.h and mex.h.
Even with the examples like engdemo.cpp i always have this error :
mex: link of ' "...mexa64"' failed.
here are the console views:
root#ubuntu:/home/hugo/Bureau/sjeh3-wii/wmgui# ./build2
----------------------------------------------------------------
-> mbuildopts.sh sourced from directory (DIR = $HOME/.matlab/$REL_VERSION)
FILE = /root/.matlab/R2009b/mbuildopts.sh
----------------------------------------------------------------
-> TMW_ROOT = /home/hugo/Matlab
-> CC = g++-4.1
-> CC flags:
CFLAGS = -ansi -D_GNU_SOURCE -I/home/hugo/Matlab/extern/include/cpp -I/home/hugo/Matlab/extern/include -DUNIX -DX11 -DGLNXA64 -DGCC -pthread
CDEBUGFLAGS = -g
COPTIMFLAGS = -O -DNDEBUG
CLIBS = -Wl,-rpath-link,/home/hugo/Matlab/bin/glnxa64 -L/home/hugo/Matlab/runtime/glnxa64 -lmwmclmcrrt -lm
arguments =
-> LD = g++-4.1
-> Link flags:
LDFLAGS = -pthread
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
arguments = -L/usr/lib/ -L../toolbox -L../libcwiid -L../libcwiid -L/opt/gnome/lib64 -L/home/hugo/Matlab/bin/glnxa64 -L/home/hugo/Matlab/extern/include -L../../matlablibtest/toolbox
----------------------------------------------------------------
-> g++-4.1 -c -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng12 -I/opt/gnome/include/gtk-2.0 -I/usr/include/gtk-2.0 -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/gtk-2.0/include -I../libcwiid -I../toolbox -I/opt/matlab/extern/include -I/usr/lib -I/home/hugo/Matlab/extern/include -I/home/hugo/Matlab/bin/glnxa64 -ansi -D_GNU_SOURCE -I/home/hugo/Matlab/extern/include/cpp -I/home/hugo/Matlab/extern/include -DUNIX -DX11 -DGLNXA64 -DGCC -pthread -g "main.cpp"
-> g++-4.1 -c -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng12 -I/opt/gnome/include/gtk-2.0 -I/usr/include/gtk-2.0 -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/gtk-2.0/include -I../libcwiid -I../toolbox -I/opt/matlab/extern/include -I/usr/lib -I/home/hugo/Matlab/extern/include -I/home/hugo/Matlab/bin/glnxa64 -ansi -D_GNU_SOURCE -I/home/hugo/Matlab/extern/include/cpp -I/home/hugo/Matlab/extern/include -DUNIX -DX11 -DGLNXA64 -DGCC -pthread -g "interface.cpp"
-> g++-4.1 -c -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng12 -I/opt/gnome/include/gtk-2.0 -I/usr/include/gtk-2.0 -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/gtk-2.0/include -I../libcwiid -I../toolbox -I/opt/matlab/extern/include -I/usr/lib -I/home/hugo/Matlab/extern/include -I/home/hugo/Matlab/bin/glnxa64 -ansi -D_GNU_SOURCE -I/home/hugo/Matlab/extern/include/cpp -I/home/hugo/Matlab/extern/include -DUNIX -DX11 -DGLNXA64 -DGCC -pthread -g "support.cpp"
-> g++-4.1 -g -pthread -L/usr/lib/ -L../toolbox -L../libcwiid -L../libcwiid -L/opt/gnome/lib64 -L/home/hugo/Matlab/bin/glnxa64 -L/home/hugo/Matlab/extern/include -L../../matlablibtest/toolbox -o wmgui main.o interface.o support.o -Wl,-rpath-link,/home/hugo/Matlab/bin/glnxa64 -L/home/hugo/Matlab/runtime/glnxa64 -lmwmclmcrrt -lm -lcalib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lfreetype -lz -lfontconfig -lexpat -lglitz -lm -lpng12 -lXrender -lX11 -lpthread -lXau -lXdmcp -lgthread-2.0 -lglib-2.0 -lm -lcwiid
main.o: In function `main':
/home/hugo/Bureau/sjeh3-wii/wmgui/main.cpp:363: undefined reference to `engOpen'
/home/hugo/Bureau/sjeh3-wii/wmgui/main.cpp:367: undefined reference to `engEvalString'
collect2: ld returned 1 exit status
mbuild: link of 'wmgui' failed.
root#ubuntu:/home/hugo/Bureau/sjeh3-wii/wmgui# ./build2
-> mexopts.sh sourced from directory (DIR = $HOME/.matlab/$REL_VERSION)
FILE = /root/.matlab/R2009b/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /home/hugo/Matlab
-> CC = gcc-4.1
-> CC flags:
CFLAGS = -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread
CDEBUGFLAGS = -g
COPTIMFLAGS = -O -DNDEBUG
CLIBS = -Wl,-rpath-link,/home/hugo/Matlab/bin/glnxa64 -L/home/hugo/Matlab/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++
arguments = -DMX_COMPAT_32
-> CXX = g++-4.1
-> CXX flags:
CXXFLAGS = -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/home/hugo/Matlab/bin/glnxa64 -L/home/hugo/Matlab/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> FC = g95
-> FC flags:
FFLAGS = -fexceptions -fPIC -fno-omit-frame-pointer
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O
FLIBS = -Wl,-rpath-link,/home/hugo/Matlab/bin/glnxa64 -L/home/hugo/Matlab/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> LD = g++-4.1
-> Link flags:
LDFLAGS = -pthread -shared -Wl,--version-script,/home/hugo/Matlab/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
LDEXTENSION = .mexa64
arguments = -lang cpp -L/usr/lib/ -L../toolbox -L../libcwiid -lcalib -L../libcwiid -L/opt/gnome/lib64 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lfreetype -lz -lfontconfig -lexpat -lglitz -lm -lpng12 -lXrender -lX11 -lpthread -lXau -lXdmcp -lgthread-2.0 -lglib-2.0 -lm -lcwiid -L/home/hugo/Matlab/bin/glnxa64 -L/home/hugo/Matlab/extern/include -L../../matlablibtest/toolbox
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments = -lang cpp -L/usr/lib/ -L../toolbox -L../libcwiid -lcalib -L../libcwiid -L/opt/gnome/lib64 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lfreetype -lz -lfontconfig -lexpat -lglitz -lm -lpng12 -lXrender -lX11 -lpthread -lXau -lXdmcp -lgthread-2.0 -lglib-2.0 -lm -lcwiid -L/home/hugo/Matlab/bin/glnxa64 -L/home/hugo/Matlab/extern/include -L../../matlablibtest/toolbox
----------------------------------------------------------------
-> g++-4.1 -c -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng12 -I/opt/gnome/include/gtk-2.0 -I/usr/include/gtk-2.0 -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/gtk-2.0/include -I../libcwiid -I../toolbox -I/opt/matlab/extern/include -I/usr/lib -I/home/hugo/Matlab/extern/include -I/home/hugo/Matlab/bin/glnxa64 -I/home/hugo/Matlab/extern/include -I/home/hugo/Matlab/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_32 -g "main.cpp"
-> g++-4.1 -c -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng12 -I/opt/gnome/include/gtk-2.0 -I/usr/include/gtk-2.0 -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/gtk-2.0/include -I../libcwiid -I../toolbox -I/opt/matlab/extern/include -I/usr/lib -I/home/hugo/Matlab/extern/include -I/home/hugo/Matlab/bin/glnxa64 -I/home/hugo/Matlab/extern/include -I/home/hugo/Matlab/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_32 -g "interface.cpp"
-> g++-4.1 -c -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng12 -I/opt/gnome/include/gtk-2.0 -I/usr/include/gtk-2.0 -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/gtk-2.0/include -I../libcwiid -I../toolbox -I/opt/matlab/extern/include -I/usr/lib -I/home/hugo/Matlab/extern/include -I/home/hugo/Matlab/bin/glnxa64 -I/home/hugo/Matlab/extern/include -I/home/hugo/Matlab/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread -DMX_COMPAT_32 -g "support.cpp"
-> g++-4.1 -g -pthread -shared -Wl,--version-script,/home/hugo/Matlab/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -o "wmgui.mexa64" main.o interface.o support.o -lang cpp -L/usr/lib/ -L../toolbox -L../libcwiid -lcalib -L../libcwiid -L/opt/gnome/lib64 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lfreetype -lz -lfontconfig -lexpat -lglitz -lm -lpng12 -lXrender -lX11 -lpthread -lXau -lXdmcp -lgthread-2.0 -lglib-2.0 -lm -lcwiid -L/home/hugo/Matlab/bin/glnxa64 -L/home/hugo/Matlab/extern/include -L../../matlablibtest/toolbox -Wl,-rpath-link,/home/hugo/Matlab/bin/glnxa64 -L/home/hugo/Matlab/bin/glnxa64 -lmx -lmex -lmat -lm
g++-4.1: cpp: Aucun fichier ou dossier de ce type
mex: link of ' "wmgui.mexa64"' failed.
#!/bin/sh
(mex or mbuild) -v -g -output wmgui main.cpp interface.cpp support.cpp -lang cpp \
-L/usr/lib/ -L../toolbox -L../libcwiid -lcalib -L../libcwiid -L/opt/gnome/lib64 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lfreetype -lz -lfontconfig -lexpat -lglitz -lm -lpng12 -lXrender -lX11 -lpthread -lXau -lXdmcp -lgthread-2.0 -lglib-2.0 -lm -lcwiid -L/home/hugo/Matlab/bin/glnxa64 -L/home/hugo/Matlab/extern/include -L../../matlablibtest/toolbox \
-I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng12 -I/opt/gnome/include/gtk-2.0 -I/usr/include/gtk-2.0 -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/gtk-2.0/include -I../libcwiid -I../toolbox -I/opt/matlab/extern/include -I/usr/lib -I/home/hugo/Matlab/extern/include -I/home/hugo/Matlab/bin/glnxa64
I forgot to say that i wanted to use Matlab engine and not my c++ application in matlab. maybe it wasn't so clear. I don't think the program will work as a mex-file.
Sincerely,
Hugo
If found my issue. i was compiling my application using mexopts.sh conf and not engopts.sh
After the succeful compilation i had the Error Can't start Matlab engine. i just apt-get install csh. and it work.
Your linux build command is broken. the compiler is missing some paths to some library.
#!/bin/sh
(mex or mbuild) -v -g -output wmgui main.cpp interface.cpp support.cpp -lang cpp \
-L/usr/lib/ -L../toolbox -L../libcwiid -lcalib -L../libcwiid -L/opt/gnome/lib64 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lfreetype -lz -lfontconfig -lexpat -lglitz -lm -lpng12 -lXrender -lX11 -lpthread -lXau -lXdmcp -lgthread-2.0 -lglib-2.0 -lm -lcwiid -L/home/hugo/Matlab/bin/glnxa64 -L/home/hugo/Matlab/extern/include -L../../matlablibtest/toolbox \
-I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/libpng12 -I/opt/gnome/include/gtk-2.0 -I/usr/include/gtk-2.0 -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/gtk-2.0/include -I../libcwiid -I../toolbox -I/opt/matlab/extern/include -I/usr/lib -I/home/hugo/Matlab/extern/include -I/home/hugo/Matlab/bin/glnxa64
Normaly you should find your anwser in this line code !
Sincerely
Hugo