#1289 closed defect (fixed)
Problem compiling fpack in cfitsio
| Reported by: | Michael Wood-Vasey | Owned by: | Paul Price |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | fits | Version: | current |
| Severity: | normal | Keywords: | cfitsio |
| Cc: | magnier |
Description
ld: duplicate symbol _tempfilename in fpackutil.o and fpack.o
is the error I get when compiling fpack. This looks like an issue of a variable being defined in global scope and then redefined in local scope. Both fpackutil.c and fpack.c import fpack.h which defines a 'tempfilename' at the global level.
char tempfilename[SZ_STR];
But within fpackutil.c (which "#include fpack.h") there is
char dtype[8], dimen[100], tempfilename[30];
with in the function 'fp_test'. I think my compiling is particularly picky about this, or alternatively is not setting up separate variables for the globally-scoped tempfilename and the locally-scoped tempfilename.
As a point of software design, I don't think generic global temp variables should really be defined like this because exactly these things are going to happen. But that's obviously beyond the scope of this ticket.
But on a more relevant note; after this final failure to compile the binaries, 'pschecklibs' now passes 'cfitsio' because it does find the libraries. So this leaves an incomplete installation without people knowing about it.
Attachments (2)
Change History (4)
by , 17 years ago
comment:1 by , 17 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Ah, I wasn't thinking about that right at all. What's needed is a good 'extern' in the 'fpack.h' file and to make sure to define tempfilename where it's used in 'fpackutil.c' (which will refer to that extern). Here are the diffs from old to new
--
[serenity tmp] diff cfitsio3100-p2/fpack.h ../
4a5
26c27
< char tempfilename[SZ_STR];
---
extern char tempfilename[SZ_STR];
108a110
--
--
[serenity tmp] diff cfitsio3100-p2/fpackutil.c ../
691c691
< char dtype[8], dimen[100], tempfilename[30];
---
1658a1659
char tempfilename[SZ_STR];
--
New versions of files attached.
comment:2 by , 17 years ago
fpack.h
26c26 < char tempfilename[SZ_STR]; --- > extern char tempfilename[SZ_STR];
fpackutil.c
691c691 < char dtype[8], dimen[100], tempfilename[30]; --- > char dtype[8], dimen[100], tempfilename[SZ_STR]; 1658a1659 > char tempfilename[SZ_STR];

fpack.h