Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation errors in Ubuntu 16.04 #17

Closed
rborder opened this issue Feb 21, 2018 · 4 comments
Closed

Compilation errors in Ubuntu 16.04 #17

rborder opened this issue Feb 21, 2018 · 4 comments

Comments

@rborder
Copy link

rborder commented Feb 21, 2018

I'm running into following error when compiling with g++ version 7.2.0

StringBasics.cpp: In member function ‘int String::vcatprintf(const char*, __va_list_tag*)’:
StringBasics.cpp:1413:5: error: ‘%5s’ directive output truncated writing 9 bytes into a region of size 5 [-Werror=format-truncation=]
 int String::vcatprintf(const char * format, va_list ap)

@jonathonl
Copy link
Contributor

Try pulling the latest from the master branch. This should have been fixed in 9db9c23.

If it still doesn't build with the latest, please post the output of make -n | grep "^g++".

@rborder
Copy link
Author

rborder commented Feb 22, 2018

Unfortunately that didn't work. The error:

StringBasics.cpp: In member function ‘int String::vprintf(const char*, __va_list_tag*)’:
StringBasics.cpp:1357:5: error: ‘%5s’ directive output truncated writing 9 bytes into a region of size 5 [-Werror=format-truncation=]
 int String::vprintf(const char * format, va_list ap)
     ^~~~~~
In file included from /usr/include/stdio.h:862:0,
                 from StringBasics.h:21,
                 from StringBasics.cpp:18:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:65:44: note: ‘__builtin___snprintf_chk’ output 10 bytes into a destination of size 5
        __bos (__s), __fmt, __va_arg_pack ());
                                            ^
StringBasics.cpp: In static member function ‘static void String::check_vsnprintf()’:
StringBasics.cpp:1391:6: error: ‘%5s’ directive output truncated writing 9 bytes into a region of size 5 [-Werror=format-truncation=]
 void String::check_vsnprintf()
      ^~~~~~
In file included from /usr/include/stdio.h:862:0,
                 from StringBasics.h:21,
                 from StringBasics.cpp:18:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:65:44: note: ‘__builtin___snprintf_chk’ output 10 bytes into a destination of size 5
        __bos (__s), __fmt, __va_arg_pack ());
                                            ^
StringBasics.cpp: In member function ‘int String::vcatprintf(const char*, __va_list_tag*)’:
StringBasics.cpp:1413:5: error: ‘%5s’ directive output truncated writing 9 bytes into a region of size 5 [-Werror=format-truncation=]
 int String::vcatprintf(const char * format, va_list ap)
     ^~~~~~
In file included from /usr/include/stdio.h:862:0,
                 from StringBasics.h:21,
                 from StringBasics.cpp:18:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:65:44: note: ‘__builtin___snprintf_chk’ output 10 bytes into a destination of size 5
        __bos (__s), __fmt, __va_arg_pack ());
                                            ^
cc1plus: all warnings being treated as errors
../Makefiles/Makefile.common:81: recipe for target 'obj/StringBasics.o' failed
make[1]: *** [obj/StringBasics.o] Error 1
make[1]: Leaving directory '/home/rsb/Downloads/libStatGen/general'
Makefiles/Makefile.base:15: recipe for target 'general' failed
make: *** [general] Error 2

The output from make -n | grep "^g++":

g++  -std=c++0x -O4 -pipe -Wall -Werror  -Wno-strict-overflow -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/StringBasics.o -c StringBasics.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall -Werror  -Wno-strict-overflow -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/StringHash.o -c StringHash.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall -Werror  -Wno-strict-overflow -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/StringMap.o -c StringMap.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall -Werror  -Wno-strict-overflow -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/Tabix.o -c Tabix.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall -Werror  -Wno-strict-overflow -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/UncompressedFileType.o -c UncompressedFileType.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall -Werror  -Wno-strict-overflow -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/PedigreeLoader.o -c PedigreeLoader.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall -Werror  -Wno-strict-overflow -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/PedigreeTrim.o -c PedigreeTrim.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall -Werror  -Wno-strict-overflow -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/PedigreeTwin.o -c PedigreeTwin.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamFileHeader.o -c SamFileHeader.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamFile.o -c SamFile.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/GenericSamInterface.o -c GenericSamInterface.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamInterface.o -c SamInterface.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/BamInterface.o -c BamInterface.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamRecord.o -c SamRecord.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/BamIndex.o -c BamIndex.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamHeaderHD.o -c SamHeaderHD.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamHeaderPG.o -c SamHeaderPG.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamHeaderRecord.o -c SamHeaderRecord.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamHeaderSQ.o -c SamHeaderSQ.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamHeaderRG.o -c SamHeaderRG.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamHeaderTag.o -c SamHeaderTag.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamValidation.o -c SamValidation.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamStatistics.o -c SamStatistics.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamQuerySeqWithRefHelper.o -c SamQuerySeqWithRefHelper.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamFilter.o -c SamFilter.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/PileupElement.o -c PileupElement.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/PileupElementBaseQual.o -c PileupElementBaseQual.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamReferenceInfo.o -c SamReferenceInfo.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamTags.o -c SamTags.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/PosList.o -c PosList.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/CigarHelper.o -c CigarHelper.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamRecordPool.o -c SamRecordPool.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamCoordOutput.o -c SamCoordOutput.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/SamRecordHelper.o -c SamRecordHelper.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/FastQFile.o -c FastQFile.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/BaseCount.o -c BaseCount.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/BaseComposition.o -c BaseComposition.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/FastQStatus.o -c FastQStatus.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/GlfException.o -c GlfException.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/GlfFile.o -c GlfFile.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/GlfHeader.o -c GlfHeader.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/GlfRecord.o -c GlfRecord.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/GlfRefSection.o -c GlfRefSection.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/GlfStatus.o -c GlfStatus.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/VcfFile.o -c VcfFile.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/VcfFileReader.o -c VcfFileReader.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/VcfFileWriter.o -c VcfFileWriter.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/VcfGenotypeField.o -c VcfGenotypeField.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/VcfGenotypeFormat.o -c VcfGenotypeFormat.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/VcfGenotypeSample.o -c VcfGenotypeSample.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/VcfHeader.o -c VcfHeader.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/VcfHelper.o -c VcfHelper.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/VcfRecord.o -c VcfRecord.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/VcfRecordField.o -c VcfRecordField.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/VcfRecordFilter.o -c VcfRecordFilter.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/VcfRecordGenotype.o -c VcfRecordGenotype.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/VcfRecordInfo.o -c VcfRecordInfo.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/VcfSubsetSamples.o -c VcfSubsetSamples.cpp -DVERSION="\"1.0.0\""
g++  -std=c++0x -O4 -pipe -Wall  -I../include -I.   -D__ZLIB_AVAILABLE__ -D_FILE_OFFSET_BITS=64 -D__STDC_LIMIT_MACROS  -o obj/VcfRecordDiscardRules.o -c VcfRecordDiscardRules.cpp -DVERSION="\"1.0.0\""

Thanks!

@jonathonl
Copy link
Contributor

OK. I pushed a change that should fix it. If it doesn't, remove '-Werror' from https://github.com/statgen/libStatGen/blob/master/general/Makefile#L13 (I don't know why it's there in the first place).

@rborder
Copy link
Author

rborder commented Feb 22, 2018

Worked (without having to remove -Werror)! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants