agordon / fastx_toolkit

FASTA/FASTQ pre-processing programs
Other
167 stars 60 forks source link

Suggested patch for clang 6 #20

Open outpaddling opened 6 years ago

outpaddling commented 6 years ago

Build fails under clang 6 due to #pragma pack change during compilation.

We could either build everything with -fpack-struct=1 or restore default packing size after the struct def as shown in the patch below.

--- src/libfastx/fastx.h.orig   2018-05-16 14:50:08 UTC
+++ src/libfastx/fastx.h
@@ -58,7 +58,7 @@ typedef enum {
        OUTPUT_SAME_AS_INPUT=3
 } OUTPUT_FILE_TYPE;

-#pragma pack(1) 
+#pragma pack(push,1) 
 typedef struct 
 {
        /* Record data - common for FASTA/FASTQ */
@@ -115,6 +115,7 @@ typedef struct 
        FILE*   input;
        FILE*   output;
 } FASTX ;
+#pragma pack(pop)

 void fastx_init_reader(FASTX *pFASTX, const char* filename, 
KaushikPanda1 commented 4 years ago

I really appreciate you posting the patch. It worked for me to install fastx_toolkit-0.0.14 in Mac OS Catalina - 10.15.5

outpaddling commented 4 years ago

Good to know. :)

srivats-venkat commented 3 years ago

Sorry if this is a naive question, but how would one implement this patch?

outpaddling commented 3 years ago

The proper way is save the patch to a text file, say "fastx.patch". Since I embedded it in the message rather than upload a file, you can do this by copying and pasting.

Then run

cd fastx_toolkit-0.0.14
patch < /path/to/fastx.patch

Since the patch is so simple, you could also just manually edit the file, removing lines that begin with '-' in the patch and adding those that begin with '+'.

srivats-venkat commented 3 years ago

That worked beautifully, thank you very much :) fastx_toolkit-0.0.14 on Big Sur 11.2.3

ivagljiva commented 2 years ago

Thank you so much for this fix!

It helped me solve the following error when installing fastx_toolkit on Mac OS Monterey 12.1, which happened during the make step (following successful ./configure):

fastx.c:29:10: error: the current #pragma pack alignment value is modified in the included file [-Werror,-Wpragma-pack]

And this is how I implemented the above patch:

  1. copy-paste the patch into a file called fastx.patch
  2. run patch < fastx.patch as suggested above, and when asked for File to patch:, enter the following file: src/libfastx/fastx.h
  3. continue with make and sudo make install to finish the installation.
outpaddling commented 2 years ago

The patch as provided assumes that "src" is a subdirectory of the current working directory. You can see that from:

--- src/libfastx/fastx.h.orig   2018-05-16 14:50:08 UTC
+++ src/libfastx/fastx.h

I updated the instructions above to reflect that. If you're deeper into the directory structure, you can strip off some path components using -p, e.g. if CWD is src/libfastx, then:

patch -p2 < /path/to/patch

Note also that you can avoid a lot of struggles like this one and get easy installation of thousands of packages by using a package manager. See https://repology.org/. I maintain a FreeBSD port and a pkgsrc package with this patch integrated. pkgsrc works on all POSIX platforms and does not require admin rights. I used it extensively on CentOS in the recent past and currently on macOS. The auto-pkgsrc-setup will make it easier to get started. Note that fastx-toolkit is not yet committed to pkgsrc proper. It is currently in the WIP collection.

outpaddling commented 2 years ago

BTW, I assume everyone has seen the deprecation notice in the README?

https://github.com/agordon/fastx_toolkit/blob/master/README

Some of the "better" tools mentioned there might include seqkit, seqtk, cutadapt for trimming, etc. I'm not much of a golang fan, but I will say that seqkit is one of the cleanest projects of the thousands I've ported over the years.

I've written a few tools of my own that overlap fastx_toolkit as well:

https://github.com/auerlab/biolibc-tools https://github.com/auerlab/fastq-trim

lizsobolik commented 11 months ago

Thanks for this!!!! I was able to install last stable version of fastx_toolkit (cloned from github) on macOS Monterey 12.0.1. Using this to reproduce an old script written by former lab member.