sonLib icon indicating copy to clipboard operation
sonLib copied to clipboard

compile problem: comparison between pointer and zero character constant [-Wpointer-compare]

Open taoqxtaozi opened this issue 3 years ago • 6 comments

Hi,

When I compile the C files, I get such warnings:

/root/miniconda3/bin/x86_64-conda-linux-gnu-cc -std=c99 -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /root/miniconda3/include -O3 -g -Wall --pedantic -funroll-loops -DNDEBUG       -I../externalTools/quicktree_1.1/include/ -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /root/miniconda3/include -I inc -I ../lib/  -c impl/*.c
impl/bioioC.c: In function 'parseInt':
impl/bioioC.c:268:23: warning: comparison between pointer and zero character constant [-Wpointer-compare]
  268 |         while(*string != '\0' && !isspace(**string)) {
      |                       ^~
impl/bioioC.c:268:15: note: did you mean to dereference the pointer?
  268 |         while(*string != '\0' && !isspace(**string)) {
      |               ^
impl/bioioC.c: In function 'parseFloat':
impl/bioioC.c:289:23: warning: comparison between pointer and zero character constant [-Wpointer-compare]
  289 |         while(*string != '\0' && !isspace(**string)) {
      |                       ^~
impl/bioioC.c:289:15: note: did you mean to dereference the pointer?
  289 |         while(*string != '\0' && !isspace(**string)) {
      |               ^
impl/bioioC.c: In function 'parseString':
impl/bioioC.c:310:23: warning: comparison between pointer and zero character constant [-Wpointer-compare]
  310 |         while(*string != '\0' && !isspace(**string)) {
      |                       ^~
impl/bioioC.c:310:15: note: did you mean to dereference the pointer?
  310 |         while(*string != '\0' && !isspace(**string)) {
      |               ^
impl/sonLibList.c: In function 'st_list_sortP':
impl/sonLibList.c:258:13: warning: ISO C forbids conversion of object pointer to function pointer type [-Wpedantic]
  258 |     return ((int (*)(const void *, const void *))fn)(*((char **)a), *((char **)b));
      |             ^
impl/sonLibList.c: In function 'stList_sort':
impl/sonLibList.c:262:76: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
  262 |     sort_r(list->list, stList_length(list), sizeof(void *), st_list_sortP, (void *)cmpFn);
      |                                                                            ^
impl/sonLibList.c: In function 'st_list_sort2P':
impl/sonLibList.c:267:56: warning: ISO C forbids conversion of object pointer to function pointer type [-Wpedantic]
  267 |     int (*cmpFn)(const void *, const void *, void *) = (int (*)(const void *, const void *, void *))(((void **)extra)[0]);
      |                                                        ^
impl/sonLibList.c: In function 'stList_sort2':
impl/sonLibList.c:273:24: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
  273 |     void *extra[2] = { (void *)cmpFn, (void *)extraArg };

and finally when I try commands in ./bin, I get Segmentation fault. I think it's the pointer problem, but I see many platforms and get no solutions.

Thanks!

taoqxtaozi avatar Feb 15 '22 02:02 taoqxtaozi

This version of sonlib is better-maintained https://github.com/ComparativeGenomicsToolkit/sonLib

glennhickey avatar Feb 15 '22 14:02 glennhickey

This version of sonlib is better-maintained https://github.com/ComparativeGenomicsToolkit/sonLib

Hi, Thanks for your quick reply! I follow the instruction on https://github.com/ComparativeGenomicsToolkit/cactus/blob/genome_research_alignment_paper/doc/INSTALL.txt And I notice that the next step is "(2) Download and install jobTree. See https://github.com/benedictpaten/jobTree ", and in your jobtree website, it says reqiurement is Python 2.5 or later, but less than 3.0, but the sonLib you point to me is based on python3, also in https://github.com/ComparativeGenomicsToolkit, I don't find jobTree folder, so does that work? I want to install and run the cactus that is not progressive one.

Thanks a lot!

taoqxtaozi avatar Feb 16 '22 05:02 taoqxtaozi

I want to install and run the cactus that is not progressive one.

Why?

glennhickey avatar Feb 17 '22 01:02 glennhickey

I want to install and run the cactus that is not progressive one.

Why?

Because I want to only align four taxa without the guide tree.

taoqxtaozi avatar Feb 18 '22 02:02 taoqxtaozi

Your best bet is to use cactus. Either don't give it a guide tree, or specify a star tree.

glennhickey avatar Feb 18 '22 14:02 glennhickey

Your best bet is to use cactus. Either don't give it a guide tree, or specify a star tree.

ok, thanks!

taoqxtaozi avatar Feb 20 '22 07:02 taoqxtaozi