shogun-toolbox / shogun

Shōgun
http://shogun-toolbox.org
BSD 3-Clause "New" or "Revised" License
3.03k stars 1.04k forks source link

Undefined reference to MPI when compiling libshogun.so.10.0 (missing "-lmpi -lmpi_cxx") #323

Closed npinto closed 13 years ago

npinto commented 13 years ago

I'm getting linking errors when compiling shogun 1.0.0:

(...)
./io/HDF5File.cpp.o: In function `MPI::Comm::Allreduce(void const*, void*, int, MPI::Datatype const&, MPI::Op const&) const':
/usr/include/openmpi/ompi/mpi/cxx/comm_inln.h:452: undefined reference to `MPI_Allreduce'
./io/HDF5File.cpp.o: In function `MPI::Comm::Reduce(void const*, void*, int, MPI::Datatype const&, MPI::Op const&, int) const':
/usr/include/openmpi/ompi/mpi/cxx/comm_inln.h:445: undefined reference to `MPI_Reduce'
./io/HDF5File.cpp.o: In function `MPI::Comm::Alltoallw(void const*, int const*, int const*, MPI::Datatype const*, void*, int const*, int const*, MPI::Datatype const*) const':
/usr/include/openmpi/ompi/mpi/cxx/comm_inln.h:435: undefined reference to `MPI_Alltoallw'
./io/HDF5File.cpp.o: In function `MPI::Comm::Alltoallv(void const*, int const*, int const*, MPI::Datatype const&, void*, int const*, int const*, MPI::Datatype const&) const':
/usr/include/openmpi/ompi/mpi/cxx/comm_inln.h:409: undefined reference to `MPI_Alltoallv'
./io/HDF5File.cpp.o: In function `MPI::Comm::Alltoall(void const*, int, MPI::Datatype const&, void*, int, MPI::Datatype const&) const':
/usr/include/openmpi/ompi/mpi/cxx/comm_inln.h:394: undefined reference to `MPI_Alltoall'
./io/HDF5File.cpp.o: In function `MPI::Comm::Allgatherv(void const*, int, MPI::Datatype const&, void*, int const*, int const*, MPI::Datatype const&) const':
(...)

The failing command is:

c++   ./regression/KRR.cpp.o ./regression/svr/MKLRegression.cpp.o ./regression/svr/SVRLight.cpp.o ./regression/svr/LibSVR.cpp.o ./ui/GUIDistance.cpp.o ./ui/GUIPreprocessor.cpp.o ./ui/GUITime.cpp.o ./ui/GUIClassifier.cpp.o ./ui/GUILabels.cpp.o ./ui/SGInterface.cpp.o ./ui/GUIMath.cpp.o ./ui/GUIKernel.cpp.o ./ui/GUIStructure.cpp.o ./ui/GUIPluginEstimate.cpp.o ./ui/GUIHMM.cpp.o ./ui/GUIFeatures.cpp.o ./io/SerializableFile.cpp.o ./io/BinaryFile.cpp.o ./io/StreamingVwCacheFile.cpp.o ./io/SerializableJsonReader00.cpp.o ./io/HDF5File.cpp.o ./io/SerializableAsciiFile.cpp.o ./io/SerializableHdf5Reader00.cpp.o ./io/StreamingAsciiFile.cpp.o ./io/StreamingFileFromFeatures.cpp.o ./io/SGIO.cpp.o ./io/File.cpp.o ./io/SerializableXmlReader00.cpp.o ./io/SerializableJsonFile.cpp.o ./io/SerializableHdf5File.cpp.o ./io/StreamingFile.cpp.o ./io/AsciiFile.cpp.o ./io/SerializableXmlFile.cpp.o ./io/StreamingVwFile.cpp.o ./io/SerializableAsciiReader00.cpp.o ./io/IOBuffer.cpp.o ./loss/HingeLoss.cpp.o ./loss/SquaredLoss.cpp.o ./loss/LogLoss.cpp.o ./loss/SquaredHingeLoss.cpp.o ./loss/LogLossMargin.cpp.o ./loss/SmoothHingeLoss.cpp.o ./preprocessor/PCA.cpp.o ./preprocessor/LocalTangentSpaceAlignment.cpp.o ./preprocessor/KernelPCA.cpp.o ./preprocessor/Preprocessor.cpp.o ./preprocessor/MultidimensionalScaling.cpp.o ./preprocessor/LaplacianEigenmaps.cpp.o ./preprocessor/SortWordString.cpp.o ./preprocessor/RandomFourierGaussPreproc.cpp.o ./preprocessor/PruneVarSubMean.cpp.o ./preprocessor/KernelLocallyLinearEmbedding.cpp.o ./preprocessor/Isomap.cpp.o ./preprocessor/HessianLocallyLinearEmbedding.cpp.o ./preprocessor/LogPlusOne.cpp.o ./preprocessor/SortUlongString.cpp.o ./preprocessor/LocallyLinearEmbedding.cpp.o ./preprocessor/NormOne.cpp.o ./modelselection/ParameterCombination.cpp.o ./modelselection/ModelSelection.cpp.o ./modelselection/ModelSelectionParameters.cpp.o ./modelselection/GridSearchModelSelection.cpp.o ./machine/DistanceMachine.cpp.o ./machine/OnlineLinearMachine.cpp.o ./machine/LinearMachine.cpp.o ./machine/KernelMachine.cpp.o ./machine/Machine.cpp.o ./classifier/vw/vw_example.cpp.o ./classifier/vw/vw_label.cpp.o ./classifier/vw/VowpalWabbit.cpp.o ./classifier/vw/vw_math.cpp.o ./classifier/vw/learners/VwNonAdaptiveLearner.cpp.o ./classifier/vw/learners/VwAdaptiveLearner.cpp.o ./classifier/vw/VwEnvironment.cpp.o ./classifier/vw/VwParser.cpp.o ./classifier/vw/VwRegressor.cpp.o ./classifier/vw/cache/VwNativeCacheWriter.cpp.o ./classifier/vw/cache/VwCacheWriter.cpp.o ./classifier/vw/cache/VwCacheReader.cpp.o ./classifier/vw/cache/VwNativeCacheReader.cpp.o ./classifier/AveragedPerceptron.cpp.o ./classifier/mkl/MKLOneClass.cpp.o ./classifier/mkl/MKLMultiClassOptimizationBase.cpp.o ./classifier/mkl/MKLMultiClassGradient.cpp.o ./classifier/mkl/MKLMultiClass.cpp.o ./classifier/mkl/MKLMultiClassGLPK.cpp.o ./classifier/mkl/MKLClassification.cpp.o ./classifier/mkl/MKL.cpp.o ./classifier/svm/gpdt.cpp.o ./classifier/svm/DomainAdaptationSVM.cpp.o ./classifier/svm/OnlineLibLinear.cpp.o ./classifier/svm/ScatterSVM.cpp.o ./classifier/svm/SVM.cpp.o ./classifier/svm/libqp_splx.cpp.o ./classifier/svm/LibLinear.cpp.o ./classifier/svm/SubGradientSVM.cpp.o ./classifier/svm/GMNPLib.cpp.o ./classifier/svm/gpdtsolve.cpp.o ./classifier/svm/SVMOcas.cpp.o ./classifier/svm/LibSVMOneClass.cpp.o ./classifier/svm/LaRank.cpp.o ./classifier/svm/MPDSVM.cpp.o ./classifier/svm/GNPPSVM.cpp.o ./classifier/svm/pr_loqo.cpp.o ./classifier/svm/MultiClassSVM.cpp.o ./classifier/svm/ssl.cpp.o ./classifier/svm/QPBSVMLib.cpp.o ./classifier/svm/Tron.cpp.o ./classifier/svm/GPBTSVM.cpp.o ./classifier/svm/SVMLightOneClass.cpp.o ./classifier/svm/OnlineSVMSGD.cpp.o ./classifier/svm/SVM_linear.cpp.o ./classifier/svm/GMNPSVM.cpp.o ./classifier/svm/SGDQN.cpp.o ./classifier/svm/SVMSGD.cpp.o ./classifier/svm/LibSVMMultiClass.cpp.o ./classifier/svm/CPLEXSVM.cpp.o ./classifier/svm/GNPPLib.cpp.o ./classifier/svm/DomainAdaptationSVMLinear.cpp.o ./classifier/svm/gpm.cpp.o ./classifier/svm/WDSVMOcas.cpp.o ./classifier/svm/SVM_libsvm.cpp.o ./classifier/svm/LibSVM.cpp.o ./classifier/svm/libocas.cpp.o ./classifier/svm/SVMLight.cpp.o ./classifier/svm/SVMLin.cpp.o ./classifier/LPM.cpp.o ./classifier/PluginEstimate.cpp.o ./classifier/KNN.cpp.o ./classifier/SubGradientLPM.cpp.o ./classifier/GaussianNaiveBayes.cpp.o ./classifier/Perceptron.cpp.o ./classifier/LDA.cpp.o ./classifier/LPBoost.cpp.o ./base/ParameterMap.cpp.o ./base/class_list.cpp.o ./base/Version.cpp.o ./base/Parallel.cpp.o ./base/init.cpp.o ./base/SGObject.cpp.o ./base/Parameter.cpp.o ./mathematics/Math.cpp.o ./mathematics/Statistics.cpp.o ./mathematics/Cplex.cpp.o ./mathematics/arpack.cpp.o ./mathematics/lapack.cpp.o ./distributions/Gaussian.cpp.o ./distributions/GHMM.cpp.o ./distributions/LinearHMM.cpp.o ./distributions/Histogram.cpp.o ./distributions/Distribution.cpp.o ./distributions/PositionalPWM.cpp.o ./distributions/HMM.cpp.o ./lib/Hash.cpp.o ./lib/Time.cpp.o ./lib/HashSet.cpp.o ./lib/memory.cpp.o ./lib/FibonacciHeap.cpp.o ./lib/Compressor.cpp.o ./lib/DataType.cpp.o ./lib/Signal.cpp.o ./lib/Trie.cpp.o ./lib/ShogunException.cpp.o ./distance/CanberraWordDistance.cpp.o ./distance/EuclidianDistance.cpp.o ./distance/ManhattanWordDistance.cpp.o ./distance/ManhattanMetric.cpp.o ./distance/SparseEuclidianDistance.cpp.o ./distance/Distance.cpp.o ./distance/AttenuatedEuclidianDistance.cpp.o ./distance/KernelDistance.cpp.o ./distance/MinkowskiMetric.cpp.o ./distance/CanberraMetric.cpp.o ./distance/CustomDistance.cpp.o ./distance/TanimotoDistance.cpp.o ./distance/BrayCurtisDistance.cpp.o ./distance/JensenMetric.cpp.o ./distance/CosineDistance.cpp.o ./distance/ChebyshewMetric.cpp.o ./distance/HammingWordDistance.cpp.o ./distance/ChiSquareDistance.cpp.o ./distance/GeodesicMetric.cpp.o ./evaluation/StratifiedCrossValidationSplitting.cpp.o ./evaluation/MeanSquaredError.cpp.o ./evaluation/CrossValidation.cpp.o ./evaluation/ROCEvaluation.cpp.o ./evaluation/PRCEvaluation.cpp.o ./evaluation/SplittingStrategy.cpp.o ./evaluation/MulticlassAccuracy.cpp.o ./evaluation/ContingencyTableEvaluation.cpp.o ./structure/Plif.cpp.o ./structure/PlifArray.cpp.o ./structure/IntronList.cpp.o ./structure/SegmentLoss.cpp.o ./structure/PlifMatrix.cpp.o ./structure/DynProg.cpp.o ./clustering/GMM.cpp.o ./clustering/Hierarchical.cpp.o ./clustering/KMeans.cpp.o ./features/WDFeatures.cpp.o ./features/SNPFeatures.cpp.o ./features/ImplicitWeightedSpecFeatures.cpp.o ./features/Features.cpp.o ./features/CombinedFeatures.cpp.o ./features/StreamingVwFeatures.cpp.o ./features/FKFeatures.cpp.o ./features/Labels.cpp.o ./features/TOPFeatures.cpp.o ./features/DotFeatures.cpp.o ./features/ExplicitSpecFeatures.cpp.o ./features/Subset.cpp.o ./features/HashedWDFeaturesTransposed.cpp.o ./features/SparsePolyFeatures.cpp.o ./features/AttributeFeatures.cpp.o ./features/LBPPyrDotFeatures.cpp.o ./features/CombinedDotFeatures.cpp.o ./features/RealFileFeatures.cpp.o ./features/PolyFeatures.cpp.o ./features/HashedWDFeatures.cpp.o ./features/Alphabet.cpp.o ./kernel/WeightedDegreeStringKernel.cpp.o ./kernel/GaussianShortRealKernel.cpp.o ./kernel/PyramidChi2.cpp.o ./kernel/LocalityImprovedStringKernel.cpp.o ./kernel/Kernel.cpp.o ./kernel/TensorProductPairKernel.cpp.o ./kernel/TStudentKernel.cpp.o ./kernel/WeightedDegreeRBFKernel.cpp.o ./kernel/SigmoidKernel.cpp.o ./kernel/PolyMatchWordStringKernel.cpp.o ./kernel/Chi2Kernel.cpp.o ./kernel/SplineKernel.cpp.o ./kernel/HistogramWordStringKernel.cpp.o ./kernel/CombinedKernel.cpp.o ./kernel/LinearKernel.cpp.o ./kernel/RegulatoryModulesStringKernel.cpp.o ./kernel/SNPStringKernel.cpp.o ./kernel/SpectrumRBFKernel.cpp.o ./kernel/ExponentialKernel.cpp.o ./kernel/DistanceKernel.cpp.o ./kernel/OligoStringKernel.cpp.o ./kernel/GaussianShiftKernel.cpp.o ./kernel/WeightedCommWordStringKernel.cpp.o ./kernel/SpectrumMismatchRBFKernel.cpp.o ./kernel/LinearStringKernel.cpp.o ./kernel/DistantSegmentsKernel.cpp.o ./kernel/BesselKernel.cpp.o ./kernel/PolyMatchStringKernel.cpp.o ./kernel/SimpleLocalityImprovedStringKernel.cpp.o ./kernel/InverseMultiQuadricKernel.cpp.o ./kernel/CircularKernel.cpp.o ./kernel/WaveKernel.cpp.o ./kernel/MatchWordStringKernel.cpp.o ./kernel/PowerKernel.cpp.o ./kernel/PolyKernel.cpp.o ./kernel/MultiquadricKernel.cpp.o ./kernel/SphericalKernel.cpp.o ./kernel/LogKernel.cpp.o ./kernel/WeightedDegreePositionStringKernel.cpp.o ./kernel/CommWordStringKernel.cpp.o ./kernel/WaveletKernel.cpp.o ./kernel/HistogramIntersectionKernel.cpp.o ./kernel/SparseSpatialSampleStringKernel.cpp.o ./kernel/DiagKernel.cpp.o ./kernel/SalzbergWordStringKernel.cpp.o ./kernel/CustomKernel.cpp.o ./kernel/CauchyKernel.cpp.o ./kernel/GaussianMatchStringKernel.cpp.o ./kernel/ConstKernel.cpp.o ./kernel/CommUlongStringKernel.cpp.o ./kernel/AUCKernel.cpp.o ./kernel/LocalAlignmentStringKernel.cpp.o ./kernel/FixedDegreeStringKernel.cpp.o ./kernel/RationalQuadraticKernel.cpp.o ./kernel/GaussianKernel.cpp.o ./kernel/ANOVAKernel.cpp.o -Xlinker --no-undefined  -o libshogun.so.10.0 -lm -pthread -lhdf5 -lxml2   -llapack -lcblas -latlas -llapack -lcblas -llzo2 -lz -lbz2 -llzma -fPIC -Xlinker -soname=libshogun.so.10 -shared -Wl,-export-dynamic

Adding --ldfags="-lmpi -lmpi_cxx" to ./configure fixes the issue. Am I missing something?

lisitsyn commented 13 years ago

Hi Nicolas,

the error you get is pretty strange cause there is no MPI usage in the CHDF5File class. Could you please clean your installation with removing *.o files and retry?

npinto commented 13 years ago

Interesting. I guess this has to do with mpi support in my hdf5 library. I'll check my USE flags and report back. Thanks for the prompt answer.

sonney2k commented 13 years ago

it is a bug in your hdf5 library which in your case should have been linked with mpi but obviously was not