htgt / CRISPR-Analyser

C++ package for analysing CRISPR off targets
MIT License
21 stars 8 forks source link

Unable to compile #14

Closed drchriscole closed 7 years ago

drchriscole commented 7 years ago

Hi,

I'm trying to compile the code, but errors (see below). Any help much appreciated.

Chris

$ ~/github/CRISPR-Analyser> make Building mongoose mkdir -p include mkdir -p lib make -C vpiotr-mongoose-cpp linux && mv vpiotr-mongoose-cpp/libmongoose.so lib && cp vpiotr-mongoose-cpp/mongoose.h include/ make[1]: Entering directory /cluster/gjb_lab/ccole/github/CRISPR-Analyser/vpiotr-mongoose-cpp' cc mongoose.c -shared -fPIC -fpic -o libmongoose.so -Wl,-soname,libmongoose.so -ldl -pthread -std=c99 -O2 -W -Wall -pedantic cc mongoose.c main.c -o mongoose -ldl -pthread -std=c99 -O2 -W -Wall -pedantic make[1]: Leaving directory/cluster/gjb_lab/ccole/github/CRISPR-Analyser/vpiotr-mongoose-cpp' Building mongoose c++ bindings cd vpiotr-mongoose-cpp && g++ -c -Wall -pthread -o ../build/mongcpp.o mongcpp.cpp -pthread -ldl -Llib -lmongoose && cp mongcpp.h ../include/ mongcpp.cpp:644: warning: ignoring #pragma warning mongcpp.cpp:645: warning: ignoring #pragma warning g++ -std=c++0x -O3 -W -Wall -pedantic -O0 -DDEBUG -g -c -Iinclude -o build/crisprutil.o src/crisprutil.cpp In file included from src/crisprutil.cpp:15: src/utils.h: In function ‘std::string util::format_off_targets(const T&)’: src/utils.h:82: error: call of overloaded ‘to_string(uint64_t&)’ is ambiguous /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/basic_string.h:2604: note: candidates are: std::string std::to_string(long long int) /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/basic_string.h:2610: note: std::string std::to_string(long long unsigned int) /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/basic_string.h:2616: note: std::string std::to_string(long double) src/utils.h: In function ‘std::string util::to_postgres_array(const T&, bool)’: src/utils.h:118: error: ‘struct std::string’ has no member named ‘front’ src/utils.h:119: error: ‘struct std::string’ has no member named ‘back’ src/utils.h: In function ‘std::string util::to_json_array(const T&, bool) [with T = std::vector<long unsigned int, std::allocator >]’: src/crisprutil.cpp:612: instantiated from here src/utils.h:104: error: call of overloaded ‘to_string(const long unsigned int&)’ is ambiguous /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/basic_string.h:2604: note: candidates are: std::string std::to_string(long long int) /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/basic_string.h:2610: note: std::string std::to_string(long long unsigned int) /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/basic_string.h:2616: note: std::string std::to_string(long double) make: *\ [build/crisprutil.o] Error 1

ah19 commented 7 years ago

front and back were added to std::string in C++11; does your compiler support C++11?

drchriscole commented 7 years ago

Thanks for the super fast response. Not sure. I was using g++ 4.4.7. Now trying with g++ 4.9.3 and am getting different errors: $ ~/github/CRISPR-Analyser> make Building mongoose mkdir -p include mkdir -p lib make -C vpiotr-mongoose-cpp linux && mv vpiotr-mongoose-cpp/libmongoose.so lib && cp vpiotr-mongoose-cpp/mongoose.h include/ make[1]: Entering directory /cluster/gjb_lab/ccole/github/CRISPR-Analyser/vpiotr-mongoose-cpp' g++ mongoose.c -shared -fPIC -fpic -o libmongoose.so -Wl,-soname,libmongoose.so -ldl -pthread -std=c99 -O2 -W -Wall -pedantic cc1plus: warning: command line option ‘-std=c99’ is valid for C/ObjC but not for C++ In file included from mongoose.c:227:0: mongoose.h:134:12: warning: comma at end of enumerator list [-Wpedantic] MG_UPLOAD, ^ mongoose.c: In function ‘int is_file_in_memory(mg_connection*, const char*, file*)’: mongoose.c:541:52: error: invalid conversion from ‘void*’ to ‘const char*’ [-fpermissive] if ((filep->membuf = call_user(conn, MG_OPEN_FILE)) != NULL) { ^ mongoose.c: In function ‘void MD5Final(unsigned char*, MD5_CTX*)’: mongoose.c:2164:28: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((uint32_t *) ctx->in)[14] = ctx->bits[0]; ^ mongoose.c:2165:28: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((uint32_t *) ctx->in)[15] = ctx->bits[1]; ^ mongoose.c: In function ‘char* mg_fgets(char*, size_t, file*, char**)’: mongoose.c:2334:60: error: invalid conversion from ‘void*’ to ‘char*’ [-fpermissive] eof = memchr(*p, '\n', &filep->membuf[filep->size] - *p); ^ mongoose.c: In function ‘void reset_per_request_attributes(mg_connection*)’: mongoose.c:4623:19: error: invalid conversion from ‘void*’ to ‘char*’ [-fpermissive] conn->path_info = conn->request_info.ev_data = NULL; ^ make[1]: *** [linux] Error 1 make[1]: Leaving directory/cluster/gjb_lab/ccole/github/CRISPR-Analyser/vpiotr-mongoose-cpp' make: *\ [mongoose] Error 2

dparrysmith commented 7 years ago

Hi Chris,

I have created a Redhat instance on AWS and installed the Development tools:

sudo yum group install "Development tools"

That gives me:

[ec2-user@ip-172-31-37-120 CRISPR-Analyser]$ gcc --version gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[ec2-user@ip-172-31-37-120 CRISPR-Analyser]$ g++ --version g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[ec2-user@ip-172-31-37-120 CRISPR-Analyser]$

The compile then proceeds correctly and produces an executable.

Let me know how you get on.

David Parry-Smith Group Leader Stem Cell Informatics Wellcome Trust Sanger Institute

drchriscole commented 7 years ago

Hi David,

Many thanks for your efforts in trying to resolve this.

It looks like you've spun up a RedHat 7 instance. Unfortunately, we're still running RedHat (CentOS actually) 6 here. The base version of gcc is 4.4.7 in Centos 6. Our admins have installed newer versions of GCC (v4.8.1 and v4.9.3) both of which give the above error.

Is there any chance of making pre-compiled binaries available? Regards,

Chris

dparrysmith commented 7 years ago

Hi Chris,

I will try compiling on your version of CentOS. Please can you give me the output of ‘uname –a’ on your system so that I can get the architecture right? It sounds like you are just missing something form the compile time environment.

Thanks,

David

David Parry-Smith PhD

Senior Scientific Manager & Group Leader

Stem Cell Informatics

Wellcome Trust Sanger Institute

01223 834244 ext 8782

@perlmonkey

From: Chris Cole notifications@github.com Reply-To: htgt/CRISPR-Analyser reply@reply.github.com Date: Tuesday, 9 August 2016 13:05 To: htgt/CRISPR-Analyser CRISPR-Analyser@noreply.github.com Cc: David Parry-Smith dp10@sanger.ac.uk, Comment comment@noreply.github.com Subject: Re: [htgt/CRISPR-Analyser] Unable to compile (#14)

Hi David,

Many thanks for your efforts in trying to resolve this.

It looks like you've spun up a RedHat 7 instance. Unfortunately, we're still running RedHat (CentOS actually) 6 here. The base version of gcc is 4.4.7 in Centos 6. Our admins have installed newer versions of GCC (v4.8.1 and v4.9.3) both of which give the above error.

Is there any chance of making pre-compiled binaries available? Regards,

Chris

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

drchriscole commented 7 years ago

It's: Linux xxxx.dundee.ac.uk 2.6.32-504.30.3.el6.centos.plus.x86_64 #1 SMP Wed Jul 15 00:52:19 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

dparrysmith commented 7 years ago

Thanks. One last piece of information. Please supply the output of

cat /etc/centos-release

Thanks,

David

David Parry-Smith PhD

Senior Scientific Manager & Group Leader

Stem Cell Informatics

Wellcome Trust Sanger Institute

01223 834244 ext 8782

@perlmonkey

From: Chris Cole notifications@github.com Reply-To: htgt/CRISPR-Analyser reply@reply.github.com Date: Tuesday, 9 August 2016 13:36 To: htgt/CRISPR-Analyser CRISPR-Analyser@noreply.github.com Cc: David Parry-Smith dp10@sanger.ac.uk, Comment comment@noreply.github.com Subject: Re: [htgt/CRISPR-Analyser] Unable to compile (#14)

It's: Linux xxxx.dundee.ac.uk 2.6.32-504.30.3.el6.centos.plus.x86_64 #1 SMP Wed Jul 15 00:52:19 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

drchriscole commented 7 years ago

CentOS release 6.6 (Final)

dparrysmith commented 7 years ago

Hi Chris,

I have investigated this issue and reproduced it. As Alex has already commented, you will need a compiler that fully supports C++11. The GNU gcc compiler version 4.4.7 is insufficient for this purpose. Please see here for further information and here for the recommended compiler.

The general recommendation is that you provision a server with the latest version of Centos 7 and install the development tools. Centos 6.6 is deprecated and no longer supported for security patches and updates. I was only able to install Centos 6.8 for this reason. You can then take advantage of a more up-to-date compiler.

If this is not an option, you could always install a more recent version of gcc. This is time-consuming and not for the feint hearted! I am leaving an install of gcc 6.1 running overnight and will let you know how it goes.

We are unable to supply binary distributions. Watch out for Docker containers of the CRISPR tools but you may still have the same problem with your version of Centos.

David

dparrysmith commented 7 years ago

Hi Chris,

I have successfully installed gcc 6.1.0 and compiled ots_server and crispr_analyser on Centos 6.8

This process should work on your version of Centos as well. Creating staticly compiled binaries for you to download is a more complicated process. I had a quick look this morning and may return to it later.

Please let me know how it goes.

David

Dr David Parry-Smith Group Leader Stem Cell Informatics Wellcome Trust Sanger Institute

perlmonkey commented 7 years ago

Excellent work! Always use the latest compiler toolchain. Can I be taken off CC now? ;) -D

Sent from my iPhone

On Aug 10, 2016, at 2:53 AM, David Parry-Smith notifications@github.com wrote:

Hi Chris,

I have successfully installed gcc 6.1.0 and compiled ots_server and crispr_analyser on Centos 6.8

This process should work on your version of Centos as well. Creating staticly compiled binaries for you to download is a more complicated process. I had a quick look this morning and may return to it later.

Please let me know how it goes.

David

Dr David Parry-Smith Group Leader Stem Cell Informatics Wellcome Trust Sanger Institute

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

dparrysmith commented 7 years ago

perlmonkey - you have the same id as my twitter handle. Maybe that's how you got linked to this issue. Please unsubscribe yourself.

Thanks,

David

drchriscole commented 7 years ago

Hi David,

Thanks again for the excellent feedback.

Unfortunately a CentOS upgrade is not (currently) an option. This is our cluster operating system so will be managed in time. I hadn't realised 6.6 was now unsupported, probably worth informing our IT of the fact.

As I mentioned above, we do have gcc 4.8.1 and 4.9.3 installed which according to the pages you linked to have full C++11 support. In theory they should work...?

I'll see if I can get gcc 6.1 installed, but am not hopeful given the potential dependency issues.

Many thanks for the efforts, but probably best to leave it here. The issues are clearly at my end, but will take time to resolve. Cheers,

Chris

dparrysmith commented 7 years ago

OK. If you want to continue offline email me at my Sanger address (look me up on sanger.ac.uk). I'd like to try to get you setup if we can. I'll close this ticket now.

David