CAFE icon indicating copy to clipboard operation
CAFE copied to clipboard

Error in 'make'

Open le-yuan opened this issue 5 years ago • 10 comments

(base) C19DMGD:CAFE leyu$ make g++ -c -Wall -std=c++11 -I cafe -I libtree -I libcommon -O3 -DNDEBUG -o release/cafe_commands.o cafe/cafe_commands.cpp cafe/cafe_commands.cpp:1065:12: error: call to 'abs' is ambiguous return std::abs(x - y) <= epsilon * std::abs(x); ^~~~~~~~ /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/stdlib.h:132:6: note: candidate function int abs(int) __pure2; ^ /Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:111:44: note: candidate function inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);} ^ /Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:113:44: note: candidate function inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);} ^ cafe/cafe_commands.cpp:1065:41: error: call to 'abs' is ambiguous return std::abs(x - y) <= epsilon * std::abs(x); ^~~~~~~~ /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/stdlib.h:132:6: note: candidate function int abs(int) __pure2; ^ /Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:111:44: note: candidate function inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);} ^ /Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h:113:44: note: candidate function inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);} ^ 2 errors generated. make: *** [release/cafe_commands.o] Error 1

le-yuan avatar Jun 08 '20 14:06 le-yuan

See https://github.com/hahnlab/CAFE/issues/77

benfulton avatar Jun 08 '20 14:06 benfulton

Thanks for your so quick reply. I have little knowledge in C, you suggested to add #include to cafe/cafe_commands.cpp, what do you mean?

le-yuan avatar Jun 08 '20 14:06 le-yuan

Here, I opened that file using Sublime, we can see it as below, what should I add (just '#include') and where should I add?

*/ #include "../config.h"

#include <stdio.h> #include <time.h> #include #include #include #include #include #include #include #include #include #include

#include "../config.h"

#if defined(_OPENMP) #include <omp.h> #endif

#include "lambda.h" #include "lambdamu.h" #include "cafe_commands.h" #include "reports.h" #include "pvalue.h" #include "conditional_distribution.h"

le-yuan avatar Jun 08 '20 14:06 le-yuan

Add

#include <cmath>

Just after the line that says

#include "../config.h"

benfulton avatar Jun 08 '20 16:06 benfulton

collect2: error: ld returned 1 exit status make: *** [bin/cafexp] error 1 I might had the same problem in the process of 'make' in CAFE5-5.0.0 ,could you please provide modified file,because for people like me who are not good at programming language, how to open it properly is also a problem.Thank you in advance for your help!

sulin12352 avatar Mar 22 '21 14:03 sulin12352

@https://github.com/benfulton

sulin12352 avatar Mar 23 '21 02:03 sulin12352

Please show all the output from Make that you received.

benfulton avatar Mar 23 '21 12:03 benfulton

./configure
checking for icc... no checking for g++... g++ checking whether the C++ compiler works... yes checking for C++ compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking for g++ option to support OpenMP... -fopenmp checking for floor in -lm... yes checking for library containing sgemm... no checking for library containing cblas_dgemm... no checking for library containing cblas_dgemm... no checking for library containing vdExp... no configure: creating ./config.status config.status: creating Makefile config.status: creating config.h make
g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/base_model.cpp -o obj/base_model.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/cafexp.cpp -o obj/cafexp.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/clade.cpp -o obj/clade.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/core.cpp -o obj/core.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/error_model.cpp -o obj/error_model.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/execute.cpp -o obj/execute.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/gamma_core.cpp -o obj/gamma_core.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/gamma.cpp -o obj/gamma.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/gene_family.cpp -o obj/gene_family.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/gene_family_reconstructor.cpp -o obj/gene_family_reconstructor.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/io.cpp -o obj/io.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/lambda.cpp -o obj/lambda.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/matrix_cache.cpp -o obj/matrix_cache.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/optimizer.cpp -o obj/optimizer.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/optimizer_scorer.cpp -o obj/optimizer_scorer.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/poisson.cpp -o obj/poisson.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/probability.cpp -o obj/probability.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/root_distribution.cpp -o obj/root_distribution.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/root_equilibrium_distribution.cpp -o obj/root_equilibrium_distribution.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/simulator.cpp -o obj/simulator.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c src/user_data.cpp -o obj/user_data.o g++ -std=c++11 -I. -O3 -include config.h -fopenmp -c main.cpp -o obj/main.o g++ -std=c++11 -O3 -fopenmp -o bin/cafexp -I. obj/base_model.o obj/cafexp.o obj/clade.o obj/core.o obj/error_model.o obj/execute.o obj/gamma_core.o obj/gamma.o obj/gene_family.o obj/gene_family_reconstructor.o obj/io.o obj/lambda.o obj/matrix_cache.o obj/optimizer.o obj/optimizer_scorer.o obj/poisson.o obj/probability.o obj/root_distribution.o obj/root_equilibrium_distribution.o obj/simulator.o obj/user_data.o obj/main.o -lm
obj/clade.o:在函数‘parse_newick(std::string, bool)’中: clade.cpp:(.text+0x474d):对‘std::regex_iterator<__gnu_cxx::__normal_iterator<char const*, std::string>, char, std::regex_traits >::regex_iterator(__gnu_cxx::__normal_iterator<char const*, std::string>, __gnu_cxx::__normal_iterator<char const*, std::string>, std::basic_regex<char, std::regex_traits > const&, std::bitset<11ul>)’未定义的引用 clade.cpp:(.text+0x475a):对‘std::regex_iterator<__gnu_cxx::__normal_iterator<char const*, std::string>, char, std::regex_traits >::regex_iterator()’未定义的引用 clade.cpp:(.text+0x47c1):对‘std::regex_iterator<__gnu_cxx::__normal_iterator<char const*, std::string>, char, std::regex_traits >::operator!=(std::regex_iterator<__gnu_cxx::__normal_iterator<char const*, std::string>, char, std::regex_traits > const&)’未定义的引用 clade.cpp:(.text+0x47d6):对‘std::regex_iterator<__gnu_cxx::__normal_iterator<char const*, std::string>, char, std::regex_traits >::operator->()’未定义的引用 clade.cpp:(.text+0x4930):对‘std::regex_iterator<__gnu_cxx::__normal_iterator<char const*, std::string>, char, std::regex_traits >::operator++(int)’未定义的引用 clade.cpp:(.text+0x4971):对‘std::regex_iterator<__gnu_cxx::__normal_iterator<char const*, std::string>, char, std::regex_traits >::operator->()’未定义的引用 clade.cpp:(.text+0x4af9):对‘std::regex_iterator<__gnu_cxx::__normal_iterator<char const*, std::string>, char, std::regex_traits >::operator->()’未定义的引用 clade.cpp:(.text+0x4ce1):对‘std::regex_iterator<__gnu_cxx::__normal_iterator<char const*, std::string>, char, std::regex_traits >::operator->()’未定义的引用 clade.cpp:(.text+0x4d57):对‘std::regex_iterator<__gnu_cxx::__normal_iterator<char const*, std::string>, char, std::regex_traits >::operator->()’未定义的引用 clade.cpp:(.text+0x4de0):对‘std::regex_iterator<__gnu_cxx::__normal_iterator<char const*, std::string>, char, std::regex_traits >::operator->()’未定义的引用 obj/clade.o:clade.cpp:(.text+0x4f71): 跟着更多未定义的参考到 std::regex_iterator<__gnu_cxx::__normal_iterator<char const*, std::string>, char, std::regex_traits >::operator->() collect2: error: ld returned 1 exit status make: *** [bin/cafexp] error 1

在函数中:In the function 未定义的引用:undefined reference 跟着更多未定义的参考到:follow more undefined references to

Thanks for your help!

sulin12352 avatar Mar 23 '21 13:03 sulin12352

This indicates that the compiler you have is out of date - probably GCC 4.8? You would need to upgrade to at least 4.9. What operating system are you using?

benfulton avatar Mar 23 '21 13:03 benfulton

I'm sorry to reply you so late. I use Linux system, and everything was normal when my lab partner installed version 4. So is it because CAFE 4 was not so demanding of the compiler at the time?

sulin12352 avatar Mar 26 '21 08:03 sulin12352