未定义的引用通常是链接器错误。我觉得这个错误是因为我编译了 mlpack 而不是代码,但我不知道如何追踪它或者我的假设是否正确。或者,如果它是一个错误并且有解决方法。
我已经使用此作为参考编写了代码 - mlpack 文档
-原谅我的包含,我直接从另一个文件中复制了它们-
该错误仅由于 Train 语句而出现,其他一切正常。我在其他地方使用过犰狳,并且可以很好地处理复杂的数据和矩阵运算,例如特征值生成、向量转置、向量运算等。所以,我知道错误可能不在犰狳中。
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <vector>
#include <complex>
#include <vector>
#include <map>
#include <fstream>
#include <string>
#include <filesystem>
#include <sstream>
#include <utility>
#include <algorithm>
#include <random>
#include <execution>
#include <mlpack/prereqs.hpp>
#include <mlpack/core.hpp>
#include <mlpack/core/data/split_data.hpp>
#include <mlpack/methods/ann/layer/layer.hpp>
#include <mlpack/methods/ann/ffn.hpp>
namespace fs = std::filesystem;
constexpr auto PI = 3.14159265f;
using namespace std;
using namespace std::complex_literals;
using namespace mlpack;
using namespace mlpack::ann;
int main() {
arma::mat trainData;
trainData = {
{1.0,11.0,21.0,31.0},
{2.0,12.0,22.0,32.0},
{3.0,13.0,23.0,33.0},
{4.0,14.0,24.0,34.0},
{6.0,16.0,26.0,36.0},
{7.0,17.0,27.0,37.0},
{8.0,18.0,28.0,38.0},
{9.0,19.0,29.0,39.0}
};
arma::mat trainLabel;
trainLabel = {1.0,2.0,3.0,4.0} ;
trainData.print();
trainLabel.print();
FFN<> model;
model.Add<Linear<> >(trainData.n_rows, 12);
model.Add<SigmoidLayer<> >();
model.Add<Linear<> >(12, 3);
model.Add<LogSoftMax<> >();
model.Train(trainData, trainLabel);
}
我使用以下命令运行代码
g++ -O3 minimumReproducableCodeForMLError.cpp -Iarmadillo/include -Imlpack/include/ -Iboost/include -Larmadillo/lib -Lblas/lib/ -Lboost/lib -Llapack/ -Lmlpack/lib -Lopenblas/lib -Iopenblas/include -fopenmp -larmadillo -lmlpack -std=c++2a -w -o minCode.o
我尝试将 g++ 命令拆分为 -c,然后使用链接器编译目标文件。它在链接器部分失败。编译部分只是给了我来自 boost 库的 depreceated-declarations 警告。
这是我得到的错误 -
/usr/bin/ld: /tmp/ccNWv7em.o: in function `arma::arma_rng::randn<double>::fill(double*, unsigned long long)':
minimumReproducableCodeForMLError.cpp:(.text._ZN4arma8arma_rng5randnIdE4fillEPdy[_ZN4arma8arma_rng5randnIdE4fillEPdy]+0x56): undefined reference to `arma::mt19937_64_instance'
/usr/bin/ld: minimumReproducableCodeForMLError.cpp:(.text._ZN4arma8arma_rng5randnIdE4fillEPdy[_ZN4arma8arma_rng5randnIdE4fillEPdy]+0x71): undefined reference to `TLS init function for arma::mt19937_64_instance'
/usr/bin/ld: minimumReproducableCodeForMLError.cpp:(.text._ZN4arma8arma_rng5randnIdE4fillEPdy[_ZN4arma8arma_rng5randnIdE4fillEPdy]+0x1e0): undefined reference to `TLS init function for arma::mt19937_64_instance'
/usr/bin/ld: minimumReproducableCodeForMLError.cpp:(.text._ZN4arma8arma_rng5randnIdE4fillEPdy[_ZN4arma8arma_rng5randnIdE4fillEPdy]+0x1e7): undefined reference to `arma::mt19937_64_instance'
/usr/bin/ld: /tmp/ccNWv7em.o: in function `void mlpack::math::ShuffleData<arma::Mat<double>, arma::Mat<double> >(arma::Mat<double> const&, arma::Mat<double> const&, arma::Mat<double>&, arma::Mat<double>&, std::enable_if<!arma::is_SpMat<arma::Mat<double> >::value, void>::type const*, std::enable_if<!arma::is_Cube<arma::Mat<double> >::value, void>::type const*)':
minimumReproducableCodeForMLError.cpp:(.text._ZN6mlpack4math11ShuffleDataIN4arma3MatIdEES4_EEvRKT_RKT0_RS5_RS8_PKNSt9enable_ifIXntsrNS2_8is_SpMatIS5_EE5valueEvE4typeEPKNSD_IXntsrNS2_7is_CubeIS5_EE5valueEvE4typeE[_ZN6mlpack4math11ShuffleDataIN4arma3MatIdEES4_EEvRKT_RKT0_RS5_RS8_PKNSt9enable_ifIXntsrNS2_8is_SpMatIS5_EE5valueEvE4typeEPKNSD_IXntsrNS2_7is_CubeIS5_EE5valueEvE4typeE]+0x31b): undefined reference to `TLS init function for arma::mt19937_64_instance'
/usr/bin/ld: minimumReproducableCodeForMLError.cpp:(.text._ZN6mlpack4math11ShuffleDataIN4arma3MatIdEES4_EEvRKT_RKT0_RS5_RS8_PKNSt9enable_ifIXntsrNS2_8is_SpMatIS5_EE5valueEvE4typeEPKNSD_IXntsrNS2_7is_CubeIS5_EE5valueEvE4typeE[_ZN6mlpack4math11ShuffleDataIN4arma3MatIdEES4_EEvRKT_RKT0_RS5_RS8_PKNSt9enable_ifIXntsrNS2_8is_SpMatIS5_EE5valueEvE4typeEPKNSD_IXntsrNS2_7is_CubeIS5_EE5valueEvE4typeE]+0x322): undefined reference to `arma::mt19937_64_instance'
/usr/bin/ld: /tmp/ccNWv7em.o: in function `_ZN6mlpack3ann21NetworkInitializationINS0_20RandomInitializationEJEE10InitializeIdEEvRKSt6vectorIN5boost7variantIPNS0_18AdaptiveMaxPoolingIN4arma3MatIdEESB_EEJPNS0_19AdaptiveMeanPoolingISB_SB_EEPNS0_3AddISB_SB_EEPNS0_8AddMergeISB_SB_JEEEPNS0_12AlphaDropoutISB_SB_EEPNS0_17AtrousConvolutionINS0_16NaiveConvolutionINS0_16ValidConvolutionEEENSR_INS0_15FullConvolutionEEEST_SB_SB_EEPNS0_9BaseLayerINS0_16LogisticFunctionESB_SB_EEPNSY_INS0_16IdentityFunctionESB_SB_EEPNSY_INS0_12TanhFunctionESB_SB_EEPNSY_INS0_16SoftplusFunctionESB_SB_EEPNSY_INS0_17RectifierFunctionESB_SB_EEPNS0_9BatchNormISB_SB_EEPNS0_21BilinearInterpolationISB_SB_EEPNS0_4CELUISB_SB_EEPNS0_6ConcatISB_SB_JEEEPNS0_11ConcatenateISB_SB_EEPNS0_17ConcatPerformanceINS0_21NegativeLogLikelihoodISB_SB_EESB_SB_EEPNS0_8ConstantISB_SB_EEPNS0_11ConvolutionIST_SV_ST_SB_SB_EEPNS0_5CReLUISB_SB_EEPNS0_11DropConnectISB_SB_EEPNS0_7DropoutISB_SB_EEPNS0_3ELUISB_SB_EEPNS0_8FastLSTMISB_SB_EEPNS0_12FlexibleReLUISB_SB_EEPNS0_3GRUISB_SB_EEPNS0_8HardTanHISB_SB_EEPNS0_4JoinISB_SB_EEPNS0_9LayerNormISB_SB_EEPNS0_9LeakyReLUISB_SB_EEPNS0_6LinearISB_SB_NS0_13NoRegularizerEEEPNS0_12LinearNoBiasISB_SB_S32_EEPNS0_10LogSoftMaxISB_SB_EEPNS0_6LookupISB_SB_EEPNS0_4LSTMISB_SB_EEPNS0_10MaxPoolingISB_SB_EEPNS0_11MeanPoolingISB_SB_EEPNS0_23MiniBatchDiscriminationISB_SB_EEPNS0_16MultiplyConstantISB_SB_EEPNS0_13MultiplyMergeISB_SB_JEEEPS1V_PNS0_11NoisyLinearISB_SB_EEPNS0_7PaddingISB_SB_EEPNS0_5PReLUISB_SB_EEPNS0_7SoftmaxISB_SB_EEPNS0_14SpatialDropoutISB_SB_EEPNS0_21TransposedConvolutionIST_ST_ST_SB_SB_EEPNS0_10WeightNormISB_SB_JEEENS7_IPNS0_8Linear3DISB_SB_S32_EEJPNS0_7GlimpseISB_SB_EEPNS0_7HighwayISB_SB_JEEEPNS0_18MultiheadAttentionISB_SB_S32_EEPNS0_9RecurrentISB_SB_JEEEPNS0_18RecurrentAttentionISB_SB_EEPNS0_15ReinforceNormalISB_SB_EEPNS0_17ReparametrizationISB_SB_EEPNS0_6SelectISB_SB_EEPNS0_10SequentialISB_SB_Lb0EJEEEPNS59_ISB_SB_Lb1EJEEEPNS0_7SubviewISB_SB_EEPNS0_13VRClassRewardISB_SB_EEPNS0_16VirtualBatchNormISB_SB_EEPNS0_3RBFISB_SB_NS0_16GaussianFunctionEEEPNSY_IS5O_SB_SB_EEPNS0_18PositionalEncodingISB_SB_EEEEEEEESaIS5X_EERNSA_IT_EEm':
minimumReproducableCodeForMLError.cpp:(.text._ZN6mlpack3ann21NetworkInitializationINS0_20RandomInitializationEJEE10InitializeIdEEvRKSt6vectorIN5boost7variantIPNS0_18AdaptiveMaxPoolingIN4arma3MatIdEESB_EEJPNS0_19AdaptiveMeanPoolingISB_SB_EEPNS0_3AddISB_SB_EEPNS0_8AddMergeISB_SB_JEEEPNS0_12AlphaDropoutISB_SB_EEPNS0_17AtrousConvolutionINS0_16NaiveConvolutionINS0_16ValidConvolutionEEENSR_INS0_15FullConvolutionEEEST_SB_SB_EEPNS0_9BaseLayerINS0_16LogisticFunctionESB_SB_EEPNSY_INS0_16IdentityFunctionESB_SB_EEPNSY_INS0_12TanhFunctionESB_SB_EEPNSY_INS0_16SoftplusFunctionESB_SB_EEPNSY_INS0_17RectifierFunctionESB_SB_EEPNS0_9BatchNormISB_SB_EEPNS0_21BilinearInterpolationISB_SB_EEPNS0_4CELUISB_SB_EEPNS0_6ConcatISB_SB_JEEEPNS0_11ConcatenateISB_SB_EEPNS0_17ConcatPerformanceINS0_21NegativeLogLikelihoodISB_SB_EESB_SB_EEPNS0_8ConstantISB_SB_EEPNS0_11ConvolutionIST_SV_ST_SB_SB_EEPNS0_5CReLUISB_SB_EEPNS0_11DropConnectISB_SB_EEPNS0_7DropoutISB_SB_EEPNS0_3ELUISB_SB_EEPNS0_8FastLSTMISB_SB_EEPNS0_12FlexibleReLUISB_SB_EEPNS0_3GRUISB_SB_EEPNS0_8HardTanHISB_SB_EEPNS0_4JoinISB_SB_EEPNS0_9LayerNormISB_SB_EEPNS0_9LeakyReLUISB_SB_EEPNS0_6LinearISB_SB_NS0_13NoRegularizerEEEPNS0_12LinearNoBiasISB_SB_S32_EEPNS0_10LogSoftMaxISB_SB_EEPNS0_6LookupISB_SB_EEPNS0_4LSTMISB_SB_EEPNS0_10MaxPoolingISB_SB_EEPNS0_11MeanPoolingISB_SB_EEPNS0_23MiniBatchDiscriminationISB_SB_EEPNS0_16MultiplyConstantISB_SB_EEPNS0_13MultiplyMergeISB_SB_JEEEPS1V_PNS0_11NoisyLinearISB_SB_EEPNS0_7PaddingISB_SB_EEPNS0_5PReLUISB_SB_EEPNS0_7SoftmaxISB_SB_EEPNS0_14SpatialDropoutISB_SB_EEPNS0_21TransposedConvolutionIST_ST_ST_SB_SB_EEPNS0_10WeightNormISB_SB_JEEENS7_IPNS0_8Linear3DISB_SB_S32_EEJPNS0_7GlimpseISB_SB_EEPNS0_7HighwayISB_SB_JEEEPNS0_18MultiheadAttentionISB_SB_S32_EEPNS0_9RecurrentISB_SB_JEEEPNS0_18RecurrentAttentionISB_SB_EEPNS0_15ReinforceNormalISB_SB_EEPNS0_17ReparametrizationISB_SB_EEPNS0_6SelectISB_SB_EEPNS0_10SequentialISB_SB_Lb0EJEEEPNS59_ISB_SB_Lb1EJEEEPNS0_7SubviewISB_SB_EEPNS0_13VRClassRewardISB_SB_EEPNS0_16VirtualBatchNormISB_SB_EEPNS0_3RBFISB_SB_NS0_16GaussianFunctionEEEPNSY_IS5O_SB_SB_EEPNS0_18PositionalEncodingISB_SB_EEEEEEEESaIS5X_EERNSA_IT_EEm[_ZN6mlpack3ann21NetworkInitializationINS0_20RandomInitializationEJEE10InitializeIdEEvRKSt6vectorIN5boost7variantIPNS0_18AdaptiveMaxPoolingIN4arma3MatIdEESB_EEJPNS0_19AdaptiveMeanPoolingISB_SB_EEPNS0_3AddISB_SB_EEPNS0_8AddMergeISB_SB_JEEEPNS0_12AlphaDropoutISB_SB_EEPNS0_17AtrousConvolutionINS0_16NaiveConvolutionINS0_16ValidConvolutionEEENSR_INS0_15FullConvolutionEEEST_SB_SB_EEPNS0_9BaseLayerINS0_16LogisticFunctionESB_SB_EEPNSY_INS0_16IdentityFunctionESB_SB_EEPNSY_INS0_12TanhFunctionESB_SB_EEPNSY_INS0_16SoftplusFunctionESB_SB_EEPNSY_INS0_17RectifierFunctionESB_SB_EEPNS0_9BatchNormISB_SB_EEPNS0_21BilinearInterpolationISB_SB_EEPNS0_4CELUISB_SB_EEPNS0_6ConcatISB_SB_JEEEPNS0_11ConcatenateISB_SB_EEPNS0_17ConcatPerformanceINS0_21NegativeLogLikelihoodISB_SB_EESB_SB_EEPNS0_8ConstantISB_SB_EEPNS0_11ConvolutionIST_SV_ST_SB_SB_EEPNS0_5CReLUISB_SB_EEPNS0_11DropConnectISB_SB_EEPNS0_7DropoutISB_SB_EEPNS0_3ELUISB_SB_EEPNS0_8FastLSTMISB_SB_EEPNS0_12FlexibleReLUISB_SB_EEPNS0_3GRUISB_SB_EEPNS0_8HardTanHISB_SB_EEPNS0_4JoinISB_SB_EEPNS0_9LayerNormISB_SB_EEPNS0_9LeakyReLUISB_SB_EEPNS0_6LinearISB_SB_NS0_13NoRegularizerEEEPNS0_12LinearNoBiasISB_SB_S32_EEPNS0_10LogSoftMaxISB_SB_EEPNS0_6LookupISB_SB_EEPNS0_4LSTMISB_SB_EEPNS0_10MaxPoolingISB_SB_EEPNS0_11MeanPoolingISB_SB_EEPNS0_23MiniBatchDiscriminationISB_SB_EEPNS0_16MultiplyConstantISB_SB_EEPNS0_13MultiplyMergeISB_SB_JEEEPS1V_PNS0_11NoisyLinearISB_SB_EEPNS0_7PaddingISB_SB_EEPNS0_5PReLUISB_SB_EEPNS0_7SoftmaxISB_SB_EEPNS0_14SpatialDropoutISB_SB_EEPNS0_21TransposedConvolutionIST_ST_ST_SB_SB_EEPNS0_10WeightNormISB_SB_JEEENS7_IPNS0_8Linear3DISB_SB_S32_EEJPNS0_7GlimpseISB_SB_EEPNS0_7HighwayISB_SB_JEEEPNS0_18MultiheadAttentionISB_SB_S32_EEPNS0_9RecurrentISB_SB_JEEEPNS0_18RecurrentAttentionISB_SB_EEPNS0_15ReinforceNormalISB_SB_EEPNS0_17ReparametrizationISB_SB_EEPNS0_6SelectISB_SB_EEPNS0_10SequentialISB_SB_Lb0EJEEEPNS59_ISB_SB_Lb1EJEEEPNS0_7SubviewISB_SB_EEPNS0_13VRClassRewardISB_SB_EEPNS0_16VirtualBatchNormISB_SB_EEPNS0_3RBFISB_SB_NS0_16GaussianFunctionEEEPNSY_IS5O_SB_SB_EEPNS0_18PositionalEncodingISB_SB_EEEEEEEESaIS5X_EERNSA_IT_EEm]+0x248): undefined reference to `TLS init function for arma::mt19937_64_instance'
/usr/bin/ld: minimumReproducableCodeForMLError.cpp:(.text._ZN6mlpack3ann21NetworkInitializationINS0_20RandomInitializationEJEE10InitializeIdEEvRKSt6vectorIN5boost7variantIPNS0_18AdaptiveMaxPoolingIN4arma3MatIdEESB_EEJPNS0_19AdaptiveMeanPoolingISB_SB_EEPNS0_3AddISB_SB_EEPNS0_8AddMergeISB_SB_JEEEPNS0_12AlphaDropoutISB_SB_EEPNS0_17AtrousConvolutionINS0_16NaiveConvolutionINS0_16ValidConvolutionEEENSR_INS0_15FullConvolutionEEEST_SB_SB_EEPNS0_9BaseLayerINS0_16LogisticFunctionESB_SB_EEPNSY_INS0_16IdentityFunctionESB_SB_EEPNSY_INS0_12TanhFunctionESB_SB_EEPNSY_INS0_16SoftplusFunctionESB_SB_EEPNSY_INS0_17RectifierFunctionESB_SB_EEPNS0_9BatchNormISB_SB_EEPNS0_21BilinearInterpolationISB_SB_EEPNS0_4CELUISB_SB_EEPNS0_6ConcatISB_SB_JEEEPNS0_11ConcatenateISB_SB_EEPNS0_17ConcatPerformanceINS0_21NegativeLogLikelihoodISB_SB_EESB_SB_EEPNS0_8ConstantISB_SB_EEPNS0_11ConvolutionIST_SV_ST_SB_SB_EEPNS0_5CReLUISB_SB_EEPNS0_11DropConnectISB_SB_EEPNS0_7DropoutISB_SB_EEPNS0_3ELUISB_SB_EEPNS0_8FastLSTMISB_SB_EEPNS0_12FlexibleReLUISB_SB_EEPNS0_3GRUISB_SB_EEPNS0_8HardTanHISB_SB_EEPNS0_4JoinISB_SB_EEPNS0_9LayerNormISB_SB_EEPNS0_9LeakyReLUISB_SB_EEPNS0_6LinearISB_SB_NS0_13NoRegularizerEEEPNS0_12LinearNoBiasISB_SB_S32_EEPNS0_10LogSoftMaxISB_SB_EEPNS0_6LookupISB_SB_EEPNS0_4LSTMISB_SB_EEPNS0_10MaxPoolingISB_SB_EEPNS0_11MeanPoolingISB_SB_EEPNS0_23MiniBatchDiscriminationISB_SB_EEPNS0_16MultiplyConstantISB_SB_EEPNS0_13MultiplyMergeISB_SB_JEEEPS1V_PNS0_11NoisyLinearISB_SB_EEPNS0_7PaddingISB_SB_EEPNS0_5PReLUISB_SB_EEPNS0_7SoftmaxISB_SB_EEPNS0_14SpatialDropoutISB_SB_EEPNS0_21TransposedConvolutionIST_ST_ST_SB_SB_EEPNS0_10WeightNormISB_SB_JEEENS7_IPNS0_8Linear3DISB_SB_S32_EEJPNS0_7GlimpseISB_SB_EEPNS0_7HighwayISB_SB_JEEEPNS0_18MultiheadAttentionISB_SB_S32_EEPNS0_9RecurrentISB_SB_JEEEPNS0_18RecurrentAttentionISB_SB_EEPNS0_15ReinforceNormalISB_SB_EEPNS0_17ReparametrizationISB_SB_EEPNS0_6SelectISB_SB_EEPNS0_10SequentialISB_SB_Lb0EJEEEPNS59_ISB_SB_Lb1EJEEEPNS0_7SubviewISB_SB_EEPNS0_13VRClassRewardISB_SB_EEPNS0_16VirtualBatchNormISB_SB_EEPNS0_3RBFISB_SB_NS0_16GaussianFunctionEEEPNSY_IS5O_SB_SB_EEPNS0_18PositionalEncodingISB_SB_EEEEEEEESaIS5X_EERNSA_IT_EEm[_ZN6mlpack3ann21NetworkInitializationINS0_20RandomInitializationEJEE10InitializeIdEEvRKSt6vectorIN5boost7variantIPNS0_18AdaptiveMaxPoolingIN4arma3MatIdEESB_EEJPNS0_19AdaptiveMeanPoolingISB_SB_EEPNS0_3AddISB_SB_EEPNS0_8AddMergeISB_SB_JEEEPNS0_12AlphaDropoutISB_SB_EEPNS0_17AtrousConvolutionINS0_16NaiveConvolutionINS0_16ValidConvolutionEEENSR_INS0_15FullConvolutionEEEST_SB_SB_EEPNS0_9BaseLayerINS0_16LogisticFunctionESB_SB_EEPNSY_INS0_16IdentityFunctionESB_SB_EEPNSY_INS0_12TanhFunctionESB_SB_EEPNSY_INS0_16SoftplusFunctionESB_SB_EEPNSY_INS0_17RectifierFunctionESB_SB_EEPNS0_9BatchNormISB_SB_EEPNS0_21BilinearInterpolationISB_SB_EEPNS0_4CELUISB_SB_EEPNS0_6ConcatISB_SB_JEEEPNS0_11ConcatenateISB_SB_EEPNS0_17ConcatPerformanceINS0_21NegativeLogLikelihoodISB_SB_EESB_SB_EEPNS0_8ConstantISB_SB_EEPNS0_11ConvolutionIST_SV_ST_SB_SB_EEPNS0_5CReLUISB_SB_EEPNS0_11DropConnectISB_SB_EEPNS0_7DropoutISB_SB_EEPNS0_3ELUISB_SB_EEPNS0_8FastLSTMISB_SB_EEPNS0_12FlexibleReLUISB_SB_EEPNS0_3GRUISB_SB_EEPNS0_8HardTanHISB_SB_EEPNS0_4JoinISB_SB_EEPNS0_9LayerNormISB_SB_EEPNS0_9LeakyReLUISB_SB_EEPNS0_6LinearISB_SB_NS0_13NoRegularizerEEEPNS0_12LinearNoBiasISB_SB_S32_EEPNS0_10LogSoftMaxISB_SB_EEPNS0_6LookupISB_SB_EEPNS0_4LSTMISB_SB_EEPNS0_10MaxPoolingISB_SB_EEPNS0_11MeanPoolingISB_SB_EEPNS0_23MiniBatchDiscriminationISB_SB_EEPNS0_16MultiplyConstantISB_SB_EEPNS0_13MultiplyMergeISB_SB_JEEEPS1V_PNS0_11NoisyLinearISB_SB_EEPNS0_7PaddingISB_SB_EEPNS0_5PReLUISB_SB_EEPNS0_7SoftmaxISB_SB_EEPNS0_14SpatialDropoutISB_SB_EEPNS0_21TransposedConvolutionIST_ST_ST_SB_SB_EEPNS0_10WeightNormISB_SB_JEEENS7_IPNS0_8Linear3DISB_SB_S32_EEJPNS0_7GlimpseISB_SB_EEPNS0_7HighwayISB_SB_JEEEPNS0_18MultiheadAttentionISB_SB_S32_EEPNS0_9RecurrentISB_SB_JEEEPNS0_18RecurrentAttentionISB_SB_EEPNS0_15ReinforceNormalISB_SB_EEPNS0_17ReparametrizationISB_SB_EEPNS0_6SelectISB_SB_EEPNS0_10SequentialISB_SB_Lb0EJEEEPNS59_ISB_SB_Lb1EJEEEPNS0_7SubviewISB_SB_EEPNS0_13VRClassRewardISB_SB_EEPNS0_16VirtualBatchNormISB_SB_EEPNS0_3RBFISB_SB_NS0_16GaussianFunctionEEEPNSY_IS5O_SB_SB_EEPNS0_18PositionalEncodingISB_SB_EEEEEEEESaIS5X_EERNSA_IT_EEm]+0x24f): undefined reference to `arma::mt19937_64_instance'
/usr/bin/ld: /tmp/ccNWv7em.o: in function `void mlpack::ann::Dropout<arma::Mat<double>, arma::Mat<double> >::Forward<double>(arma::Mat<double> const&, arma::Mat<double>&)':
minimumReproducableCodeForMLError.cpp:(.text._ZN6mlpack3ann7DropoutIN4arma3MatIdEES4_E7ForwardIdEEvRKNS3_IT_EERS8_[_ZN6mlpack3ann7DropoutIN4arma3MatIdEES4_E7ForwardIdEEvRKNS3_IT_EERS8_]+0xd7): undefined reference to `TLS init function for arma::mt19937_64_instance'
/usr/bin/ld: minimumReproducableCodeForMLError.cpp:(.text._ZN6mlpack3ann7DropoutIN4arma3MatIdEES4_E7ForwardIdEEvRKNS3_IT_EERS8_[_ZN6mlpack3ann7DropoutIN4arma3MatIdEES4_E7ForwardIdEEvRKNS3_IT_EERS8_]+0xe7): undefined reference to `arma::mt19937_64_instance'
/usr/bin/ld: /tmp/ccNWv7em.o: in function `void mlpack::ann::SpatialDropout<arma::Mat<double>, arma::Mat<double> >::Forward<double>(arma::Mat<double> const&, arma::Mat<double>&)':
minimumReproducableCodeForMLError.cpp:(.text._ZN6mlpack3ann14SpatialDropoutIN4arma3MatIdEES4_E7ForwardIdEEvRKNS3_IT_EERS8_[_ZN6mlpack3ann14SpatialDropoutIN4arma3MatIdEES4_E7ForwardIdEEvRKNS3_IT_EERS8_]+0x386): undefined reference to `TLS init function for arma::mt19937_64_instance'
/usr/bin/ld: minimumReproducableCodeForMLError.cpp:(.text._ZN6mlpack3ann14SpatialDropoutIN4arma3MatIdEES4_E7ForwardIdEEvRKNS3_IT_EERS8_[_ZN6mlpack3ann14SpatialDropoutIN4arma3MatIdEES4_E7ForwardIdEEvRKNS3_IT_EERS8_]+0x38d): undefined reference to `arma::mt19937_64_instance'
/usr/bin/ld: /tmp/ccNWv7em.o: in function `void mlpack::ann::AlphaDropout<arma::Mat<double>, arma::Mat<double> >::Forward<double>(arma::Mat<double> const&, arma::Mat<double>&)':
minimumReproducableCodeForMLError.cpp:(.text._ZN6mlpack3ann12AlphaDropoutIN4arma3MatIdEES4_E7ForwardIdEEvRKNS3_IT_EERS8_[_ZN6mlpack3ann12AlphaDropoutIN4arma3MatIdEES4_E7ForwardIdEEvRKNS3_IT_EERS8_]+0xf4): undefined reference to `TLS init function for arma::mt19937_64_instance'
/usr/bin/ld: minimumReproducableCodeForMLError.cpp:(.text._ZN6mlpack3ann12AlphaDropoutIN4arma3MatIdEES4_E7ForwardIdEEvRKNS3_IT_EERS8_[_ZN6mlpack3ann12AlphaDropoutIN4arma3MatIdEES4_E7ForwardIdEEvRKNS3_IT_EERS8_]+0x104): undefined reference to `arma::mt19937_64_instance'
/usr/bin/ld: /tmp/ccNWv7em.o: in function `void mlpack::ann::DropConnect<arma::Mat<double>, arma::Mat<double> >::Forward<double>(arma::Mat<double> const&, arma::Mat<double>&)':
minimumReproducableCodeForMLError.cpp:(.text._ZN6mlpack3ann11DropConnectIN4arma3MatIdEES4_E7ForwardIdEEvRKNS3_IT_EERS8_[_ZN6mlpack3ann11DropConnectIN4arma3MatIdEES4_E7ForwardIdEEvRKNS3_IT_EERS8_]+0x16c): undefined reference to `TLS init function for arma::mt19937_64_instance'
/usr/bin/ld: minimumReproducableCodeForMLError.cpp:(.text._ZN6mlpack3ann11DropConnectIN4arma3MatIdEES4_E7ForwardIdEEvRKNS3_IT_EERS8_[_ZN6mlpack3ann11DropConnectIN4arma3MatIdEES4_E7ForwardIdEEvRKNS3_IT_EERS8_]+0x17c): undefined reference to `arma::mt19937_64_instance'
collect2: error: ld returned 1 exit status
编辑1:
根据下面评论中的要求,我尝试nm
在我的输出文件、犰狳和 mlpack 上运行工具,这就是输出。
所以,我厌倦了犰狳和 mlpack 我得到了一些我做的值 nm --demangle libarmadillo.so.10.7.4 | grep arma::mt 我得到了
00000000000008 B arma::mt19937_64_instance
00000000000cdd0 T TLS init function for arma::mt19937_64_instance
对于 libmlpack.so.3.4 我得到了
U arma::mat19937_64_instance
000000199730 W void arma::op_stddev::apply<arma::Mat..........................> //This line doesn't have mat19937_64
U TLS init function for arma::mt19937_64_instance