Open lordzappo opened 8 years ago
This worked for me in my Ubuntu setup. So I googled "centos PRIu64" and found this link http://stackoverflow.com/questions/14535556/why-doesnt-priu64-work-in-this-code which seems to say you need additional statements in the header file (#define __STDC_FORMAT_MACROS or some such before #inttypes.h).
Let me know if that fixes it and I will add it to ppflag-fixer.h
Thanks, Venkat
I added #define __STDC_FORMAT_MACROS and it compiled on luna. File updated on GitHub.
Venkat
Yes this does indeed fix it thank you
I'm also having problems compiling, this is the command I'm using:
g++ -std=c++11 -I /Users/sikkemal/Software/htslib-1.6/ ppflag-fixer.cpp -L /Users/sikkemal/Software/htslib-1.6/ -lhts -Wl,-rpath=/Users/sikkemal/Software/htslib-1.6/ -o ppflag-fixer
and it gives me the following error:
ppflag-fixer.cpp:3:10: fatal error: 'argp.h' file not found
The htslib folders do not exactly match up with the ones in the readme file, but I tried different ones and none of them seem to work (htslib-1.6/ or htslib-1.6/htslib/, also tried with and without the /include part.) Am I doing something wrong?
It seems like you are trying to compile on a Mac. I don't use one and so can't tell if it will work. But on a Linux (Ubuntu Xenial) server I installed htslib locally as follows:
./configure --prefix=$HOME/hts make make install
Then compiled ppflag-fixer using
g++ -std=c++11 -I$HOME/hts/include ppflag-fixer.cpp -L$HOME/hts/lib -lhts -Wl,-rpath=$HOME/hts/lib -o ppflag-fixer
which compiled with no errors. Without the make install step in htslib the files won't be in proper locations which could be the source of your problem.
Venkat
The message "ppflag-fixer.cpp:3:10: fatal error: 'argp.h' file not found" makes me wonder if there's a more fundamental problem in your setup since argp.h is part of gcc.
The compilation problem you are running into here is because on recent versions OS X, gcc
is actually an alias to clang
. The argp library that I used is only a part of the GNU libc and so is only provided with gcc. However, if you have the Homebrew package manager installed, you should be able to do brew install argp-standalone
, which will install a replacement for the argp library that does not require gcc. You will then need to add -largp
to the command you run (after the -lhts
) so that it knows to link to the argp-standalone library, but it should otherwise be a drop-in replacement, with no code changes needed.
Thanks Alex. Happy New Year. - Venkat
Yes, it seems to have worked! Thank you both a lot for your replies and help!
or actually, it did output a ppflag-fixer executable file, but I still can't seem to run ppflag-fixer:
-bash: ppflag-fixer: command not found
the output of my command ("-v" added)
g++ -std=c++11 ppflag-fixer.cpp -lhts -largp -o ppflag-fixer -v
was this:
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) Target: x86_64-apple-darwin13.4.0 Thread model: posix "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name ppflag-fixer.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 241.9 -v -resource-dir /Library/Developer/CommandLineTools/usr/bin/../lib/clang/6.0 -stdlib=libc++ -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/sikkemal/Software/htstools-master -ferror-limit 19 -fmessage-length 110 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o /var/folders/r2/csyxs9791tvc38wdrrv0d8s109l7vq/T/ppflag-fixer-befdb8.o -x c++ ppflag-fixer.cpp clang -cc1 version 6.0 based upon LLVM 3.5svn default target x86_64-apple-darwin13.4.0 ignoring nonexistent directory "/usr/include/c++/v1"
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1 /usr/local/include /Library/Developer/CommandLineTools/usr/bin/../lib/clang/6.0/include /Library/Developer/CommandLineTools/usr/include /usr/include /System/Library/Frameworks (framework directory) /Library/Frameworks (framework directory) End of search list. "/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.9.0 -o ppflag-fixer /var/folders/r2/csyxs9791tvc38wdrrv0d8s109l7vq/T/ppflag-fixer-befdb8.o -lhts -largp -lc++ -lSystem /Library/Developer/CommandLineTools/usr/bin/../lib/clang/6.0/lib/darwin/libclang_rt.osx.a
Not sure if the installation was successful, or how to run ppflag-fixer now. Any ideas?
Thanks!
Seems like you are doing just ppflag-fixer from the directory where your executable is. You may need to do ./ppflag-fixer Alternately, have you tried using the full path of the ppflag-fixer executable?
yes, that's it! Thanks! (sorry, I'm kind of new to all of this, which is why my question might be about basic stuff)
In unix like os current working directory is not in executable path.
My guess doesn't work...
/opt/common/CentOS_6/gcc/gcc-4.9.3/bin/g++ -std=c++11 -I /opt/common/CentOS_6-dev/htslib/v1.3.2/ ppflag-fixer.cpp -L /opt/common/CentOS_6-dev/htslib/v1.3.2/ -lhts -Wl,-rpath=/opt/common/CentOS_6-dev/htslib/v1.3.2/ -o ppflag-fixer
ppflag-fixer.cpp: In function âint program_main(arguments)â: ppflag-fixer.cpp:115:22: error: expected â)â before âPRIu64â printf("Reading %" PRIu64 "read(s).\n", index_total); ^ ppflag-fixer.cpp:173:13: error: expected â)â before âPRIu64â printf("%" PRIu64 " reads were changed.\n", edited);