3 problems&fixes compiling yesterday's git version.

0 views
Skip to first unread message

gh

unread,
Jul 26, 2008, 2:45:36 PM7/26/08
to pygr-dev

I had a bit of trouble building the git tree that I checked out
yesterday and wanted to pass back the fixes.

I'm running on an amd64 FreeBSD-STABLE system.

I've pasted a patch below, although the mail system will probably
mangle it.

There are three problems.

1) the function 'free_seqnames' is used pygr/pygr.cnestedlist.c but is
only defined in a section of pygr/apps/maf2nclist.c that is ifdef'ed
out. I "fixed" it by simply pasting a copy of it outside the ifdef.
Clearly that's not a real fix, but since I don't know what it was
ifdef'ed out I'll leave it to all y'all to do it right.

2) the function calloc_int is defined in pygr/cgraph.c and used in
other places, but it it never declared in pygr/cgraph.h.

3) the function write_padded_binary is defined in pygr/intervaldb.c
and used other places, but isn't declared in pygr/intervaldb.h.

g.


> git diff
diff --git a/pygr/apps/maf2nclist.c b/pygr/apps/maf2nclist.c
index ec26643..bb0b36a 100644
--- a/pygr/apps/maf2nclist.c
+++ b/pygr/apps/maf2nclist.c
@@ -206,6 +206,14 @@ int read_axtnet(IntervalMap im[], SeqIDMap
seqidmap[], int nseq,
}


+void free_seqnames(SeqNameID_T seqnames[],int n)
+{
+ int i;
+ for (i=0;i<n;i++) {
+ free(seqnames[i].p);
+ seqnames[i].p=NULL;
+ }
+}



diff --git a/pygr/cgraph.h b/pygr/cgraph.h
index bbd9158..f4a7e99 100644
--- a/pygr/cgraph.h
+++ b/pygr/cgraph.h
@@ -29,3 +29,5 @@ extern CGraph *cgraph_alloc(int n);
extern int cgraph_free(CGraph *d);
extern CGraphEntry *cgraph_getitem(CGraph *d,int k);

+extern int *calloc_int(int n);
+
diff --git a/pygr/intervaldb.h b/pygr/intervaldb.h
index 16f0de9..663400e 100644
--- a/pygr/intervaldb.h
+++ b/pygr/intervaldb.h
@@ -98,6 +98,9 @@ extern int find_file_intervals(IntervalIterator
*it0,int start,int end,

extern char *write_binary_files(IntervalMap im[],int n,int ntop,int
div,
SublistHeader *subheader,int
nlists,char filestem[]);
+
+extern int write_padded_binary(IntervalMap im[],int n,int div,FILE
*ifile);
+
extern IntervalDBFile *read_binary_files(char filestem[],char
err_msg[],
int subheader_nblock);
extern int free_interval_dbfile(IntervalDBFile *db_file);
>

C. Titus Brown

unread,
Jul 28, 2008, 3:46:49 PM7/28/08
to pygr...@googlegroups.com
Hi, gh, thanks for your e-mail!

On Sat, Jul 26, 2008 at 11:45:36AM -0700, gh wrote:
-> 2) the function calloc_int is defined in pygr/cgraph.c and used in
-> other places, but it it never declared in pygr/cgraph.h.

Alex Nolley reported this a while back. We did a little bit of
troubleshooting and it appears to be a version issue with pyrexc or C,
not sure which. ('calloc_int' is presumably related to 'calloc', the
stdlib C call.) I was hoping someone more familiar with Pyrex could
speak up...

At this point I'm not sure what to do. We have a whole bunch of issues
backed up, and I can certainly tackle some of them, but I'm loathe to
continue working on my own patchset until I have some idea of whether
or not my patches are OK for the main branch. I already feel like my
current patchset is getting dangerously isolated from the main branch.
Chris, should I simply assume that I'm coding in the appropriate way
until you let me know otherwise?

cheers,
--titus

Christopher Lee

unread,
Jul 31, 2008, 1:36:09 PM7/31/08
to pygr...@googlegroups.com
I think you are looking at stale code. I'm not sure how exactly you
are getting the code. See my comments below.

On Jul 26, 2008, at 11:45 AM, gh wrote:

>
>
> I had a bit of trouble building the git tree that I checked out
> yesterday and wanted to pass back the fixes.
>
> I'm running on an amd64 FreeBSD-STABLE system.
>
> I've pasted a patch below, although the mail system will probably
> mangle it.
>
> There are three problems.
>
> 1) the function 'free_seqnames' is used pygr/pygr.cnestedlist.c but is
> only defined in a section of pygr/apps/maf2nclist.c that is ifdef'ed
> out. I "fixed" it by simply pasting a copy of it outside the ifdef.
> Clearly that's not a real fix, but since I don't know what it was
> ifdef'ed out I'll leave it to all y'all to do it right.

Huh? The string "free_seqnames" does not appear in pygr/
cnestedlist.pyx (or its compiled product, pygr/cnestedlist.c) even
once. I just checked my own repository, which should match exactly
what is on the public git repository master branch (http://repo.or.cz/w/pygr.git
). That function hasn't been used in at least a couple years, since
we switched over to sequence unionization, so the implication is you
are working with some really old code...

>
>
> 2) the function calloc_int is defined in pygr/cgraph.c and used in
> other places, but it it never declared in pygr/cgraph.h.
>
> 3) the function write_padded_binary is defined in pygr/intervaldb.c
> and used other places, but isn't declared in pygr/intervaldb.h.

All of this makes me wonder how exactly you are getting the code. Is
it possible you are working with some kind of mix of old and new code?
e.g. if you didn't run Pyrex to build the code for the extension
modules (our setup.py will run it for you automatically, but if you
don't have pyrex available, it will fall back to using existing C code
files that you may have lying around from an old version).
cnestedlist.c is not in the public git repository so the only way it
could appear in your build is if A) it was built by pyrex from
cnestedlist.pyx; B) it was sitting in the directory from some older
version that you extracted to that directory.

Simple test:
in a completely empty directory, get a fresh copy of the public git
repository:
git clone git://repo.or.cz/pygr.git

cd into the source code you just obtained, and run the setup:
python setup.py build

Watch carefully for any error messages, e.g. indicating that you don't
have pyrexc ( the pyrex compiler, required for the build).

-- Chris


Christopher Lee

unread,
Jul 31, 2008, 1:41:55 PM7/31/08
to pygr...@googlegroups.com

On Jul 28, 2008, at 12:46 PM, C. Titus Brown wrote:

>
> Hi, gh, thanks for your e-mail!
>
> On Sat, Jul 26, 2008 at 11:45:36AM -0700, gh wrote:
> -> 2) the function calloc_int is defined in pygr/cgraph.c and used in
> -> other places, but it it never declared in pygr/cgraph.h.
>
> Alex Nolley reported this a while back. We did a little bit of
> troubleshooting and it appears to be a version issue with pyrexc or C,
> not sure which. ('calloc_int' is presumably related to 'calloc', the
> stdlib C call.) I was hoping someone more familiar with Pyrex could
> speak up...

looks like cdict.pxd (Pyrex's version of a header file) defines
calloc_int() sufficient for Pyrex to be happy, even though as you say
that prototype is not also given in cgraph.h as it should be. I guess
the C compiler handles this OK since the calling argument is an int,
which is the default for unknown argument types in C. I will add the
prototype to cgraph.h.

Thanks for pointing this out!

Christopher Lee

unread,
Jul 31, 2008, 1:48:48 PM7/31/08
to pygr...@googlegroups.com

On Jul 26, 2008, at 11:45 AM, gh wrote:

> 3) the function write_padded_binary is defined in pygr/intervaldb.c
> and used other places, but isn't declared in pygr/intervaldb.h.

I added the prototype for write_padded_binary() to pygr/intervaldb.h

Thanks!

-- Chris

Christopher Lee

unread,
Aug 5, 2008, 3:57:37 PM8/5/08
to pygr...@googlegroups.com, gh
Hi George,
I added the correct prototypes to the header files as you suggested in
points #2 and 3 below. That code is now available on the public git
repository. Regarding point #1, were you able to resolve this by
getting updated code as I suggested in my previous email?

-- Chris


On Jul 26, 2008, at 11:45 AM, gh wrote:

Alex Nolley

unread,
Aug 6, 2008, 2:37:17 PM8/6/08
to pygr-dev
> I added the correct prototypes to the header files as you suggested in  
> points #2 and 3 below.  That code is now available on the public git  
> repository.  Regarding point #1, were you able to resolve this by  
> getting updated code as I suggested in my previous email?

Hey Chris, pygr builds fine on my Ubuntu 8.04, 32bit laptop, however
it fails with a similar error message to the one described in George's
first point on our Windows XP Pro Buildslave. Doing a 'python25
setup.py build' yields the following error message:

C:\MinGW\bin\gcc.exe -mno-cygwin -shared -s build
\temp.win32-2.5\Release\pygr\intervaldb.o build\temp.win32-2.5\Release
\pygr\cnestedlist.o build\temp.win32-2.5\Release\pygr\apps
\maf2nclist.o build\temp.win32-2.5\Release\pygr\cnestedlist.def
-LC:\Python25\libs -LC:\Python25\PCBuild -lpython25 -lmsvcr71 -o build
\lib.win32-2.5\pygr\cnestedlist.pyd
build\temp.win32-2.5\Release\pygr\cnestedlist.o:cnestedlist.c:(.text
+0x39540):
undefined reference to `free_seqnames'
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

This package was of course pulled from the repo.or.cz site today (aug
6th) so it is up to date at least. You can view all the code on our
Buildbot page here under x86_win_master: http://iorich.caltech.edu:8015/

Anyway, I hope that gives you some useful information about the error.

-Alex

Christopher Lee

unread,
Aug 6, 2008, 2:51:15 PM8/6/08
to pygr...@googlegroups.com

On Aug 6, 2008, at 11:37 AM, Alex Nolley wrote:

>
> This package was of course pulled from the repo.or.cz site today (aug
> 6th) so it is up to date at least. You can view all the code on our
> Buildbot page here under x86_win_master: http://iorich.caltech.edu:8015/
>
> Anyway, I hope that gives you some useful information about the error.

Hi Alex,
thanks for highlighting this problem again. I rechecked all the
places free_seqnames could be hiding out...

$ grep free_seqnames *.c
$ grep free_seqnames *.h
$ grep free_seqnames *.pyx
$ grep free_seqnames *.pxd
cnestedlist.pxd: void free_seqnames(SeqNameID_T seqnames[],int n)

Lo and behold, the free_seqnames prototype was hiding out in the pyrex
pxd file (which just lists the prototypes)! I've removed it and
updated the public git repository.

Thank you George and Alex!!

Alex Nolley

unread,
Aug 6, 2008, 2:59:33 PM8/6/08
to pygr...@googlegroups.com
Lo and behold, the free_seqnames prototype was hiding out in the pyrex
pxd file (which just lists the prototypes)!  I've removed it and
updated the public git repository.

Great! I just cloned a copy and it's building fine now on the Windows box. Thanks Chris.

Reply all
Reply to author
Forward
0 new messages