Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CQF compilation fails with gcc 6.2 #1775

Closed
ctb opened this issue Sep 7, 2017 · 5 comments
Closed

CQF compilation fails with gcc 6.2 #1775

ctb opened this issue Sep 7, 2017 · 5 comments

Comments

@ctb
Copy link
Member

ctb commented Sep 7, 2017

% make
./setup.py build_ext --inplace
running build_ext
bash -c cd third-party/cqf && make
make[1]: Entering directory `/mnt/research/ged/ctb/khmer/third-party/cqf'
g++ -std=c++11 -fPIC -Wall   -Ofast  -m64 -I. -Wno-unused-result -Wno-strict-ali
asing -Wno-unused-function  gqf.c -c -o gqf.o
cc1plus: error: invalid option argument ‘-Ofast’
cc1plus: error: unrecognized command line option "-std=c++11"
cc1plus: warning: unrecognized command line option "-Wno-unused-result"
make[1]: *** [gqf.o] Error 1
make[1]: Leaving directory `/mnt/research/ged/ctb/khmer/third-party/cqf'
error: command 'bash' failed with exit status 2
make: *** [khmer/_khmer.cpython-35m-x86_64-linux-gnu.so] Error 1
% g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/opt/software/GCC/6.2/libexec/gcc/x86_64-pc-linux-gnu/6.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-6.2.0/configure --disable-multilib --prefix=/opt/software/GCC/6.2
Thread model: posix
gcc version 6.2.0 (GCC)

I removed the offending lines and things seemed to work (compilation succeeded, at least).

% git diff
diff --git a/third-party/cqf/Makefile b/third-party/cqf/Makefile
index 2fc9ba2..3ca26a3 100644
--- a/third-party/cqf/Makefile
+++ b/third-party/cqf/Makefile
@@ -5,7 +5,7 @@ ifdef D
        OPT=
 else
        DEBUG=
-       OPT=-Ofast
+       OPT=-O3
 endif
 
 # using the SSE4.2 extensions doesn't seem to speed things up by a large
@@ -23,9 +23,9 @@ ifdef P
        PROFILE=-pg -no-pie # for bug in gprof.
 endif
 
-CXX = g++ -std=c++11 -fPIC
-CC = g++ -std=c++11 -fPIC
-LD= g++ -std=c++11
+CXX = g++ -fPIC
+CC = g++ -fPIC
+LD= g++
 
 CXXFLAGS = -Wall $(DEBUG) $(PROFILE) $(OPT) $(ARCH) -m64 -I. -Wno-unused-result

@ctb
Copy link
Member Author

ctb commented Sep 7, 2017

all tests passed. Note, this is on the MSU HPC:

module load GNU/6.2
module load Python/3.5.0

@betatim
Copy link
Member

betatim commented Sep 12, 2017

This seems super weird. Both command-line options should be valid. What is the version of g++ you get without setting up gcc 6.2? Wondering if because of bash -c cd third-party/cqf && make the shell in which make runs doesn't inherit the setup?

@betatim
Copy link
Member

betatim commented Sep 12, 2017

Probably adding something like @echo $(shell which $(CXX)) to the all target in the cqf Makefile so we can see the path to g++ will help.

@ctb
Copy link
Member Author

ctb commented Oct 11, 2017

...this appears to have been fixed invisibly on the HPC; perhaps there was a wonky install or something. At any rate my patchfix stopped working and when I did a clean checkout of the spacegraphcats branch, compilation succeeded and tests passed. so... Whatevs.

@ctb ctb closed this as completed Oct 11, 2017
@ctb
Copy link
Member Author

ctb commented Oct 27, 2017

OK, ran into the problem again - it was "solved" before because I reverted the branch I was working on to something fairly old, and so the problem cropped up when I updated to the latest master!

Here's a fix for GCC 6.2 -

diff --git a/third-party/cqf/Makefile b/third-party/cqf/Makefile
index 2fc9ba2..fd3cfa3 100644
--- a/third-party/cqf/Makefile
+++ b/third-party/cqf/Makefile
@@ -5,7 +5,7 @@ ifdef D
        OPT=
 else
        DEBUG=
-       OPT=-Ofast
+       OPT=-O3
 endif
 
 # using the SSE4.2 extensions doesn't seem to speed things up by a large
@@ -23,9 +23,9 @@ ifdef P
        PROFILE=-pg -no-pie # for bug in gprof.
 endif
 
-CXX = g++ -std=c++11 -fPIC
-CC = g++ -std=c++11 -fPIC
-LD= g++ -std=c++11
+CXX = g++ -std=c++0x -fPIC
+CC = g++ -std=c++0x -fPIC
+LD= g++ -std=c++0x
 
 CXXFLAGS = -Wall $(DEBUG) $(PROFILE) $(OPT) $(ARCH) -m64 -I. -Wno-unused-result
 
diff --git a/third-party/cqf/gqf.c b/third-party/cqf/gqf.c
index 6ac1d5e..e7e4493 100644
--- a/third-party/cqf/gqf.c
+++ b/third-party/cqf/gqf.c
@@ -28,6 +28,12 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <sys/mman.h>
+#include <cstdint>
+#include <limits>
+
+#ifndef UINT64_MAX
+#define UINT64_MAX std::numeric_limits<std::uint64_t>::max();
+#endif
 
 #include "gqf.h"
 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants