[Kst] CFITSIO Problem

Nicholas Chapman nchapman at u.northwestern.edu
Tue Aug 6 15:04:45 UTC 2013


Hi Peter.  Thanks for all your help.  I have solved my immediate
problem with getting the code to compile.  As usual the solution is
obvious in hindsight.  Below is my solution, though perhaps someone
can enlighten me on the better solution.

To activate my plugin, I edited
[root]/cmake/src/datasources/CMakeLists.txt by adding the following:
if(sharp) # NLC - Added to support raw sharp data
	include_directories(${SHARP_INCLUDE_DIR} ${CFITSIO_INCLUDE_DIR})
	kst_add_plugin(. sharp)
	kst_link(${SHARP_LIBRARIES} ${CFITSIO_LIBRARIES})
endif()

Eventually I realized that the if statement wasn't testing to true, so
I added the following before the if:
kst_add_plugin(. sharp)

Which of course, caused all the linker error problems.  I initially
thought that this was how one activated the if() statement.  I just
now tried removing the if statement and leaving the three lines inside
the if().  The code now compiles.  So, my question is, how can I set
the if statement to evaluate to true?

Thanks for all the help,

Nicholas

On 8/3/13, Peter Kümmel <syntheticpp at gmx.net> wrote:
> On 03.08.2013 00:44, Nicholas Chapman wrote:
>> Hi, no, I haven't solved the problem yet.  After talking to someone
>> here and spending some time searching on the internet, my best guess
>> is that it is a problem with linking a c library (cfitsio) into a c++
>> program (kst).  That would explain why the linker complains about an
>> undefined symbol _ffclos, when cfitsio defines ffclos.  See the
>> following for a description on how to link c programs into c++:
>> http://stackoverflow.com/questions/4598308/how-do-i-compile-and-link-c-code-with-compiled-c-code
>>
>> I've tried the solutions suggested there in just about every possible
>> place (such as wrapping the #include statement directly in my plugin,
>> then editing longnam.h (called by fitsio.h) and fitsio.h in various
>> ways with 'extern' commands.)  None of these have worked.
>
> should work without such changes, the fitsimage plugin just includes
> <fitsio.h>
>
>>
>> Peter, I tried adding the command you suggested to the CMake Wizard
>> dialog, but I get the following error:
>> CMake Error: The source directory
>> "/Users/chapman/data1/Applications/ksttmp/--Dkst_3rdparty_build=1"
>
> Ah sorry, it must be "-D..." not "--D..."
>
>
>> does not exist.
>>
>> I am building the code in a separate directory named ksttmp, so
>> perhaps I just need to modify the path appropriately (from ../kst to
>> something else), but it isn't obvious to me what that should be.
>
> QtCreator only wraps command line arguments. When you have problems
> with the build system you should switch to the shell. To test start
> from scratch in a in a empty dir with
>
> cmake -G"CodeBlocks - Unix Makefiles" <path to kst sources>
> -Dkst_3rdparty_build=1
>
> the -G argument specifies which build system you wanna use:
>
> -G"Unix Makefiles"  build with make, default on Linux
> -G"CodeBlocks - Unix Makefiles"  build with make, but also generate XML
> files which QtCreator/CodeBlocks could read
> -GXcode   generate XCode project files, default on Mac
>
> then you also have to point cmake to the source code: <path to kst sources>
>
> Additional arguments are passed by -D.
>
> After the first successfull run you could call "cmake ." and cmake lists all
> -D arguments
>
>
>>
>> One option I haven't tried yet is to re-write my plugin to use ccfits
>> instead of cfitsio.  ccfits is a c++ version of cfitsio.
>
> Should not be necessary.
>
>
>
> Does it build the fitsimage plugin? If yes, you could try to figure out what
> is different in your plugin.
> Or copy & paste some code into this plugin and see what happens.
>
> Peter
> _______________________________________________
> Kst mailing list
> Kst at kde.org
> https://mail.kde.org/mailman/listinfo/kst
>


More information about the Kst mailing list