Skip to content

hts-sys fails to compile on OSX #202

Closed
@pumping-elephant

Description

@pumping-elephant

Hi developers, I'm building an blank program (unmodified hello world main.rs) in order to see how the dependencies are being installed. Here is what I added to Cargo.toml:

[dependencies]
# rust-htslib = "*"

Here is my build result, including an error spit from the C compiler:

User1@localhost~/rust/bam_test$ cargo build
   Compiling cc v1.0.53
   Compiling pkg-config v0.3.17
   Compiling libc v0.2.70
   Compiling version_check v0.9.1
   Compiling glob v0.3.0
   Compiling memchr v2.3.3
   Compiling proc-macro2 v1.0.13
   Compiling bitflags v1.2.1
   Compiling unicode-xid v0.2.0
   Compiling regex-syntax v0.6.17
   Compiling bindgen v0.53.2
   Compiling quick-error v1.2.3
   Compiling rustc-hash v1.1.0
   Compiling lazycell v1.2.1
   Compiling shlex v0.1.1
   Compiling peeking_take_while v0.1.2
   Compiling cfg-if v0.1.10
   Compiling lazy_static v1.4.0
   Compiling fs-utils v1.1.4
   Compiling nom v5.1.1
   Compiling clang-sys v0.29.3
   Compiling quote v1.0.5
   Compiling libloading v0.5.2
   Compiling libz-sys v1.0.25
   Compiling curl-sys v0.4.31+curl-7.70.0
   Compiling lzma-sys v0.1.16
   Compiling bzip2-sys v0.1.8+1.0.8
   Compiling regex v1.3.7
   Compiling cexpr v0.4.0
   Compiling hts-sys v1.10.2
error: failed to run custom build command for `hts-sys v1.10.2`

Caused by:
  process didn't exit successfully: `/Users/User1/rust/bam_test/target/debug/build/hts-sys-1d2967724766e45e/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-apple-darwin")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
echo '/* Default config.h generated by Makefile */' > config.h
echo '#define HAVE_LIBBZ2 1' >> config.h
echo '#define HAVE_LIBLZMA 1' >> config.h
echo '#ifndef __APPLE__' >> config.h
echo '#define HAVE_LZMA_H 1' >> config.h
echo '#endif' >> config.h
echo '#define HAVE_DRAND48 1' >> config.h
echo '#define HAVE_LIBCURL 1' >> config.h
cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /Users/User1/rust/bam_test/target/debug/build/bzip2-sys-fd8f7cec15178433/out/include -I.  -c -o kfunc.o kfunc.c
cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /Users/User1/rust/bam_test/target/debug/build/bzip2-sys-fd8f7cec15178433/out/include -I.  -c -o knetfile.o knetfile.c
cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /Users/User1/rust/bam_test/target/debug/build/bzip2-sys-fd8f7cec15178433/out/include -I.  -c -o kstring.o kstring.c
cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /Users/User1/rust/bam_test/target/debug/build/bzip2-sys-fd8f7cec15178433/out/include -I.  -c -o bcf_sr_sort.o bcf_sr_sort.c
cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /Users/User1/rust/bam_test/target/debug/build/bzip2-sys-fd8f7cec15178433/out/include -I.  -c -o bgzf.o bgzf.c
cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /Users/User1/rust/bam_test/target/debug/build/bzip2-sys-fd8f7cec15178433/out/include -I.  -c -o errmod.o errmod.c
cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /Users/User1/rust/bam_test/target/debug/build/bzip2-sys-fd8f7cec15178433/out/include -I.  -c -o faidx.o faidx.c
cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /Users/User1/rust/bam_test/target/debug/build/bzip2-sys-fd8f7cec15178433/out/include -I.  -c -o header.o header.c
cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /Users/User1/rust/bam_test/target/debug/build/bzip2-sys-fd8f7cec15178433/out/include -I.  -c -o hfile.o hfile.c
cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /Users/User1/rust/bam_test/target/debug/build/bzip2-sys-fd8f7cec15178433/out/include -I.  -c -o hfile_net.o hfile_net.c
echo '#define HTS_VERSION_TEXT "1.10.2"' > version.h
cc -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer -m64 -static -I /Users/User1/rust/bam_test/target/debug/build/bzip2-sys-fd8f7cec15178433/out/include -I.  -c -o hts.o hts.c

--- stderr
In file included from hts.c:44:
In file included from ./cram/cram.h:46:
./header.h:227:24: error: must use 'struct' tag to refer to type 'sam_hdr_t'
int sam_hdr_fill_hrecs(sam_hdr_t *bh);
                       ^
./header.h:236:21: error: must use 'struct' tag to refer to type 'sam_hdr_t'
int sam_hdr_rebuild(sam_hdr_t *bh);
                    ^
./header.h:244:1: error: must use 'struct' tag to refer to type 'sam_hrecs_t'
sam_hrecs_t *sam_hrecs_new(void);
^
./header.h:250:1: error: must use 'struct' tag to refer to type 'sam_hrecs_t'
sam_hrecs_t *sam_hrecs_dup(sam_hrecs_t *hrecs);
^
./header.h:250:28: error: must use 'struct' tag to refer to type 'sam_hrecs_t'
sam_hrecs_t *sam_hrecs_dup(sam_hrecs_t *hrecs);
                           ^
./header.h:259:34: error: must use 'struct' tag to refer to type 'sam_hdr_t'
int sam_hdr_update_target_arrays(sam_hdr_t *bh, const sam_hrecs_t *hrecs,
                                 ^
./header.h:259:55: error: must use 'struct' tag to refer to type 'sam_hrecs_t'
int sam_hdr_update_target_arrays(sam_hdr_t *bh, const sam_hrecs_t *hrecs,
                                                      ^
./header.h:268:34: error: must use 'struct' tag to refer to type 'sam_hrecs_t'
int sam_hrecs_rebuild_text(const sam_hrecs_t *hrecs, kstring_t *ks);
                                 ^
./header.h:276:21: error: must use 'struct' tag to refer to type 'sam_hrecs_t'
void sam_hrecs_free(sam_hrecs_t *hrecs);
                    ^
./header.h:285:41: error: must use 'struct' tag to refer to type 'sam_hrecs_t'
sam_hrec_type_t *sam_hrecs_find_type_id(sam_hrecs_t *hrecs, const char *type,
                                        ^
./header.h:292:26: error: must use 'struct' tag to refer to type 'sam_hrecs_t'
int sam_hrecs_remove_key(sam_hrecs_t *hrecs,
                         ^
./header.h:302:34: error: must use 'struct' tag to refer to type 'sam_hrecs_t'
sam_hrec_rg_t *sam_hrecs_find_rg(sam_hrecs_t *hrecs, const char *rg);
                                 ^
./header.h:305:42: error: must use 'struct' tag to refer to type 'sam_hrecs_t'
enum sam_sort_order sam_hrecs_sort_order(sam_hrecs_t *hrecs);
                                         ^
./header.h:308:44: error: must use 'struct' tag to refer to type 'sam_hrecs_t'
enum sam_group_order sam_hrecs_group_order(sam_hrecs_t *hrecs);
                                           ^
In file included from hts.c:44:
In file included from ./cram/cram.h:47:
./cram/cram_structs.h:683:5: error: must use 'struct' tag to refer to type 'sam_hdr_t'
    sam_hdr_t     *header;
    ^
    struct 
In file included from hts.c:44:
In file included from ./cram/cram.h:48:
./cram/cram_io.h:671:24: error: must use 'struct' tag to refer to type 'sam_hdr_t'
int refs2id(refs_t *r, sam_hdr_t *hdr);
                       ^
                       struct 
./cram/cram_io.h:828:1: error: must use 'struct' tag to refer to type 'sam_hdr_t'
sam_hdr_t *cram_read_SAM_hdr(cram_fd *fd);
^
struct 
./cram/cram_io.h:836:37: error: must use 'struct' tag to refer to type 'sam_hdr_t'
int cram_write_SAM_hdr(cram_fd *fd, sam_hdr_t *hdr);
                                    ^
                                    struct 
./cram/cram_io.h:929:41: error: must use 'struct' tag to refer to type 'sam_hdr_t'
int cram_set_header2(cram_fd *fd, const sam_hdr_t *hdr);
                                        ^
                                        struct 
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [hts.o] Error 1
thread 'main' panicked at 'failed to build htslib', ./cargo/registry/src/mygithub.libinneed.workers.dev-1ecc6299db9ec823/hts-sys-1.10.2/build.rs:86:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Does anybody know how to sort it out? Thanks.

Update:
rustc 1.43.1 (8d69840ab 2020-05-04)
macOS 10.15.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions