How do I link with Aquaterm library for an external build?

Mojca Miklavec mojca at macports.org
Thu Jan 31 03:57:46 PST 2013


On Thu, Jan 31, 2013 at 12:14 PM, Ryan Schmidt wrote:
> On Jan 31, 2013, at 02:21, Jerry wrote:
>> On Jan 30, 2013, at 3:42 PM, Ryan Schmidt wrote:
>>
>>> If you want those three values to be in CFLAGS, you'll have to enclose them in quotes:
>>>
>>> CFLAGS="-F/opt/local/Library/Frameworks -framework AquaTerm"
>>
>> Thanks, Ryan.
>>
>> I entered this line with quotes in my script followed by
>> export CFLAGS
>> (and removed the symlink I mentioned earlier) but Aquaterm was not found--PLplot still builds without the Aquaterm option. There are lots of occurrences of things like this which I don't understand:
>>
>> cd /usr/local/plplot_build_dir/examples/c && /usr/bin/gcc   -F/opt/local/Library/Frameworks -framework AquaTerm  -I/Users/me/Documents/Programs/Ada/Code/Bindings/PLplot/plplot_svn/plplot/include -I/usr/local/plplot_build_dir/include -I/Users/me/Documents/Programs/Ada/Code/Bindings/PLplot/plplot_svn/plplot/lib/qsastime    -DUSINGDLL -o CMakeFiles/x33c.dir/x33c.c.o   -c /Users/me/Documents/Programs/Ada/Code/Bindings/PLplot/plplot_svn/plplot/examples/c/x33c.c
>> i686-apple-darwin11-llvm-gcc-4.2: -framework: linker input file unused because linking not done
>> i686-apple-darwin11-llvm-gcc-4.2: AquaTerm: linker input file unused because linking not done
>
> I'm not an expert on writing Makefiles or CMakeLists.txt; I tend to mostly package up software others have written that already have correctly-written build scripts.
>
> As far as I know, "-framework Foo" is to frameworks as "-lfoo" is to libraries, so it belongs in LDFLAGS and not CFLAGS.

Oh, I'm sorry.

Actually, you usually need both -framework AquaTerm and
-F/opt/local/Library/Frameworks when compiling, as in:
    gcc hello.c -framework AquaTerm -F/opt/local/Library/Frameworks
but -framework indeed seems to be just for the linker and you get a
warning (or at least it doesn't seem like an error to me - the object
file gets generated) if you use -framework together with "-c".

So please try to add -F/opt/local/Library/Frameworks to both CFLAGS
and LDFLAGS and try again.

I took a loot at the source code, the file FindAQT.cmake in
particular. But while you could define CFLAGS and LDFLAGS manually,
one thing that's not really clear to me is how that would help CMake
find the framework. The only command that's used in the file is:
    FIND_FILE(AQT_FRAMEWORK AquaTerm/AQTAdapter.h)
and I don't understand how this suffices to find the file
    /opt/local/Library/Frameworks/AquaTerm.framework/Headers/AQTAdapter.h
Also, even if it would find it, it doesn't set any flag anywhere.

If you understand autoconf, you can take a look at MacPorts' patch for
gnuplot that takes care of finding the right instance of AquaTerm. I
would suggest you to allow setting -DAQUATERM_FRAMEWORK_PATH or
something similar that would define where FindAQT should first look
for AQTAdapter.h.

I just tried to run ccmake on the trunk version of PLplot, but it
first goes crazy and then reports an error:

CMake Error: The following variables are used in this project, but
they are set to NOTFOUND.
 Please set them or make sure they are set and tested correctly in the
CMake files:
 ITCL_LIBRARY
(I'm not sure if that's the only error). I can try to help, but the
prerequisite for that is that I know how to compile the program in the
first place.

Mojca

PS: should this discussion be moved to the dev mailing list perhaps?


More information about the macports-users mailing list