Comments (12)
It's a warning, not an error. Hence when these files are compiled via (HTSlib's build system's) make test the diagnostic messages scroll past quickly and are easily missed. (And the tests go on to run successfully anyway.)
Strictly speaking, calling an undeclared function causes behaviour to be undefined ever since C99. It's just accepted as a legacy feature by recent compilers. You should definitely fix this.
from htslib.
If you look in those files you'll see they do in fact include <sys/time.h>
.
On FreeBSD, this header provides a declaration of gettimeofday()
only if __XSI_VISIBLE
is non-zero. This is non-zero by default or if the code defines _XOPEN_SOURCE
(see cdefs.h), but will be reset to zero if you choose strict ANSI, C99, or C11 mode. Did you select any of those?
As recently predicted might become necessary in #1586 (comment) 😄, HTSlib can ensure this is non-zero by ensuring _XOPEN_SOURCE
is defined to an appropriate value. There's an old draft of that in this xopen_source branch that probably needs some 500 vs 600 work (see also #1246).
from htslib.
I compiled htslib 1.17 with no changes on FreeBSD and tried to build and run the unit tests when this issue happened.
from htslib.
I tried the latest freebsd with just ./configure;make and it works fine.
What compiler are you using, and are you setting any specific C flags?
from htslib.
The error occurs when building the unit tests (make test
). Did you try that?
I am building htslib 1.17 with clang. We pass
-O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing
as extra C flags when building this port.
from htslib.
It's a warning, not an error. Hence when these files are compiled via (HTSlib's build system's) make test
the diagnostic messages scroll past quickly and are easily missed. (And the tests go on to run successfully anyway.)
FreeBSD's cdefs.h also sidesteps the default activation of __XSI_VISIBLE
when _POSIX_C_SOURCE
is set and _XOPEN_SOURCE
is not set.
It turns out HTSlib's Makefile's rules for htscodecs/test/*.o add ‑D_POSIX_C_SOURCE=200112L
to their compilation. This is incorrect; it should be ‑D_XOPEN_SOURCE=600
instead, as these test source files use an XSI function as well as POSIX functionality.
That's the short-term fix. The better fix would be to set _XOPEN_SOURCE
globally in the HTSlib source code (as in the xopen_source branch previously mentioned), but that would be something probably best done early in a development cycle.
from htslib.
I tried make check, with clang and opts above (bar the /usr/local/include bit as I'm only using official packages) and see no warnings.
However this was an htscodecs build. I'm not sure we're talking about the same thing here (eg @jmarshall's comments above). Htscodecs when built from htslib has a completely different Makefile and build system, so maybe this is infact an htslib bug rather than htscodecs one? I haven't yet tested that scenario (it's soooo slow on this laptop due to inability to use kvm qemu driver and no permission to install VM tools, sigh). I'll start it going...
from htslib.
@jkbonfield Yes, the is an htslibs issue. I don't know why the issue was moved to this repository.
from htslib.
Incorrect assumptions :)
I'll move it back. Thanks for clarifying
from htslib.
It was transferred here because it appeared to be an htscodecs issue (the *.c source files come from htscodecs), but the problem turns out to be in HTSlib's build rules for the htscodecs object files. It would have been more obvious that this was the case if the OP had included the exact compilation lines from the make output as well as the diagnostics. But we got there pretty quickly anyway.
Strictly speaking, calling an undeclared function causes behaviour to be undefined ever since C99. […]
Youshould definitely fix this.
Indeed. Feel free to read the rest of the comment you're replying to.
from htslib.
There's already a commentd out line to force XOPEN_SOURCE for building, which I added mainly for compatibility testing. https://github.com/samtools/htslib/blob/develop/Makefile#L37
I agree this ought to be more mainstream. I haven't yet looked at your branch, but think this is worth doing as it is basically a requirement and until now it's just been unnecessary to make this explicit.
from htslib.
I've tried with clang 14.0.5 on freebsd 13.2-RELEASE with the compiler options you mention and cannot reproduce this warning.
Edit: scratch that - forgot the make check bit. Well now I can reproduce, so should be easy to test fixes. Thanks
from htslib.
Related Issues (20)
- Allocation size too big/invalid memory access during `extend_ref`/`cram_add_to_ref`
- Heap overflow during hts_md5_update
- `annot-tsv --version` does not follow conventions HOT 1
- Segmentation fault of htslib c program written myself HOT 3
- Reading BCFtools FORMAT/BCSQ field HOT 2
- bgzip: keep original modification time when compressing a file.
- Unable to install the HTSlib on Ubuntu 20.04 HOT 2
- formerly caught bgzf_idx_amend_last symbol HOT 3
- Passing missing --reference incorrectly reports cram file missing as well HOT 1
- bgzip: allow specification of output name.
- bcftools --write-index creates sometimes indexes older than the data file. HOT 1
- bcftools corrupts duplicate GT format fields HOT 1
- CRAM load_ref_portion() fails on some Mistletoe references
- feature request: parallelize tabix HOT 5
- Using POSIX and htslib to create x compressed vcf files using x threads HOT 2
- bcftools-1.19: Invalid index is produced by --write-index and --threads on my bcf.gz files HOT 4
- Samtools view fails on CRAM and compressed reference if .gzi file is missing HOT 1
- todo: Improve `--regions-overlap variant`
- wishlist s3 cache HOT 6
- S3 plugin does not correctly handle 307 redirects for newly created buckets HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from htslib.