I am using UBUNTU 12.04 and trying to install multicube explorer for Design Space Exploration.
I am new with these makefile and linux internals.
I follow these steps for installation
./configure
make
and then I get error message. Following is the log (command line reformatted for readability).
root#root:/home/snu/Desktop/m3explorer# make
g++ -L. -L/usr/lib/x86_64-linux-gnu -lxml2 -ldl \
-Wl,--no-as-needed,-export-dynamic -pthread \
m3_commands.o m3_env.o m3_point.o m3_sim_utils.o \
m3_database.o m3_grammar.o m3_map.o m3_opt_utils.o \
m3_pointer_trash.o m3_tokens.o m3_object.o m3_shell.o \
m3_vector.o m3_driver_utils.o m3_parser.o m3_shell_variables.o \
m3_list.o m3_object_utils.o m3_arg.o m3_common_utils.o \
m3_exception.o m3_design_space.o m3_doe_utils.o m3_gen_html.o \
m3_xdr_api.o m3_rsm.o -o m3explorer
m3_commands.o: In function `prs_command_db_export_xml(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
m3_commands.cc:(.text+0x379c): undefined reference to `xmlKeepBlanksDefault'
m3_commands.cc:(.text+0x37a6): undefined reference to `xmlThrDefIndentTreeOutput'
m3_commands.cc:(.text+0x37b0): undefined reference to `xmlThrDefTreeIndentString'
m3_commands.cc:(.text+0x37ba): undefined reference to `xmlNewDoc'
m3_commands.cc:(.text+0x37d0): undefined reference to `xmlNewNode'
m3_commands.cc:(.text+0x37f0): undefined reference to `xmlNewProp'
m3_commands.cc:(.text+0x3809): undefined reference to `xmlNewProp'
m3_commands.cc:(.text+0x3822): undefined reference to `xmlDocSetRootElement'
m3_commands.cc:(.text+0x3a6c): undefined reference to `xmlNewChild'
m3_commands.cc:(.text+0x3a8b): undefined reference to `xmlNewChild'
m3_commands.cc:(.text+0x3aaa): undefined reference to `xmlNewChild'
m3_commands.cc:(.text+0x3aea): undefined reference to `xmlNewChild'
m3_commands.cc:(.text+0x3b19): undefined reference to `xmlNewProp'
m3_commands.cc:(.text+0x3cb2): undefined reference to `xmlNewChild'
m3_commands.cc:(.text+0x3d75): undefined reference to `xmlNewProp'
m3_commands.cc:(.text+0x3d98): undefined reference to `xmlNewProp'
m3_commands.cc:(.text+0x3e94): undefined reference to `xmlNewProp'
m3_commands.cc:(.text+0x3f30): undefined reference to `xmlNewChild'
m3_commands.cc:(.text+0x3f5f): undefined reference to `xmlNewProp'
m3_commands.cc:(.text+0x3fad): undefined reference to `xmlNewProp'
m3_commands.cc:(.text+0x407e): undefined reference to `xmlSaveFileEnc'
m3_opt_utils.o: In function `opt_select_optimizer(m3_env*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
m3_opt_utils.cc:(.text+0x51): undefined reference to `dlopen'
m3_opt_utils.cc:(.text+0x71): undefined reference to `dlsym'
m3_driver_utils.o: In function `drv_select_driver(m3_env*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
m3_driver_utils.cc:(.text+0x51): undefined reference to `dlopen'
m3_driver_utils.cc:(.text+0x71): undefined reference to `dlsym'
m3_driver_utils.cc:(.text+0x109): undefined reference to `dlerror'
m3_common_utils.o: In function `m3_look_for_filename_in_search_path(m3_env*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
m3_common_utils.cc:(.text+0x403): undefined reference to `dlopen'
m3_common_utils.cc:(.text+0x430): undefined reference to `dlclose'
m3_doe_utils.o: In function `doe_select_doe(m3_env*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)':
m3_doe_utils.cc:(.text+0x51): undefined reference to `dlopen'
m3_doe_utils.cc:(.text+0x71): undefined reference to `dlsym'
collect2: ld returned 1 exit status
make: *** [m3explorer] Error 1
Following is the makefile contents
# Makefile for Multicube Explorer
#
# (C) Politecnico di Milano and V. Zaccaria
DSTDIR = /home/snu/Desktop/m3explorer
SRCDIR = /home/snu/Desktop/m3explorer/src
INCDIR = /home/snu/Desktop/m3explorer/src
GPLDIR = /home/snu/Desktop/m3explorer/gpl
OTHERCFLAGS =
OTHERCXXFLAGS = -D__M3EXPLORER_VERSION__=\"release_1_1\" -I/usr/include/libxml2
OTHERLINKFLAGS = -L. -L/usr/lib/x86_64-linux-gnu -lxml2
GPLCXXFLAGS =
GPLLINKFLAGS =
IMAGE = /home/snu/Desktop/m3explorer/image
BUILDSHEPARD = no
BUILDSPLINE= no
BUILDNEURAL= nn
BUILDRBF= no
BUILDREGRESSION= no
CXX=g++
AR=ar cr
RANLIB=ranlib
SHLIB_LD=g++ -fPIC
CFLAGS= $(OTHERCFLAGS) -I$(INCDIR)
#CFLAGS= -Wall -g -I/usr/include/libxml2 commented by Tarun. If you want to uncomment. then comment next line
CXXFLAGS= $(OTHERCXXFLAGS) -I$(INCDIR)
#CXXFLAGS=-lxml2 commented by Tarun. If you want to uncomment. then comment next line
GPLCXXFLAGS += $(OTHERCXXFLAGS)
OS_NAME = $(shell uname -s)
ifeq ("$(OS_NAME)", "SunOS")
CXXFLAGS += -D__SOLARIS__
CXXSOFLAGS = -shared -fPIC
endif
ifeq ("$(OS_NAME)", "Darwin")
CXXFLAGS += -g -D__MAC_OSX__
CXXSOFLAGS = -fno-common -bundle -flat_namespace -undefined suppress
endif
ifeq ("$(OS_NAME)", "Linux")
CXXFLAGS += -pthread
CXXSOFLAGS = -g -shared -fPIC
OTHERLINKFLAGS += -ldl -Wl,--no-as-needed,-export-dynamic -pthread #--no-as-needed, is added by tarun
endif
#####################################
# CREATE SYMBOLIC TARGETS #
#####################################
M3EXPLORER_TARGETS = m3_commands.o m3_env.o m3_point.o m3_sim_utils.o m3_database.o m3_grammar.o m3_map.o m3_opt_utils.o m3_pointer_trash.o m3_tokens.o m3_object.o m3_shell.o m3_vector.o m3_driver_utils.o m3_parser.o m3_shell_variables.o m3_list.o m3_object_utils.o m3_arg.o m3_common_utils.o m3_exception.o m3_design_space.o m3_doe_utils.o m3_gen_html.o m3_xdr_api.o m3_rsm.o
M3EXPLORER_INCLUDES = m3_commands.h m3_driver_utils.h m3_list.h m3_object_utils.h m3_parser.h m3_shell_variables.h m3_database.h m3_env.h m3_map.h m3_opt_utils.h m3_point.h m3_sim_utils.h m3_driver.h m3_object.h m3_optimizer.h m3_pointer_trash.h m3_vector.h m3_arg.h m3_common_utils.h m3_exception.h m3_design_space.h m3_doe.h m3_doe_utils.h drivers/libm3_xml_driver.h m3_gen_html.h m3_xdr_api.h m3_rsm.h
M3EXPLORER_INCDIR_INCLUDES = $(patsubst %.h, $(INCDIR)/%.h, $(M3EXPLORER_INCLUDES))
OPTIMIZERS_SRC = libm3_pareto_doe.cc libm3_aprs.cc libm3_mosa.cc libm3_mopso.cc libm3_nsga_II.cc libm3_linear_scan.cc libm3_femo.cc libm3_semo.cc libm3_gemo.cc
OPTIMIZERS_TARGET = $(patsubst %.cc, %.so, $(OPTIMIZERS_SRC))
DOE_SRC = libm3_full_doe.cc libm3_random_doe.cc libm3_two_level_ff.cc libm3_two_level_ff_extended.cc libm3_scrambled_doe.cc
DOE_TARGET = $(patsubst %.cc, %.so, $(DOE_SRC))
DRIVERS_SRC = libm3_test_driver.cc libm3_xml_driver.cc libm3_dtlz_driver.cc
# libm3_counter_driver.cc
DRIVERS_TARGET = $(patsubst %.cc, %.so, $(DRIVERS_SRC))
# Tells make to search for sources into SRCDIR, SRCDIR/optimizers and SRCDIR/drivers
VPATH=$(SRCDIR):$(SRCDIR)/optimizers:$(SRCDIR)/drivers:$(SRCDIR)/doe:$(SRCDIR)/../gpl:$(SRCDIR)/../gpl/splines:$(SRCDIR)/../gpl/rbf
TARGET = m3explorer
#####################################
# CREATE RSM TARGETS #
#####################################
RSM_TARGETS=
ifeq ("$(BUILDSHEPARD)", "yes")
RSM_TARGETS += sh_i
CXXFLAGS += -D__M3_COMPILE_SHEPARD_RSM__
endif
ifeq ("$(BUILDSPLINE)", "yes")
RSM_TARGETS += spline
CXXFLAGS += -D__M3_COMPILE_SPLINE_RSM__
endif
ifeq ("$(BUILDNEURAL)", "yes")
RSM_TARGETS += nn
CXXFLAGS += -D__M3_COMPILE_NEURAL_RSM__
endif
ifeq ("$(BUILDRBF)", "yes")
RSM_TARGETS += rbf_interpolator
CXXFLAGS += -D__M3_COMPILE_RBF_RSM__
endif
ifeq ("$(BUILDREGRESSION)", "yes")
RSM_TARGETS += regressor
CXXFLAGS += -D__M3_COMPILE_REGRESSION_RSM__
endif
#####################################
# CREATE BUILD TARGETS #
#####################################
all: $(TARGET) $(OPTIMIZERS_TARGET) $(DRIVERS_TARGET) $(DOE_TARGET) $(RSM_TARGETS)
#############################
# ENGINE BUILD #
#############################
m3explorer: $(M3EXPLORER_TARGETS)
$(CXX) $(OTHERLINKFLAGS) $^ -o $#
%.o: %.cc $(M3EXPLORER_INCDIR_INCLUDES)
$(CXX) -c $< -o $# $(CXXFLAGS)
%.so: %.cc $(M3EXPLORER_INCDIR_INCLUDES)
$(CXX) $< -o $# $(CXXSOFLAGS) $(CXXFLAGS)
m3_grammar.o: $(SRCDIR)/m3_grammar.yy
cp $(SRCDIR)/m3_grammar.yy .
bison -d $(SRCDIR)/m3_grammar.yy -o bof.cc
cp bof*h* m3_grammar.h
cp bof*cc m3_grammar.cc
$(CXX) -c m3_grammar.cc -o $# $(CXXFLAGS)
m3_tokens.o: $(SRCDIR)/m3_tokens.ll
flex $(SRCDIR)/m3_tokens.ll
mv lex.yy.c m3_tokens.cc
$(CXX) -c m3_tokens.cc -o $# -I. $(CXXFLAGS)
#############################
# RSM BUILD #
#############################
XDR_DEPS= gpl_xdr_api.o gpl_xdr_api.h
gpl_xdr_api.o: gpl_xdr_api.cc gpl_xdr_api.h
$(CXX) -c $< -o $# $(GPLCXXFLAGS) -I$(GPLDIR)
sh_i: sh_i.cc $(XDR_DEPS)
$(CXX) -o gpl_xdr_api.o $# $< $(GPLCXXFLAGS) $(GPLLINKFLAGS) -I$(GPLDIR)
nn: cascade.c $(XDR_DEPS)
$(CXX) -o gpl_xdr_api.o -lpthread $# $< $(GPLCXXFLAGS) $(GPLLINKFLAGS) -I$(GPLDIR)
SPLINE_OBJ=converter.o parameters.o spline.o r_wrapper.o spline_script.o
SPLINE_INC=r_wrapper.hpp spline_script.hpp converter.hpp parameters.h
$(SPLINE_OBJ): %.o: %.cc $(SPLINE_INC)
$(CXX) -c $< -o $# $(GPLCXXFLAGS) -I$(GPLDIR)
spline: $(SPLINE_OBJ) $(XDR_DEPS)
$(CXX) -o $# $^ $(GPLCXXFLAGS) $(GPLLINKFLAGS) -I$(GPLDIR)
RBF_OBJ=bvp.o diff_op.o interpolator.o linalg.o utils.o ddm.o error.o func.o rbf.o interpolatorRBF.o
RBF_INC= bvp.hpp ddm.hpp diff_op.hpp error.hpp func.hpp interpolator.hpp linalg.hpp rbf.hpp utils.hpp
$(RBF_OBJ): %.o: %.cpp $(RBF_INC)
$(CXX) -c $< -o $# $(GPLCXXFLAGS) -I$(GPLDIR)
rbf_interpolator: $(RBF_OBJ) $(XDR_DEPS)
$(CXX) -o $# $^ $(GPLCXXFLAGS) $(GPLLINKFLAGS) -I$(GPLDIR)
regressor: regressor.cc $(XDR_DEPS)
$(CXX) -o gpl_xdr_api.o $# $< $(GPLCXXFLAGS) $(GPLLINKFLAGS) -I$(GPLDIR)
#############################
# CLEAN BUILD #
#############################
clean:
rm -f *.o $(TARGET) *.cc *.hh *.so *.h *.yy
rm -rf m3explorer* test*_output tmp
dist-clean:
rm -f *.o $(TARGET) *.cc *.hh *.so *.scr *.xml *.scr do_tests *.h *.yy doxygen.cfg makefile config.status
rm -rf m3explorer* test*_output tmp $(RSM_TARGETS)
ifeq ("$(OS_NAME)", "Darwin")
dist:
tar --directory $(SRCDIR)/../.. -c -v -z -f m3explorer_release_1_1_src.tar.gz m3explorer --exclude "*.svn*" --exclude "build"
endif
ifeq ("$(OS_NAME)", "Linux")
dist:
tar --exclude="*.svn*" --directory $(SRCDIR)/../.. -c -v -z -f m3explorer_release_1_1_src.tar.gz m3explorer
endif
doc:
doxygen $(DSTDIR)/doxygen.cfg
ifeq ("$(OS_NAME)", "Linux")
bin-dist: install doc
tar --exclude="*.svn*" --directory $(IMAGE)/.. -c -v -z -f m3explorer_release_1_1_linux_$(shell uname -r)_bin.tar.gz $(shell cd $(IMAGE) && pwd | xargs basename)
endif
ifeq ("$(OS_NAME)", "Linux")
doc-dist: install doc
tar --exclude="*.svn*" --directory $(IMAGE) -c -v -z -f m3explorer_release_1_1_docs.tar.gz $(shell cd $(IMAGE)/doc && pwd | xargs basename)
endif
#############################
# INSTALL BUILD #
#############################
# Note add: install -m 744 $(SRCDIR)/../tests/*.ref $(IMAGE)/tests
# install -m 744 $(SRCDIR)/../tests/stub_test.py $(IMAGE)/tests
install: all
#mkdir -p $(IMAGE)
#mkdir -p $(IMAGE)/bin
#mkdir -p $(IMAGE)/lib
#mkdir -p $(IMAGE)/schemas
#mkdir -p $(IMAGE)/scripts
#mkdir -p $(IMAGE)/examples
#mkdir -p $(IMAGE)/examples/simple_sim
#mkdir -p $(IMAGE)/examples/beverage_can
#mkdir -p $(IMAGE)/examples/mpeg
#mkdir -p $(IMAGE)/rsm
#mkdir -p $(IMAGE)/tests
#mkdir -p $(IMAGE)/html
#mkdir -p $(IMAGE)/latex
#mkdir -p $(IMAGE)/html/template_results_page_files
install -m 744 $(DSTDIR)/*.so $(IMAGE)/lib
install -m 744 $(DSTDIR)/multicube_design_space_test*.xml $(IMAGE)/tests
install -m 744 $(DSTDIR)/debug_*scr $(IMAGE)/tests
install -m 744 $(DSTDIR)/create_*scr $(IMAGE)/tests
install -m 744 $(DSTDIR)/do_tests $(IMAGE)/tests
install -m 744 $(SRCDIR)/../html/*.html $(IMAGE)/html
install -m 744 $(SRCDIR)/../latex/*.tex $(IMAGE)/latex
install -m 744 $(SRCDIR)/../html/template_results_page_files/* $(IMAGE)/html/template_results_page_files
install -m 744 $(SRCDIR)/../schemas/*.xsd $(IMAGE)/schemas
install -m 744 $(SRCDIR)/../scripts/*.scr $(IMAGE)/scripts
install -m 744 $(SRCDIR)/../scripts/*.xml $(IMAGE)/examples/mpeg
install -m 744 $(SRCDIR)/../scripts/full_*.gz $(IMAGE)/examples/mpeg
install -m 744 $(SRCDIR)/../scripts/*mpeg* $(IMAGE)/examples/mpeg
install -m 744 $(SRCDIR)/../tests/test*output.ref $(IMAGE)/tests
install -m 744 $(SRCDIR)/../tests/db7.xml.ref $(IMAGE)/tests
install -m 744 $(SRCDIR)/../tests/test_xml*.scr $(IMAGE)/tests
install -m 744 $(SRCDIR)/../tests/test_ff*.scr $(IMAGE)/tests
install -m 744 $(SRCDIR)/../tests/mpeg_dse.scr $(IMAGE)/tests
install -m 744 $(SRCDIR)/../tests/mpeg_export_xml.scr $(IMAGE)/tests
install -m 744 $(SRCDIR)/../tests/pareto_mpeg4.db $(IMAGE)/tests
install -m 744 $(SRCDIR)/../tests/stub_*.py $(IMAGE)/tests
install -m 744 $(SRCDIR)/../tests/simple_sim/simple_sim.py $(IMAGE)/examples/simple_sim
install -m 744 $(SRCDIR)/../tests/simple_sim/simple_sim_scr.scr $(IMAGE)/examples/simple_sim
install -m 744 $(DSTDIR)/simple_sim_ds.xml $(IMAGE)/examples/simple_sim
install -m 744 $(SRCDIR)/../tests/beverage_can/beverage_can.py $(IMAGE)/examples/beverage_can
install -m 744 $(SRCDIR)/../tests/beverage_can/beverage_can_scr.scr $(IMAGE)/examples/beverage_can
install -m 744 $(DSTDIR)/beverage_can_ds.xml $(IMAGE)/examples/beverage_can
install -m 744 $(SRCDIR)/../gpl/*xdr* $(IMAGE)/rsm
#mkdir -p $(IMAGE)/include
install -m 744 $(DSTDIR)/m3explorer $(IMAGE)/bin
#for hdr in $(INCDIR)/*.h ; do \
if cmp -s $$hdr $(IMAGE)/include/`basename $$hdr`; then : ; else \
echo "Installing $$hdr to $(IMAGE)/include"; \
install -m 644 $$hdr $(IMAGE)/include; \
fi; \
done
if [ -e $(DSTDIR)/sh_i ] ; then \
install -m 744 $(DSTDIR)/sh_i $(IMAGE)/rsm; \
fi ; \
if [ -e $(DSTDIR)/nn ] ; then \
install -m 744 $(DSTDIR)/nn $(IMAGE)/rsm; \
fi ; \
if [ -e $(DSTDIR)/spline ] ; then \
install -m 744 $(DSTDIR)/spline $(IMAGE)/rsm; \
fi ; \
if [ -e $(DSTDIR)/rbf_interpolator ] ; then \
install -m 744 $(DSTDIR)/rbf_interpolator $(IMAGE)/rsm; \
fi ; \
if [ -e $(DSTDIR)/regressor ] ; then \
install -m 744 $(DSTDIR)/regressor $(IMAGE)/rsm; \
fi ; \
chmod a+x $(IMAGE)/bin/*
chmod a+x $(IMAGE)/lib/*
chmod a+x $(IMAGE)/rsm/*
chmod a+x $(IMAGE)/tests/do_tests
install-doc: install doc
What can be the possible cause of error and how to solve it? I have checked with many earlier posts from blog. But couldn't solve it.
List libraries after the object files, not before them. Rewrite the build rule which is currently:
m3explorer: $(M3EXPLORER_TARGETS)
$(CXX) $(OTHERLINKFLAGS) $^ -o $#
as:
m3explorer: $(M3EXPLORER_TARGETS)
$(CXX) -o $# $^ $(OTHERLINKFLAGS)
Personally, I'd include $(CXXFLAGS) in the link line too:
m3explorer: $(M3EXPLORER_TARGETS)
$(CXX) $(CXXFLAGS) -o $# $^ $(OTHERLINKFLAGS)
Related
Good day.
I am attempting to compile a vulnerable vsftpd version for a University assignment. I'm having troubling compiling the source code onto the lxc container launched to host the vulnerable ftp server. The following message is spat at me when I attempt to execute the make command:
/usr/bin/ld: cannot find : No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile:24: vsftpd] Error 1
Despite my many years writing code I am quite new to C++ in general, however I gather this might have something to do with line 24 of the Makefile, which is highlighted below:
# Makefile for systems with GNU tools
CC = gcc
INSTALL = install
IFLAGS = -idirafter dummyinc
#CFLAGS = -g
CFLAGS = -O2 -Wall -W -Wshadow #-pedantic -Werror -Wconversion
LIBS = `./vsf_findlibs.sh`
LINK = -Wl,-s, -lcrypt
OBJS = main.o utility.o prelogin.o ftpcmdio.o postlogin.o privsock.o \
tunables.o ftpdataio.o secbuf.o ls.o \
postprivparent.o logging.o str.o netstr.o sysstr.o strlist.o \
banner.o filestr.o parseconf.o secutil.o \
ascii.o oneprocess.o twoprocess.o privops.o standalone.o hash.o \
tcpwrap.o ipaddrparse.o access.o features.o readwrite.o opts.o \
ssl.o sslslave.o ptracesandbox.o ftppolicy.o sysutil.o sysdeputil.o
.c.o:
$(CC) -c $*.c $(CFLAGS) $(IFLAGS)
vsftpd: $(OBJS)
24th line >>>> $(CC) -o vsftpd $(OBJS) $(LINK) $(LIBS) $(LDFLAGS)
install:
if [ -x /usr/local/sbin ]; then \
$(INSTALL) -m 755 vsftpd /usr/local/sbin/vsftpd; \
else \
$(INSTALL) -m 755 vsftpd /usr/sbin/vsftpd; fi
if [ -x /usr/local/man ]; then \
$(INSTALL) -m 644 vsftpd.8 /usr/local/man/man8/vsftpd.8; \
$(INSTALL) -m 644 vsftpd.conf.5 /usr/local/man/man5/vsftpd.conf.5; \
elif [ -x /usr/share/man ]; then \
$(INSTALL) -m 644 vsftpd.8 /usr/share/man/man8/vsftpd.8; \
$(INSTALL) -m 644 vsftpd.conf.5 /usr/share/man/man5/vsftpd.conf.5; \
else \
$(INSTALL) -m 644 vsftpd.8 /usr/man/man8/vsftpd.8; \
$(INSTALL) -m 644 vsftpd.conf.5 /usr/man/man5/vsftpd.conf.5; fi
if [ -x /etc/xinetd.d ]; then \
$(INSTALL) -m 644 xinetd.d/vsftpd /etc/xinetd.d/vsftpd; fi
clean:
rm -f *.o *.swp vsftpd
Despite my researching I do not understand how to resolve this.
Thanks in advance.
Installing the libmysqlclient should resolve this issue. On Ubuntu, run:
sudo apt-get install libmysqlclient-dev
I am trying to use Qt to make my cpp codes nicer to use. So I exploited the qmake -project to subsequently generate a Makefile. Nevertheless even with the simplest example, when executing the main.o file obtaining by typing make, I am getting bash: ./main.o: cannot execute binary file: Exec format error.
So I looked on the internet, and this problem is often related to architecture incompatibilities. That's why I exploited file main.o and uname -a commands in terminal. To my surprise, they respectively returned:
main.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
Linux mario-Inspiron-7577 4.15.0-64-generic #73-Ubuntu SMP Thu Sep 12 13:16:13 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Which to me doesn't seem to be conflicting. Am I missing out on something huge? What could I do to make it run smoothly?
If it can be of any help as suggested by #NathanOliver, here is my Makefile, generated with qmake:
#############################################################################
# Makefile for building: QTexample
# Generated by qmake (3.1) (Qt 5.9.5)
# Project: QTexample.pro
# Template: app
# Command: /home/mario/anaconda3/bin/qmake -o Makefile QTexample.pro
#############################################################################
MAKEFILE = Makefile
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
INCPATH = -I. -I. -I../../anaconda3/include/qt -I../../anaconda3/include/qt/QtWidgets -I../../anaconda3/include/qt/QtGui -I../../anaconda3/include/qt/QtCore -I. -I../../anaconda3/mkspecs/linux-g++
QMAKE = /home/mario/anaconda3/bin/qmake
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = cp -f
COPY_DIR = cp -f -R
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = cp -f -R
QINSTALL = /home/mario/anaconda3/bin/qmake -install qinstall
QINSTALL_PROGRAM = /home/mario/anaconda3/bin/qmake -install qinstall -exe
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
TAR = tar -cf
COMPRESS = gzip -9f
DISTNAME = QTexample1.0.0
DISTDIR = /home/mario/Tools/QTexample/.tmp/QTexample1.0.0
LINK = g++
LFLAGS = -Wl,-O1 -Wl,-rpath,/home/mario/anaconda3/lib
LIBS = $(SUBLIBS) -L/home/mario/anaconda3/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
AR = ar cqs
RANLIB =
SED = sed
STRIP = strip
####### Output directory
OBJECTS_DIR = ./
####### Files
SOURCES = main.cpp
OBJECTS = main.o
DIST = ../../anaconda3/mkspecs/features/spec_pre.prf \
../[...]
QTexample.pro main.cpp
QMAKE_TARGET = QTexample
DESTDIR =
TARGET = QTexample
first: all
####### Build rules
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: QTexample.pro ../../anaconda3/mkspecs/linux-g++/qmake.conf ../../anaconda3/mkspecs/features/spec_pre.prf \[...]
qmake: FORCE
#$(QMAKE) -o Makefile QTexample.pro
qmake_all: FORCE
all: Makefile $(TARGET)
dist: distdir FORCE
(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR)
distdir: FORCE
#test -d $(DISTDIR) || mkdir -p $(DISTDIR)
$(COPY_FILE) --parents $(DIST) $(DISTDIR)/
$(COPY_FILE) --parents ../../anaconda3/mkspecs/features/data/dummy.cpp $(DISTDIR)/
$(COPY_FILE) --parents main.cpp $(DISTDIR)/
clean: compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) .qmake.stash
-$(DEL_FILE) Makefile
####### Sub-libraries
mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
check: first
benchmark: first
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_moc_predefs_make_all: moc_predefs.h
compiler_moc_predefs_clean:
-$(DEL_FILE) moc_predefs.h
moc_predefs.h: ../../anaconda3/mkspecs/features/data/dummy.cpp
g++ -pipe -O2 -Wall -W -dM -E -o moc_predefs.h ../../anaconda3/mkspecs/features/data/dummy.cpp
compiler_moc_header_make_all:
compiler_moc_header_clean:
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all:
compiler_uic_clean:
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean: compiler_moc_predefs_clean
####### Compile
main.o: main.cpp ../../anaconda3/include/qt/QtWidgets/qapplication.h \[...]
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
#####
main: $(OBJS) $(CXX) $(LDFLAGS) -o main $(OBJS) $(LDLIBS)
####### Install
install: FORCE
uninstall: FORCE
FORCE:
I tried to cross-compile the following code:
//test.cpp
#include <QApplication>
#include <QWidget>
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QWidget window;
window.resize(250, 150);
window.setWindowTitle("Test");
window.show();
return app.exec();
}
following those instructions: Building Qt 5 on Linux, for Windows. I downloaded and built the source, created a Makefile and tried to build my project. after getting lot of undefined reference errors, I changed the includes to
#include "/home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/include/QtWidgets/QApplication"
#include "/home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/include/QtWidgets/QWidget"
and changed some paths in the Makefiles. But I am still getting lots of errors:
make
make -f Makefile.Release
make[1] : on entre dans le répertoire « /home/administrator/louis/buildwin »
/home/administrator/mxe/usr/bin/i686-w64-mingw32.static-g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=gnu++11 -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I. -I. -I../../mxe/usr/i686-w64-mingw32.static/qt5/include -I../../mxe/usr/i686-w64-mingw32.static/qt5/include/QtGui -I../../mxe/usr/i686-w64-mingw32.static/qt5/include/QtCore -Irelease -I../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/win32-g++ -o release/test.o test.cpp
/home/administrator/mxe/usr/bin/i686-w64-mingw32.static-g++ -Wl,-s -Wl,-subsystem,windows -mthreads -o release/buildwin.exe release/test.o release/buildwin_plugin_import.o -lglu32 -lmingw32 -L/home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libqtmain.a -L/home/administrator/mxe/usr/i686-w64-mingw32.static/lib -L/home/administrator/mxe/usr/i686-w64-mingw32.static/lib -L/home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/plugins/platforms /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/plugins/platforms/libqwindows.a -lwinspool /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5PlatformSupport.a /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5DBus.a -ldbus-1 -liphlpapi -ldbghelp -lnetapi32 -L/home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats/libqico.a /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Gui.a -lcomdlg32 -loleaut32 -limm32 -lopengl32 -ljpeg -lharfbuzz -lcairo -lgobject-2.0 -lfontconfig -lusp10 -lmsimg32 -lgdi32 -lpixman-1 -lffi -lexpat -lfreetype -lbz2 -lharfbuzz_too -lglib-2.0 -lwinmm -lshlwapi -lpcre -lintl -liconv -lpng16 /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Core.a -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmpr -lz -lpcre16
release/test.o:test.cpp:(.text+0x52): undefined reference to `QApplication::QApplication(int&, char**, int)'
release/test.o:test.cpp:(.text+0x73): undefined reference to `QWidget::QWidget(QWidget*, QFlags<Qt::WindowType>)'
release/test.o:test.cpp:(.text+0x99): undefined reference to `QWidget::resize(QSize const&)'
release/test.o:test.cpp:(.text+0xc8): undefined reference to `QWidget::setWindowTitle(QString const&)'
release/test.o:test.cpp:(.text+0xee): undefined reference to `QWidget::show()'
release/test.o:test.cpp:(.text+0xf3): undefined reference to `QApplication::exec()'
release/test.o:test.cpp:(.text+0xfe): undefined reference to `QWidget::~QWidget()'
release/test.o:test.cpp:(.text+0x106): undefined reference to `QApplication::~QApplication()'
release/test.o:test.cpp:(.text+0x177): undefined reference to `QWidget::~QWidget()'
release/test.o:test.cpp:(.text+0x17f): undefined reference to `QApplication::~QApplication()'
collect2: error: ld returned 1 exit status
Makefile.Release:62 : la recette pour la cible « release/buildwin.exe » a échouée
make[1]: *** [release/buildwin.exe] Erreur 1
make[1] : on quitte le répertoire « /home/administrator/louis/buildwin »
Makefile:34 : la recette pour la cible « release » a échouée
make: *** [release] Erreur 2
Those are the Makefiles. I only modified a few paths
in Makefile:
# Makefile for building: buildwin
# Generated by qmake (3.0) (Qt 5.7.1)
# Project: buildwin.pro
# Template: app
# Command: /home/administrator/mxe/usr/bin/i686-w64-mingw32.static-qmake-qt5 -o Makefile buildwin.pro
MAKEFILE = Makefile
first: release
install: release-install
uninstall: release-uninstall
QMAKE = /home/administrator/mxe/usr/bin/i686-w64-mingw32.static-qmake-qt5
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = cp -f
COPY_DIR = cp -f -R
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = cp -f -R
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
SUBTARGETS = \
release \
debug
release: FORCE
$(MAKE) -f $(MAKEFILE).Release
release-make_first: FORCE
$(MAKE) -f $(MAKEFILE).Release
release-all: FORCE
$(MAKE) -f $(MAKEFILE).Release all
release-clean: FORCE
$(MAKE) -f $(MAKEFILE).Release clean
release-distclean: FORCE
$(MAKE) -f $(MAKEFILE).Release distclean
release-install: FORCE
$(MAKE) -f $(MAKEFILE).Release install
release-uninstall: FORCE
$(MAKE) -f $(MAKEFILE).Release uninstall
debug: FORCE
$(MAKE) -f $(MAKEFILE).Debug
debug-make_first: FORCE
$(MAKE) -f $(MAKEFILE).Debug
debug-all: FORCE
$(MAKE) -f $(MAKEFILE).Debug all
debug-clean: FORCE
$(MAKE) -f $(MAKEFILE).Debug clean
debug-distclean: FORCE
$(MAKE) -f $(MAKEFILE).Debug distclean
debug-install: FORCE
$(MAKE) -f $(MAKEFILE).Debug install
debug-uninstall: FORCE
$(MAKE) -f $(MAKEFILE).Debug uninstall
Makefile: buildwin.pro ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/win32-g++/qmake.conf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/spec_pre.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/qdevice.pri \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/device_config.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/common/angle.conf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/qconfig.pri \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_concurrent.pri \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \
###I shortened here to fit the 30k limit...
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qwindows.pri \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_windowsprintersupport.pri \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/qt_functions.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/qt_config.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/qt_config.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/win32-g++/qmake.conf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/spec_post.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/exclusive_builds.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/toolchain.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/default_pre.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/default_pre.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/resolve_config.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/exclusive_builds_post.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/default_post.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/rtti.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/precompile_header.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/warn_on.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/qt.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/resources.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/moc.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/opengl.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/file_copies.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/windows.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/testcase_targets.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/exceptions.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/yacc.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/lex.prf \
buildwin.pro \
../../mxe/usr/i686-w64-mingw32.static/qt5/lib/qtmain.prl \
../../mxe/usr/i686-w64-mingw32.static/qt5/lib/Qt5Gui.prl \
../../mxe/usr/i686-w64-mingw32.static/qt5/lib/Qt5Core.prl \
../../mxe/usr/i686-w64-mingw32.static/qt5/plugins/platforms/qwindows.prl \
../../mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats/qico.prl
$(QMAKE) -o Makefile buildwin.pro
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/spec_pre.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/qdevice.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/device_config.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/common/angle.conf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/qconfig.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_concurrent.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_concurrent_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_core.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_core_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_dbus.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_dbus_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_gui.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_gui_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_network.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_network_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_opengl.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_opengl_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_openglextensions.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_platformsupport_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_printsupport.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_printsupport_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_sql.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_sql_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_testlib.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_testlib_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_widgets.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_widgets_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_xml.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_xml_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_zlib_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qgenericbearer.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qico.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qminimal.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qnativewifibearer.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqlite.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqlmysql.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqlodbc.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqlpsql.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqltds.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qtuiotouchplugin.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qwindows.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_windowsprintersupport.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/qt_functions.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/qt_config.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/qt_config.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/win32-g++/qmake.conf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/spec_post.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/exclusive_builds.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/toolchain.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/default_pre.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/default_pre.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/resolve_config.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/exclusive_builds_post.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/default_post.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/rtti.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/precompile_header.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/warn_on.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/qt.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/resources.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/moc.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/opengl.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/file_copies.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/windows.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/testcase_targets.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/exceptions.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/yacc.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/lex.prf:
buildwin.pro:
../../mxe/usr/i686-w64-mingw32.static/qt5/lib/qtmain.prl:
../../mxe/usr/i686-w64-mingw32.static/qt5/lib/Qt5Gui.prl:
../../mxe/usr/i686-w64-mingw32.static/qt5/lib/Qt5Core.prl:
../../mxe/usr/i686-w64-mingw32.static/qt5/plugins/platforms/qwindows.prl:
../../mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats/qico.prl:
qmake: FORCE
#$(QMAKE) -o Makefile buildwin.pro
qmake_all: FORCE
make_first: release-make_first debug-make_first FORCE
all: release-all debug-all FORCE
clean: release-clean debug-clean FORCE
distclean: release-distclean debug-distclean FORCE
-$(DEL_FILE) Makefile
-$(DEL_FILE) /home/administrator/louis/buildwin/buildwin_plugin_import.cpp
release-mocclean:
$(MAKE) -f $(MAKEFILE).Release mocclean
debug-mocclean:
$(MAKE) -f $(MAKEFILE).Debug mocclean
mocclean: release-mocclean debug-mocclean
release-mocables:
$(MAKE) -f $(MAKEFILE).Release mocables
debug-mocables:
$(MAKE) -f $(MAKEFILE).Debug mocables
mocables: release-mocables debug-mocables
check: first
benchmark: first
FORCE:
$(MAKEFILE).Release: Makefile
$(MAKEFILE).Debug: Makefile
in Makefile.Release:
# Makefile for building: buildwin
# Generated by qmake (3.0) (Qt 5.7.1)
# Project: buildwin.pro
# Template: app
MAKEFILE = Makefile.Release
## Compiler, tools and options
CC = /home/administrator/mxe/usr/bin/i686-w64-mingw32.static-gcc
CXX = /home/administrator/mxe/usr/bin/i686-w64-mingw32.static-g++
DEFINES = -DUNICODE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN
CFLAGS = -pipe -fno-keep-inline-dllexport -O2 -Wall -Wextra $(DEFINES)
CXXFLAGS = -pipe -fno-keep-inline-dllexport -O2 -std=gnu++11 -frtti -Wall -Wextra -fexceptions -mthreads $(DEFINES)
INCPATH = -I. -I. -I../../mxe/usr/i686-w64-mingw32.static/qt5/include -I../../mxe/usr/i686-w64-mingw32.static/qt5/include/QtGui -I../../mxe/usr/i686-w64-mingw32.static/qt5/include/QtCore -Irelease -I../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/win32-g++
LINKER = /home/administrator/mxe/usr/bin/i686-w64-mingw32.static-g++
LFLAGS = -Wl,-s -Wl,-subsystem,windows -mthreads
LIBS = -lglu32 -lmingw32 -L/home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libqtmain.a -L/home/administrator/mxe/usr/i686-w64-mingw32.static/lib -L/home/administrator/mxe/usr/i686-w64-mingw32.static/lib -L/home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/plugins/platforms /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/plugins/platforms/libqwindows.a -lwinspool /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5PlatformSupport.a /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5DBus.a -ldbus-1 -liphlpapi -ldbghelp -lnetapi32 -L/home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats/libqico.a /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Gui.a -lcomdlg32 -loleaut32 -limm32 -lopengl32 -ljpeg -lharfbuzz -lcairo -lgobject-2.0 -lfontconfig -lusp10 -lmsimg32 -lgdi32 -lpixman-1 -lffi -lexpat -lfreetype -lbz2 -lharfbuzz_too -lglib-2.0 -lwinmm -lshlwapi -lpcre -lintl -liconv -lpng16 /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Core.a -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmpr -lz -lpcre16
QMAKE = /home/administrator/mxe/usr/bin/i686-w64-mingw32.static-qmake-qt5
IDC = idc
IDL = midl
ZIP =
DEF_FILE =
RES_FILE =
COPY = cp -f
SED = sed
COPY_FILE = cp -f
COPY_DIR = cp -f -R
DEL_FILE = rm -f
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = cp -f -R
### Output directory
OBJECTS_DIR = release/
### Files
SOURCES = test.cpp /home/administrator/louis/buildwin/buildwin_plugin_import.cpp
OBJECTS = release/test.o \
release/buildwin_plugin_import.o
DIST = test.cpp
QMAKE_TARGET = buildwin
DESTDIR = release/ #avoid trailing-slash linebreak
TARGET = buildwin.exe
DESTDIR_TARGET = release/buildwin.exe
## Build rules
first: all
all: Makefile.Release $(DESTDIR_TARGET)
$(DESTDIR_TARGET): /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Gui.a /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Core.a $(OBJECTS)
$(LINKER) $(LFLAGS) -o $(DESTDIR_TARGET) $(OBJECTS) $(LIBS)
qmake: FORCE
#$(QMAKE) -o Makefile.Release buildwin.pro
qmake_all: FORCE
dist:
$(ZIP) buildwin.zip $(SOURCES) $(DIST) buildwin.pro ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/spec_pre.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/qdevice.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/device_config.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/common/angle.conf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/qconfig.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_concurrent.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_concurrent_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_core.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_core_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_dbus.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_dbus_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_gui.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_gui_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_network.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_network_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_opengl.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_opengl_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_openglextensions.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_platformsupport_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_printsupport.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_printsupport_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_sql.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_sql_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_testlib.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_testlib_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_widgets.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_widgets_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_xml.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_xml_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_zlib_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qgenericbearer.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qico.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qminimal.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qnativewifibearer.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqlite.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqlmysql.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqlodbc.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqlpsql.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqltds.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qtuiotouchplugin.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qwindows.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_windowsprintersupport.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/qt_functions.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/qt_config.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/qt_config.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/win32-g++/qmake.conf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/spec_post.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/exclusive_builds.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/toolchain.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/default_pre.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/default_pre.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/resolve_config.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/exclusive_builds_post.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/default_post.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/build_pass.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/rtti.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/precompile_header.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/warn_on.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/qt.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/resources.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/moc.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/opengl.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/file_copies.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/windows.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/testcase_targets.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/exceptions.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/yacc.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/lex.prf buildwin.pro ../../mxe/usr/i686-w64-mingw32.static/qt5/lib/qtmain.prl ../../mxe/usr/i686-w64-mingw32.static/qt5/lib/Qt5Gui.prl ../../mxe/usr/i686-w64-mingw32.static/qt5/lib/Qt5Core.prl ../../mxe/usr/i686-w64-mingw32.static/qt5/plugins/platforms/qwindows.prl ../../mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats/qico.prl NO_PCH_SOURCES RESOURCES HEADERS SOURCES OBJECTIVE_SOURCES YACCSOURCES YACCSOURCES LEXSOURCES
clean: compiler_clean
-$(DEL_FILE) release/test.o release/buildwin_plugin_import.o
distclean: clean
-$(DEL_FILE) /home/administrator/louis/buildwin/buildwin_plugin_import.cpp
-$(DEL_FILE) $(DESTDIR_TARGET)
-$(DEL_FILE) Makefile.Release
mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
check: first
benchmark: first
compiler_no_pch_compiler_make_all:
compiler_no_pch_compiler_clean:
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_moc_header_make_all:
compiler_moc_header_clean:
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean:
####### Compile
release/test.o: test.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/test.o test.cpp
release/buildwin_plugin_import.o: /home/administrator/louis/buildwin/buildwin_plugin_import.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/buildwin_plugin_import.o /home/administrator/louis/buildwin/buildwin_plugin_import.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:
Probably it is just a simple include mistake, or a wrong line in the makefiles
Thanks in advance for help
I have written below Makefile and as per answer to this question added rules for header file dependencies but it is not working. I did a clean and then build. After that I modified Parse.h using touch command and ran "make all" it says Test.exe is up to date. I got same output with just "make" command too.
Can anyone please let me know where am I gone wrong.
RM := rm -rf
MKDIR := mkdir -p
FIND := find
CPIO := cpio
CD := cd
MV := mv
# Set compiler flags
ifeq ($(BUILD_TYPE),DEBUG)
COMPILE_FLAGS= -c -fpic -DDBG=1 -g -DUSE_UTLPATMAT=1 -Wall
else ifeq ($(BUILD_TYPE),RELEASE)
COMPILE_FLAGS= -c -fpic -O3 -DUSE_UTLPATMAT=1 -Wall
else ifeq ($(BUILD_TYPE),PERF)
COMPILE_FLAGS= -c -fpic -O3 -DUSE_UTLPATMAT=1 -DPERF_COMPONENT -Wall
else
COMPILE_FLAGS= -c -fpic -O3 -DUSE_UTLPATMAT=1 -Wall
endif
export STFP_HOME = $(shell cd "$(CURDIR)/.."; pwd)
STFP_LIB = $(STFP_HOME)/lib
STFP_BIN = $(STFP_HOME)/bin
$(shell mkdir -p ${STFP_LIB})
$(shell mkdir -p ${STFP_BIN})
STFP_INC = $(CURDIR)/SP
SPTEST_SRC = $(CURDIR)/SPTest
SPTEST_INC = $(CURDIR)/SPTest
STFP_SRC = $(CURDIR)/SP
STFP_INC = $(CURDIR)/SP
UTILITIES_SRC_DIR = $(CURDIR)/../utilities
LIBS= -L${CLIENT_LIB}
INCS_DIRS= -I${CLIENT_INC}
#Subdivision Publisher Test
SPTESTSRCS=\
$(SPTEST_SRC)/Parse.cpp \
$(SPTEST_SRC)/Main.cpp
SPTESTOBJS=$(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SPTESTSRCS)))
all := $(STFP_BIN)/Test.exe
#################### Main targets #####################################
all:$(all)
clean:
find $(STFP_SRC)/ -name "*.o" | xargs rm -rf
find $(SPTEST_SRC)/ -name "*.o" | xargs rm -rf
rm -rf $(STFP_LIB)
rm -rf $(STFP_BIN)
#######################################################################
$(STFP_BIN)/Test.exe: $(SPTESTOBJS)
$(CXX) -g $(INCS_DIRS) \
$(SPTESTOBJS) -o $# \
$(LIBS) -lmodpbase64 -lboost_regex -lboost_filesystem -lboost_system -lboost_serialization \
-lutility
%.o : %.cpp
$(CXX) -DPROVIDE_LOG_UTILITIES $(COMPILE_FLAGS) $(INCS_DIRS) -o $# $<
%.o : %.c
$(CC) -DPROVIDE_LOG_UTILITIES $(COMPILE_FLAGS) $(INCS_DIRS) -o $# $<
################# Dependencies #########################
depend: .depend
.depend: $(SPTESTSRCS)
rm -f .depend
$(CXX) -DPROVIDE_LOG_UTILITIES $(COMPILE_FLAGS) $(INCS_DIRS) -MM -$(SPTESTSRCS) > .depend
-include .depend
########################################################
Thanks
You seem to expect .o files in SPTest. You could do so by using:
SPTest/%.o: SPTest/%.cpp
$(CXX) -DPROVIDE_LOG_UTILITIES $(COMPILE_FLAGS) $(INCS_DIRS) -o $# $<
OR by using (where #D is directory and #F is filename):
%.o : %.cpp
$(CXX) -DPROVIDE_LOG_UTILITIES $(COMPILE_FLAGS) $(INCS_DIRS) -o $(#D)/$(#F) $<
Let me know if you still get errors.
I am trying to install xgboost on Mac. I followed the instructions on github, but when I run make -j4 I get an error:
c++ -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -DDISABLE_OPENMP -o xgboost build/cli_main.o build/learner.o build/logging.o build/c_api/c_api.o build/c_api/c_api_error.o build/common/common.o build/data/data.o build/data/simple_csr_source.o build/data/simple_dmatrix.o build/data/sparse_page_dmatrix.o build/data/sparse_page_raw_format.o build/data/sparse_page_source.o build/data/sparse_page_writer.o build/gbm/gblinear.o build/gbm/gbm.o build/gbm/gbtree.o build/metric/elementwise_metric.o build/metric/metric.o build/metric/multiclass_metric.o build/metric/rank_metric.o build/objective/multiclass_obj.o build/objective/objective.o build/objective/rank_obj.o build/objective/regression_obj.o build/tree/tree_model.o build/tree/tree_updater.o build/tree/updater_colmaker.o build/tree/updater_histmaker.o build/tree/updater_prune.o build/tree/updater_refresh.o build/tree/updater_skmaker.o build/tree/updater_sync.o dmlc-core/libdmlc.a rabit/lib/librabit_empty.a -pthread -lm
ar crv lib/libxgboost.a
c++ -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -Idmlc-core/include -Irabit/include -fPIC -DDISABLE_OPENMP -shared -o lib/libxgboost.so build/learner.o build/logging.o build/c_api/c_api.o build/c_api/c_api_error.o build/common/common.o build/data/data.o build/data/simple_csr_source.o build/data/simple_dmatrix.o build/data/sparse_page_dmatrix.o build/data/sparse_page_raw_format.o build/data/sparse_page_source.o build/data/sparse_page_writer.o build/gbm/gblinear.o build/gbm/gbm.o build/gbm/gbtree.o build/metric/elementwise_metric.o build/metric/metric.o build/metric/multiclass_metric.o build/metric/rank_metric.o build/objective/multiclass_obj.o build/objective/objective.o build/objective/rank_obj.o build/objective/regression_obj.o build/tree/tree_model.o build/tree/tree_updater.o build/tree/updater_colmaker.o build/tree/updater_histmaker.o build/tree/updater_prune.o build/tree/updater_refresh.o build/tree/updater_skmaker.o build/tree/updater_sync.o dmlc-core/libdmlc.a rabit/lib/librabit_empty.a -pthread -lm
ar: no archive members specified
usage: ar -d [-TLsv] archive file ...
ar -m [-TLsv] archive file ...
ar -m [-abiTLsv] position archive file ...
ar -p [-TLsv] archive [file ...]
ar -q [-cTLsv] archive file ...
ar -r [-cuTLsv] archive file ...
ar -r [-abciuTLsv] position archive file ...
ar -t [-TLsv] archive [file ...]
ar -x [-ouTLsv] archive [file ...]
make: *** [lib/libxgboost.a] Error 1
make: *** Waiting for unfinished jobs....
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pthread'
If I run just make (without -j4) I get:
$ make
ar crv lib/libxgboost.a
ar: no archive members specified
usage: ar -d [-TLsv] archive file ...
ar -m [-TLsv] archive file ...
ar -m [-abiTLsv] position archive file ...
ar -p [-TLsv] archive [file ...]
ar -q [-cTLsv] archive file ...
ar -r [-cuTLsv] archive file ...
ar -r [-abciuTLsv] position archive file ...
ar -t [-TLsv] archive [file ...]
ar -x [-ouTLsv] archive [file ...]
make: *** [lib/libxgboost.a] Error 1
Any idea what is causing this and how I can fix it?
Although I might be wrong I think is because archive utility ar on mac is too old (from 2005):
$ man ar
AR(1) BSD General Commands Manual AR(1)
NAME
ar -- create and maintain library archives
SYNOPSIS
...
...
Darwin July 27, 2005 Darwin
Any ideas how to update ar to the newest version on OS X?
Here is the makefile for your reference:
ifndef config
ifneq ("$(wildcard ./config.mk)","")
config = config.mk
else
config = make/config.mk
endif
endif
ifndef DMLC_CORE
DMLC_CORE = dmlc-core
endif
ifndef RABIT
RABIT = rabit
endif
ROOTDIR = $(CURDIR)
ifeq ($(OS), Windows_NT)
UNAME="Windows"
else
UNAME=$(shell uname)
endif
include $(config)
ifeq ($(USE_OPENMP), 0)
export NO_OPENMP = 1
endif
include $(DMLC_CORE)/make/dmlc.mk
# include the plugins
include $(XGB_PLUGINS)
# use customized config file
ifndef CC
export CC = $(if $(shell which gcc-5),gcc-5,gcc)
endif
ifndef CXX
export CXX = $(if $(shell which g++-5),g++-5,g++)
endif
export LDFLAGS= -pthread -lm $(ADD_LDFLAGS) $(DMLC_LDFLAGS) $(PLUGIN_LDFLAGS)
export CFLAGS= -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude $(ADD_CFLAGS) $(PLUGIN_CFLAGS)
CFLAGS += -I$(DMLC_CORE)/include -I$(RABIT)/include
#java include path
export JAVAINCFLAGS = -I${JAVA_HOME}/include -I./java
ifndef LINT_LANG
LINT_LANG= "all"
endif
ifneq ($(UNAME), Windows)
CFLAGS += -fPIC
XGBOOST_DYLIB = lib/libxgboost.so
else
XGBOOST_DYLIB = lib/libxgboost.dll
endif
ifeq ($(UNAME), Linux)
LDFLAGS += -lrt
JAVAINCFLAGS += -I${JAVA_HOME}/include/linux
endif
ifeq ($(UNAME), Darwin)
JAVAINCFLAGS += -I${JAVA_HOME}/include/darwin
endif
ifeq ($(USE_OPENMP), 1)
CFLAGS += -fopenmp
else
CFLAGS += -DDISABLE_OPENMP
endif
# specify tensor path
.PHONY: clean all lint clean_all doxygen rcpplint pypack Rpack Rbuild Rcheck java
all: lib/libxgboost.a $(XGBOOST_DYLIB) xgboost
$(DMLC_CORE)/libdmlc.a: $(wildcard $(DMLC_CORE)/src/*.cc $(DMLC_CORE)/src/*/*.cc)
+ cd $(DMLC_CORE); make libdmlc.a config=$(ROOTDIR)/$(config); cd $(ROOTDIR)
$(RABIT)/lib/$(LIB_RABIT): $(wildcard $(RABIT)/src/*.cc)
+ cd $(RABIT); make lib/$(LIB_RABIT); cd $(ROOTDIR)
jvm: jvm-packages/lib/libxgboost4j.so
SRC = $(wildcard src/*.cc src/*/*.cc)
ALL_OBJ = $(patsubst src/%.cc, build/%.o, $(SRC)) $(PLUGIN_OBJS)
AMALGA_OBJ = amalgamation/xgboost-all0.o
LIB_DEP = $(DMLC_CORE)/libdmlc.a $(RABIT)/lib/$(LIB_RABIT)
ALL_DEP = $(filter-out build/cli_main.o, $(ALL_OBJ)) $(LIB_DEP)
CLI_OBJ = build/cli_main.o
build/%.o: src/%.cc
#mkdir -p $(#D)
$(CXX) $(CFLAGS) -MM -MT build/$*.o $< >build/$*.d
$(CXX) -c $(CFLAGS) -c $< -o $#
build_plugin/%.o: plugin/%.cc
#mkdir -p $(#D)
$(CXX) $(CFLAGS) -MM -MT build_plugin/$*.o $< >build_plugin/$*.d
$(CXX) -c $(CFLAGS) -c $< -o $#
# The should be equivalent to $(ALL_OBJ) except for build/cli_main.o
amalgamation/xgboost-all0.o: amalgamation/xgboost-all0.cc
$(CXX) -c $(CFLAGS) -c $< -o $#
# Equivalent to lib/libxgboost_all.so
lib/libxgboost_all.so: $(AMALGA_OBJ) $(LIB_DEP)
#mkdir -p $(#D)
$(CXX) $(CFLAGS) -shared -o $# $(filter %.o %.a, $^) $(LDFLAGS)
lib/libxgboost.a: $(ALL_DEP)
#mkdir -p $(#D)
ar crv $# $(filter %.o, $?)
lib/libxgboost.dll lib/libxgboost.so: $(ALL_DEP)
#mkdir -p $(#D)
$(CXX) $(CFLAGS) -shared -o $# $(filter %.o %a, $^) $(LDFLAGS)
jvm-packages/lib/libxgboost4j.so: jvm-packages/xgboost4j/src/native/xgboost4j.cpp $(ALL_DEP)
#mkdir -p $(#D)
$(CXX) $(CFLAGS) $(JAVAINCFLAGS) -shared -o $# $(filter %.cpp %.o %.a, $^) $(LDFLAGS)
xgboost: $(CLI_OBJ) $(ALL_DEP)
$(CXX) $(CFLAGS) -o $# $(filter %.o %.a, $^) $(LDFLAGS)
rcpplint:
python2 dmlc-core/scripts/lint.py xgboost ${LINT_LANG} R-package/src
lint: rcpplint
python2 dmlc-core/scripts/lint.py xgboost ${LINT_LANG} include src plugin
clean:
$(RM) -rf build build_plugin lib bin *~ */*~ */*/*~ */*/*/*~ */*.o */*/*.o */*/*/*.o xgboost
clean_all: clean
cd $(DMLC_CORE); make clean; cd $(ROODIR)
cd $(RABIT); make clean; cd $(ROODIR)
doxygen:
doxygen doc/Doxyfile
# create standalone python tar file.
pypack: ${XGBOOST_DYLIB}
pypack: ${XGBOOST_DYLIB}
cp ${XGBOOST_DYLIB} python-package/xgboost
cd python-package; tar cf xgboost.tar xgboost; cd ..
# Script to make a clean installable R package.
Rpack:
make clean_all
rm -rf xgboost xgboost*.tar.gz
cp -r R-package xgboost
rm -rf xgboost/src/*.o xgboost/src/*.so xgboost/src/*.dll
rm -rf xgboost/src/*/*.o
rm -rf xgboost/demo/*.model xgboost/demo/*.buffer xgboost/demo/*.txt
rm -rf xgboost/demo/runall.R
cp -r src xgboost/src/src
cp -r include xgboost/src/include
cp -r amalgamation xgboost/src/amalgamation
mkdir -p xgboost/src/rabit
cp -r rabit/include xgboost/src/rabit/include
cp -r rabit/src xgboost/src/rabit/src
rm -rf xgboost/src/rabit/src/*.o
mkdir -p xgboost/src/dmlc-core
cp -r dmlc-core/include xgboost/src/dmlc-core/include
cp -r dmlc-core/src xgboost/src/dmlc-core/src
cp ./LICENSE xgboost
cat R-package/src/Makevars|sed '2s/.*/PKGROOT=./' | sed '3s/.*/ENABLE_STD_THREAD=0/' > xgboost/src/Makevars
cp xgboost/src/Makevars xgboost/src/Makevars.win
Rbuild:
make Rpack
R CMD build --no-build-vignettes xgboost
rm -rf xgboost
Rcheck:
make Rbuild
R CMD check xgboost*.tar.gz
-include build/*.d
-include build/*/*.d
-include build_plugin/*/*.d
Thanks a lot.
brew install clang-omp
export CC=clang-omp
export CXX=clang-omp++
cd python-package
sudo python setup.py install
pip install xgboost
i successfully installed it on my linux machine, there is nothing wrong with the make file, my ar version is 2.24, so you got it right, your binutils is very old, to update it go to https://www.gnu.org/software/binutils/ download the 2.24 version.
extract and change the directory:
./configure
make
sudo make install