Ensembl / Bio-DB-HTS

Git repo for Bio::DB::HTS module on CPAN, providing Perl links into HTSlib
Apache License 2.0
24 stars 16 forks source link

Minor build improvements and warning fixes #69

Closed jmarshall closed 6 years ago

jmarshall commented 6 years ago

Some changes to Build.PL so that it will recognise HTSlib directories containing only libhts.so (thus without libhts.a, i.e., when you have built only the shared library).

Warning fixes in the XS module code. With these patches, if you hack -Wno-unused into Build.PL:

         # Don't care about unused results from function calls
+        '-Wno-unused',
         '-Wno-unused-result',  ],

then the XS and .c code will compile without any warnings. Which makes it easier to see the warnings in your own new code. :smile:

If you don't add -Wno-unused as well, you get a lot of unused variable warnings — notably for packname, which is universally unused.

avullo commented 6 years ago

How do you get the warnings you mention? For me, XS compiles without any.

jmarshall commented 6 years ago

Yeah, I noticed that travis doesn't get them either. I must have -Wall turned on somehow, will check. I'm not that excited about adding casts in general…

avullo commented 6 years ago

I agree. You probably have $CXX set with some extra include flag?!

avullo commented 6 years ago

Do you want me to close this? I wouldn't throw away the other improvements.

jmarshall commented 6 years ago

It turns out this is coming from the CentOS 6 base Perl installation. The XS modules are compiled and linked (via ExtUtils::CBuilder I guess) using Perl's configured-in optimize and lddlflags settings.

On the CentOS 6 system Perl 5.10.1 installation, these include -Wall:

$ perl -V | grep -- -Wall
    config_args='… -Wall …'
    optimize='… -Wall …'
    cccdlflags='…', lddlflags='… -Wall …'

$ perl -V:optimize
optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic';

It's similar on the up-to-date Centos 7.4 system Perl 5.16.3 — it's built with -Wall in this burnt-in config setting:

centos7$ perl -V:optimize
optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic';

So anybody building Bio::DB::HTS on CentOS will see these warnings.