-
Notifications
You must be signed in to change notification settings - Fork 53
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
Fix build error on Linux - 'bool' undefined #1
Conversation
Building with a Fedora22 distribution, on x86-64 gives many errors: gcc `perl -MExtUtils::Embed -e ccopts` -fPIC -c -o khmm_wrap.o khmm_wrap.c In file included from khmm_wrap.c:730:0: khmm_wrap.c: In function ‘SWIG_AsCharPtrAndSize’: /usr/lib64/perl5/CORE/handy.h:124:34: error: ‘bool’ undeclared (first use in this function) #define cBOOL(cbool) ((cbool) ? (bool)1 : (bool)0) ^ /usr/lib64/perl5/CORE/perl.h:3158:62: note: in definition of macro ‘EXPECT’ # define EXPECT(expr,val) __builtin_expect(expr,val) ^ /usr/lib64/perl5/CORE/perl.h:3162:52: note: in expansion of macro ‘cBOOL’ #define LIKELY(cond) EXPECT(cBOOL(cond),TRUE) ... Removing the '#undef bool' from khmm_wrap.c fixes these, and allows a successful build. Signed-off-by: Mark Einon <mark.einon@gmail.com>
Which perl version are you using? On Tue, Aug 4, 2015 at 5:54 AM, Mark Einon notifications@github.com wrote:
|
Thanks for the prompt reply. It was perl 5.20. So I've attempted to build perl 5.14, which builds fine, but running exercise 1 from the PennCNV/example directory ends unexpectedly after attempting to process the first file: Exercise 1: individual-based calling and write the output to ex1.rawcnv NOTICE: All program notification/warning messages that appear in STDERR will be also written to log file ex1.log From running this with strace, I can see a fork happening followed by a SIGINT/SIGQUIT, and a core gets dumped if run outside of the runex.pl script. I haven't debugged any further. ... |
When you "make", did you try "make clean" first, and delete all the *.o On Thu, Aug 6, 2015 at 8:21 AM, Mark Einon notifications@github.com wrote:
|
Sure, this is using perl 5.14.2: [mark@einonmac kext]$ which perl
~/usr/perl-5.14.2/bin/perl
[mark@einonmac kext]$ make clean
rm -f *.o *.so
[mark@einonmac kext]$ make
gcc `perl -MExtUtils::Embed -e ccopts` -fPIC -g -c -o khmm_wrap.o khmm_wrap.c
gcc `perl -MExtUtils::Embed -e ccopts` -fPIC -g -c -o khmm.o khmm.c
gcc `perl -MExtUtils::Embed -e ccopts` -fPIC -g -c -o kc.o kc.c
gcc `perl -MExtUtils::Embed -e ccopts` -fPIC -g -c -o khmmDev.o khmmDev.c
gcc -shared -o khmm.so khmm_wrap.o khmm.o kc.o khmmDev.o `perl -MExtUtils::Embed -e ldopts`
mkdir -p `perl -MConfig -e 'print $Config{version}'`
mkdir -p `perl -MConfig -e 'print $Config{version}'`/`perl -MConfig -e 'print $Config{archname}'`/
mkdir -p `perl -MConfig -e 'print $Config{version}'`/`perl -MConfig -e 'print $Config{archname}'`/auto/
mv khmm.so `perl -MConfig -e 'print $Config{version}'`/`perl -MConfig -e 'print $Config{archname}'`/ If it's of any help, the program segfaults after calling khmm::testVit_CHMM() at detect_cnv.pl:888, no subsequent debug lines are output. The last parameter is zero, which is interesting, as that gets dereferenced by khmm::testVit_CHMM(), which I assume is the cause. [mark@einonmac example]$ perl ../detect_cnv.pl -test -hmm example.hmm -pfb example.pfb -conf -log ex1.log -out ex1.rawcnv father.txt mother.txt offspring.txt
NOTICE: All program notification/warning messages that appear in STDERR will be also written to log file ex1.log
NOTICE: Reading marker coordinates and population frequency of B allele (PFB) from example.pfb ... Done with 93129 records
NOTICE: Reading LRR and BAF values for from father.txt ... Done with 93129 records in 4 chromosomes
NOTICE: Data from chromosome X will not be used in analysis
NOTICE: Median-adjusting LRR values for all autosome markers from father.txt by 0.0221
NOTICE: Median-adjusting BAF values for all autosome markers from father.txt by 0.0029
NOTICE: quality summary for father.txt: LRR_mean=0.0027 LRR_median=0.0000 LRR_SD=0.1335 BAF_mean=0.5063 BAF_median=0.5000 BAF_SD=0.0390 BAF_DRIFT=0.000037 WF=0.0184 GCWF=0.0136
detect_cnv.pl:888, call khmm::testVit_CHMM (hmm_model, 27272, ARRAY(0x5017790), ARRAY(0x50177d8), ARRAY(0x3a49220), ARRAY(0x7157b10), 0)
Segmentation fault (core dumped) |
From the output, I cannot really tell what is the problem, but at least the compilation on 5.14 looks okay to me, unlike 5.20. My guess is that there may be an out of memory error. It will take between 4-8Gb memory on a 64-bit machine based on my experience, for each sample. But to help you run PennCNV, I just uploaded *.so files at https://github.com/WangGenomicsLab/PennCNV/tree/master/kext/5.14.2/x86_64-linux-thread-multi. (I did not know which 5.14 you are using, so I made 5.14.2 files there). You should be able to directly download and use them, without compilation, assuming that you have threaded version of 64-bit Perl. |
Thanks you - your version of the library works fine with all other things being equal (I'm certain it's not a memory issue, I have 16GB + 8GB of swap, and the memory usage doesn't top out). If we are building the same library version (the ko files do differ by about 120k), then could be due to the differing gcc versions or compiler flags used, I'm using 5.1.1 and your library is built with 4.7.7. |
Okay, thanks for letting me know. On Mon, Aug 10, 2015 at 5:03 AM, Mark Einon notifications@github.com
|
Thanks for your help, closing the original pull request. |
Building with a Fedora22 distribution, on x86-64 gives many errors:
gcc
perl -MExtUtils::Embed -e ccopts
-fPIC -c -o khmm_wrap.o khmm_wrap.cIn file included from khmm_wrap.c:730:0:
khmm_wrap.c: In function ‘SWIG_AsCharPtrAndSize’:
/usr/lib64/perl5/CORE/handy.h:124:34: error: ‘bool’ undeclared (first use in this function)
#define cBOOL(cbool) ((cbool) ? (bool)1 : (bool)0)
^
/usr/lib64/perl5/CORE/perl.h:3158:62: note: in definition of macro ‘EXPECT’
define EXPECT(expr,val) __builtin_expect(expr,val)
/usr/lib64/perl5/CORE/perl.h:3162:52: note: in expansion of macro ‘cBOOL’
#define LIKELY(cond) EXPECT(cBOOL(cond),TRUE)
...
Removing the '#undef bool' from khmm_wrap.c fixes these, and allows a successful build.
Signed-off-by: Mark Einon mark.einon@gmail.com