biosails / pheniqs

Fast and accurate sequence demultiplexing
Other
26 stars 4 forks source link

Compile on linux? #4

Closed jerowe closed 6 years ago

jerowe commented 6 years ago

Pinging @nizardrou

The makefile specifically references clang, which is an osx only thing. Can I do a dropin replacement for gcc?

I will try somethings from my side, but what I would really like to see from your side is a minimal docker image with pheniq installed.

jerowe commented 6 years ago

I created a patch to drop in gcc for clang.

Disregard this. Updated below.

jerowe commented 6 years ago

New patch and errors.

--- Makefile    2018-04-22 10:21:13.000000000 +0400
+++ Makefile    2018-04-22 10:40:26.000000000 +0400
@@ -30,15 +30,17 @@
 MAJOR_REVISON := 1
 MINOR_REVISON := 1

-CC              = clang++
 PREFIX          = /usr/local
 BIN_PREFIX      = $(PREFIX)/bin
 INCLUDE_PREFIX  = $(PREFIX)/include
 LIB_PREFIX      = $(PREFIX)/lib

-CFLAGS          = -std=c++11 -O3 -Wall -Wsign-compare
-LDFLAGS         =
-LIBS            = -lhts -lz -lbz2 -llzma
+CFLAGS          += -std=c++11 -O3 -Wall -Wsign-compare
+LDFLAGS         +=
+LIBS            += -lhts -lz -lbz2 -llzma
+
+CFLAGS += -I$(INCLUDE_PREFIX)
+LDFLAGS += -L$(LIB_PREFIX)

 STATIC_LIBS = \
 $(LIB_PREFIX)/libhts.a \
@@ -94,11 +96,6 @@
        override PHENIQS_VERSION := $(PHENIQS_VERSION).$(PHENIQS_GIT_VERSION)
 endif

-ifdef PREFIX
-       CFLAGS += -I$(INCLUDE_PREFIX)
-       LDFLAGS += -L$(LIB_PREFIX)
-endif
-
 all: $(PHENIQS_SOURCES) configuration.h version.h $(PHENIQS_OBJECTS)
        $(CC) $(PHENIQS_OBJECTS) $(LDFLAGS) -pthread $(LIBS) -o $(PHENIQS_EXECUTABLE)
kstring.h:281:1: warning: multi-line comment [-Wcomment]
 // #define kroundup_size_t(x) (--(x),                                       \
 ^
cc -I/opt/conda/conda-bld/pheniqs_1524379253526/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_
placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_place/include -I/opt/conda/conda-bld/pheniqs_1524379253526/_h_env_placehold
_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac
ehold_placehold_placehold_place/include/rapidjson -std=c++11 -O3 -Wall -Wsign-compare -I/usr/local/include -c -o interface.o interface.cpp
In file included from json.h:42:0,
                 from url.h:34,
                 from interface.h:37,
                 from interface.cpp:2:
kstring.h:281:1: warning: multi-line comment [-Wcomment]
 // #define kroundup_size_t(x) (--(x),                                       \
 ^
In file included from interface.cpp:4:0:
configuration.h:2:1: error: stray ‘\’ in program
 const char configuration_json[] = {\n    0x7b, 0x0a, 0x22, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x20,
 ^
configuration.h:467:5: error: stray ‘\’ in program
     0x6c, 0x61, 0x76, 0x6f, 0x72, 0x21, 0x22, 0x0a, 0x7d, 0x0a,\n};
     ^
configuration.h:2:37: error: ‘n’ was not declared in this scope
 const char configuration_json[] = {\n    0x7b, 0x0a, 0x22, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x20,
                                     ^
configuration.h:2:42: error: expected ‘}’ before numeric constant
 const char configuration_json[] = {\n    0x7b, 0x0a, 0x22, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x20,
                                          ^
configuration.h:2:42: error: expected ‘,’ or ‘;’ before numeric constant
configuration.h:467:66: error: expected declaration before ‘}’ token
     0x6c, 0x61, 0x76, 0x6f, 0x72, 0x21, 0x22, 0x0a, 0x7d, 0x0a,\n};
jerowe commented 6 years ago

I also created a patch to remove the '\n' characters from the configuration.h file.

--- configuration.sh    2018-04-22 10:45:53.000000000 +0400
+++ configuration.sh    2018-04-22 10:50:53.000000000 +0400
@@ -26,3 +26,5 @@

 echo "const char configuration_json[] = \
 {\n    $(cat configuration.json | sed -E 's/^ +//g' | hexdump -v -e '12/1 "0x%02x, " "\n" "    "' | sed -E 's/( 0x  ,)*$//' | grep -vE "^\s+$")\n};" >> configuration.h;
+tr '\n' ' ' < configuration.h > out.t
+mv out.t configuration.h

But then I got an error somewhere with the interface.o

jerowe commented 6 years ago

Ok, I have hit a wall with this. How's about we make a plan of attack.

  1. Please build a minimal install example script, on linux, preferably with docker.
  2. The minimal install script should remove hardcoded variables things like PREFIX, CFLAGS, INCLUDE_PATH, CC etc from the Makefile.

If you get the minimal install script working on a docker image, and give me write access to the repo, I will get a CI service setup to at least test that it builds on both linux and mac. From there I can build it as a conda package.

jerowe commented 6 years ago

Updates?

moonwatcher commented 6 years ago

Sorry, just noticed this.

clang is not an MacOS thing, its an llvm compiler that often yields faster executables than gcc, but it should all build on gcc. https://clang.llvm.org

I see you have some issues with my xxd replacement. maybe I got something wrong, can you you please post what the configuration.h file looks like? I tried to make it look similar to what xxd emits.

I will run a set of tests tomorrow to see how everything builds on gcc and make adjustments, but clang was faster in my benchmarks on linux...

moonwatcher commented 6 years ago

Also use g++ not gcc. I will do some testing for gcc on both MacOS and linux before the next commit but please provide some feedback about the xxd replacement script.

jerowe commented 6 years ago

clang is not available on the conda-forge/bioconda linux build system. Could you try for gcc? That is the path of least resistance.

On Thu, May 3, 2018 at 10:33 AM Lior Galanti notifications@github.com wrote:

Also use g++ not gcc. I will do some testing for gcc on both MacOS and linux before the next commit but please provide some feedback about the xxd replacement script.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/biosails/pheniqs/issues/4#issuecomment-386202631, or mute the thread https://github.com/notifications/unsubscribe-auth/AFTFRgaGDMob0q9y8EX_OXI5nCQFbSh-ks5tuqSkgaJpZM4TevnS .

moonwatcher commented 6 years ago

g++ is gcc. gcc is for C code while g++ automatically links to the C++ system libraries.

https://stackoverflow.com/questions/172587/what-is-the-difference-between-g-and-gcc