clang: error



  • hi,

    ich arbeite unter osx und verwende c++ mit cuda6.

    ich habe nun folgenden compile error:

    make
    g++ -std=c++11 -ggdb -I/usr/local/cuda/include main.cpp -c -o main.o
    g++ -std=c++11 -ggdb -I/usr/local/cuda/include Common.cpp -c -o Common.o
    /usr/local/cuda/bin/nvcc -m32 -arch=compute_30 -code=sm_30 -c -I/usr/local/cuda/include CUDA_ConvNN.cu -c -o CUDA_ConvNN.o
    clang: error: unknown argument: '-malign-double' [-Wunused-command-line-argument-hard-error-in-future]
    clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
    make: *** [CUDA_ConvNN.o] Error 1
    geralds-mbp:convnn geraldstanje$ make clean
    rm -rf *.o convnn
    geralds-mbp:convnn geraldstanje$ make
    g++ -std=c++11 -ggdb -I/usr/local/cuda/include main.cpp -c -o main.o
    g++ -std=c++11 -ggdb -I/usr/local/cuda/include Common.cpp -c -o Common.o
    /usr/local/cuda/bin/nvcc -m32 -arch=compute_30 -code=sm_30 -c -I/usr/local/cuda/include CUDA_ConvNN.cu -c -o CUDA_ConvNN.o
    clang: error: unknown argument: '-malign-double' [-Wunused-command-line-argument-hard-error-in-future]
    clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
    make: *** [CUDA_ConvNN.o] Error 1
    

    nach kurzer suche gibt es diese loesung:
    http://kaspermunck.github.io/2014/03/fixing-clang-error/

    wie kann ich ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future in meinem makefile integrieren? das muss vor dem compiler aufruf gesetzt werden...



  • Dieser Thread wurde von Moderator/in SeppJ aus dem Forum C++ (auch C++0x und C++11) in das Forum Rund um die Programmierung verschoben.

    Im Zweifelsfall bitte auch folgende Hinweise beachten:
    C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?

    Dieses Posting wurde automatisch erzeugt.



  • any idea?



  • Warum nicht '-malign-double' entfernen?



  • hier mein makefile, wo siehst du ein -malign-double ?

    # Compile the my CUDA examples
    
    CC=gcc -std=c++11 
    #CC=/usr/local/bin/gcc-4.8 -std=c++11
    CXX=g++ -std=c++11
    #CXX=/usr/local/bin/g++-4.8 -std=c++11
    CUDACC=/usr/local/cuda/bin/nvcc
    CUDAPATH=/usr/local/cuda
    
    CFLAGS=-ggdb -I$(CUDAPATH)/include
    CUDACFLAGS=-m32 -arch=compute_30 -code=sm_30 -c -I$(CUDAPATH)/include
    
    LDFLAGS=-L/usr/local/cuda/lib -lcuda -lcublas -lcudart 
    RM=rm -rf
    
    CUDA_SOURCES=CUDA_ConvNN.cu
    SOURCES=main.cpp Common.cpp
    CUDA_OBJECTS=$(CUDA_SOURCES:.cu=.o)
    OBJECTS=$(SOURCES:.cpp=.o)
    
    .SUFFIXES: .cpp .cu .o
    
    all: convnn
    
    convnn: Common.h CUDA_Common.h Settings.h $(OBJECTS) $(CUDA_OBJECTS)
    	$(CXX) -lopencv_core -lopencv_highgui -lopencv_imgproc $(LDFLAGS) $(CUDA_OBJECTS) $(OBJECTS) -o convnn
    
    clean:
    	$(RM) *.o convnn
    
    .cpp.o:
    	$(CXX) $(CFLAGS) $< -c -o $@
    
    #.cu.o:
    #	$(CUDACC) --compiler-bindir /usr/local/bin $(CUDACFLAGS) $< -c -o $@
    .cu.o:
    	$(CUDACC) $(CUDACFLAGS) $< -c -o $@
    


  • hier nochmal erklaert, wie das problem verursacht wird:
    https://langui.sh/2014/03/10/wunused-command-line-argument-hard-error-in-future-is-a-harsh-mistress/

    zu beachten ist: gcc heisst hier auf osx: clang compiler wird verwendet.



  • hab nun das makefile selbst per hand geschrieben aber bekomme nun:

    make
    /usr/local/cuda/bin/nvcc -O3 -c -g -arch=compute_30 -code=sm_30 CUDA_ConvNN.cu -I/Developer/NVIDIA/CUDA-6.0/include/
    g++ -std=c++11  -I/usr/local/cuda/include main.cpp
    Undefined symbols for architecture x86_64:
      "CentreData(Dataset&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&)", referenced from:
          RunCUDA_CNN_2(int, float, int) in main-c54edb.o
          RunCUDA_CNN_1(int, float, int) in main-c54edb.o
      "CalcMean(Dataset&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&)", referenced from:
          RunCUDA_CNN_2(int, float, int) in main-c54edb.o
          RunCUDA_CNN_1(int, float, int) in main-c54edb.o
      "LoadData(char const*, Dataset&)", referenced from:
          RunCUDA_CNN_2(int, float, int) in main-c54edb.o
          RunCUDA_CNN_1(int, float, int) in main-c54edb.o
      "cv::_InputArray::_InputArray(cv::Mat const&)", referenced from:
          SaveWeights(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, float const*, int, int, int) in main-c54edb.o
          OutputResultsForSite(CNN::CudaConvNN&, Dataset const&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&) in main-c54edb.o
      "cv::_OutputArray::_OutputArray(cv::Mat const&)", referenced from:
          OutputResultsForSite(CNN::CudaConvNN&, Dataset const&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&) in main-c54edb.o
      "cv::_OutputArray::_OutputArray(cv::Mat&)", referenced from:
          SaveWeights(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, float const*, int, int, int) in main-c54edb.o
          OutputResultsForSite(CNN::CudaConvNN&, Dataset const&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&) in main-c54edb.o
      "cv::Mat::deallocate()", referenced from:
          cv::Mat::release() in main-c54edb.o
      "cv::Mat::zeros(int, int, int)", referenced from:
          SaveWeights(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, float const*, int, int, int) in main-c54edb.o
          OutputResultsForSite(CNN::CudaConvNN&, Dataset const&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&) in main-c54edb.o
      "cv::Mat::create(int, int const*, int)", referenced from:
          cv::Mat::create(int, int, int) in main-c54edb.o
      "cv::Mat::Mat(cv::Mat const&, cv::Rect_<int> const&)", referenced from:
          cv::Mat::operator()(cv::Rect_<int> const&) const in main-c54edb.o
      "cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)", referenced from:
          SaveWeights(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, float const*, int, int, int) in main-c54edb.o
          OutputResultsForSite(CNN::CudaConvNN&, Dataset const&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&) in main-c54edb.o
      "cv::imwrite(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cv::_InputArray const&, std::__1::vector<int, std::__1::allocator<int> > const&)", referenced from:
          SaveWeights(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, float const*, int, int, int) in main-c54edb.o
          OutputResultsForSite(CNN::CudaConvNN&, Dataset const&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&) in main-c54edb.o
      "cv::putText(cv::Mat&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cv::Point_<int>, int, double, cv::Scalar_<double>, int, int, bool)", referenced from:
          OutputResultsForSite(CNN::CudaConvNN&, Dataset const&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&) in main-c54edb.o
      "cv::fastFree(void*)", referenced from:
          cv::Mat::~Mat() in main-c54edb.o
      "CNN::CudaConvNN::FeedForward()", referenced from:
          RunCUDA_CNN_2(int, float, int) in main-c54edb.o
          RunCUDA_CNN_1(int, float, int) in main-c54edb.o
          RunValidation(CNN::CudaConvNN&, Dataset const&) in main-c54edb.o
          RunValidation2(CNN::CudaConvNN&, Dataset const&) in main-c54edb.o
          GradientChecker(CNN::CudaConvNN&, Dataset&) in main-c54edb.o
          OutputResultsForSite(CNN::CudaConvNN&, Dataset const&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&) in main-c54edb.o
      "CNN::CudaConvNN::LoadWeights()", referenced from:
          RunCUDA_CNN_2(int, float, int) in main-c54edb.o
          RunCUDA_CNN_1(int, float, int) in main-c54edb.o
      "CNN::CudaConvNN::SaveWeights()", referenced from:
          RunCUDA_CNN_2(int, float, int) in main-c54edb.o
          RunCUDA_CNN_1(int, float, int) in main-c54edb.o
      "CNN::CudaConvNN::TotalMemUsed()", referenced from:
          RunCUDA_CNN_2(int, float, int) in main-c54edb.o
          RunCUDA_CNN_1(int, float, int) in main-c54edb.o
      "CNN::CudaConvNN::Init(int, int, int, int)", referenced from:
          RunCUDA_CNN_2(int, float, int) in main-c54edb.o
          RunCUDA_CNN_1(int, float, int) in main-c54edb.o
      "CNN::CudaConvNN::AddLayer(CNN::LayerType)", referenced from:
          RunCUDA_CNN_2(int, float, int) in main-c54edb.o
          RunCUDA_CNN_1(int, float, int) in main-c54edb.o
      "CNN::CudaConvNN::AddLayer(CNN::LayerType, int)", referenced from:
          RunCUDA_CNN_2(int, float, int) in main-c54edb.o
          RunCUDA_CNN_1(int, float, int) in main-c54edb.o
      "CNN::CudaConvNN::AddLayer(CNN::LayerType, int, int)", referenced from:
          RunCUDA_CNN_2(int, float, int) in main-c54edb.o
          RunCUDA_CNN_1(int, float, int) in main-c54edb.o
      "CNN::CudaConvNN::BackProp(float, float)", referenced from:
          RunCUDA_CNN_2(int, float, int) in main-c54edb.o
          RunCUDA_CNN_1(int, float, int) in main-c54edb.o
          GradientChecker(CNN::CudaConvNN&, Dataset&) in main-c54edb.o
      "CNN::CudaConvNN::SetImages(float const*, unsigned long)", referenced from:
          RunCUDA_CNN_2(int, float, int) in main-c54edb.o
          RunCUDA_CNN_1(int, float, int) in main-c54edb.o
          RunValidation(CNN::CudaConvNN&, Dataset const&) in main-c54edb.o
          RunValidation2(CNN::CudaConvNN&, Dataset const&) in main-c54edb.o
          GradientChecker(CNN::CudaConvNN&, Dataset&) in main-c54edb.o
          OutputResultsForSite(CNN::CudaConvNN&, Dataset const&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&) in main-c54edb.o
      "CNN::CudaConvNN::SetLabels(float const*, unsigned long)", referenced from:
          RunCUDA_CNN_2(int, float, int) in main-c54edb.o
          RunCUDA_CNN_1(int, float, int) in main-c54edb.o
          RunValidation(CNN::CudaConvNN&, Dataset const&) in main-c54edb.o
          RunValidation2(CNN::CudaConvNN&, Dataset const&) in main-c54edb.o
          GradientChecker(CNN::CudaConvNN&, Dataset&) in main-c54edb.o
          OutputResultsForSite(CNN::CudaConvNN&, Dataset const&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&) in main-c54edb.o
      "CNN::CudaConvNN::CudaConvNN()", referenced from:
          RunCUDA_CNN_2(int, float, int) in main-c54edb.o
          RunCUDA_CNN_1(int, float, int) in main-c54edb.o
      "CNN::CudaConvNN::~CudaConvNN()", referenced from:
          RunCUDA_CNN_2(int, float, int) in main-c54edb.o
          RunCUDA_CNN_1(int, float, int) in main-c54edb.o
      "CNN::Layer::GetWeights(std::__1::vector<float, std::__1::allocator<float> >&)", referenced from:
          RunCUDA_CNN_2(int, float, int) in main-c54edb.o
          RunCUDA_CNN_1(int, float, int) in main-c54edb.o
      "CNN::Layer::SetWeights(float const*)", referenced from:
          RunCUDA_CNN_2(int, float, int) in main-c54edb.o
          RunCUDA_CNN_1(int, float, int) in main-c54edb.o
      "CNN::Layer::GetWeightValue(int)", referenced from:
          GradientChecker(CNN::CudaConvNN&, Dataset&) in main-c54edb.o
      "CNN::Layer::SetWeightValue(int, float)", referenced from:
          GradientChecker(CNN::CudaConvNN&, Dataset&) in main-c54edb.o
      "CNN::Layer::GetSumWeightGrad(std::__1::vector<float, std::__1::allocator<float> >&)", referenced from:
          GradientChecker(CNN::CudaConvNN&, Dataset&) in main-c54edb.o
      "CNN::Layer::GetOutput(std::__1::vector<float, std::__1::allocator<float> >&)", referenced from:
          RunValidation(CNN::CudaConvNN&, Dataset const&) in main-c54edb.o
          RunValidation2(CNN::CudaConvNN&, Dataset const&) in main-c54edb.o
          GradientChecker(CNN::CudaConvNN&, Dataset&) in main-c54edb.o
          OutputResultsForSite(CNN::CudaConvNN&, Dataset const&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&) in main-c54edb.o
      "cv::Mat::copyTo(cv::_OutputArray const&) const", referenced from:
          OutputResultsForSite(CNN::CudaConvNN&, Dataset const&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&, std::__1::vector<float, std::__1::allocator<float> >&) in main-c54edb.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [main.o] Error 1
    

Anmelden zum Antworten