Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Dec 2008 00:27:45 -0800
From:      "Garrett Cooper" <yanefbsd@gmail.com>
To:        "Silver Salonen" <silver.salonen@gmail.com>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: cmake cannot link against libxml++
Message-ID:  <7d6fde3d0812050027n712d78fxf9e70f2a4568e43@mail.gmail.com>
In-Reply-To: <20849140.post@talk.nabble.com>
References:  <20828880.post@talk.nabble.com> <7d6fde3d0812040143n374c63edyead7aa4f44e7c0f1@mail.gmail.com> <20830760.post@talk.nabble.com> <7d6fde3d0812040320p2df5474av631d9139c1e9f205@mail.gmail.com> <20831657.post@talk.nabble.com> <7d6fde3d0812041205h493da747vffede0a613c390b8@mail.gmail.com> <20849062.post@talk.nabble.com> <20849140.post@talk.nabble.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Dec 4, 2008 at 11:46 PM, Silver Salonen
<silver.salonen@gmail.com> wrote:
>
>
> Silver Salonen wrote:
>>
>>
>> Garrett Cooper-6 wrote:
>>>
>>> On Thu, Dec 4, 2008 at 3:27 AM, Silver Salonen <silver.salonen@gmail.com>
>>> wrote:
>>>>
>>>> Garrett Cooper-6 wrote:
>>>>>
>>>>> On Thu, Dec 4, 2008 at 2:20 AM, Silver Salonen
>>>>> <silver.salonen@gmail.com>
>>>>> wrote:
>>>>>> Garrett Cooper-6 wrote:
>>>>>>>
>>>>>>> On Thu, Dec 4, 2008 at 12:02 AM, Silver Salonen
>>>>>>> <silver.salonen@gmail.com> wrote:
>>>>>>>>
>>>>>>>> Hello.
>>>>>>>>
>>>>>>>> I created a port for Museek+ which is built with cmake now. The
>>>>>>>> problem
>>>>>>>> is
>>>>>>>> that although it gets built OK, cmake cannot link one of its
>>>>>>>> executables
>>>>>>>> against libxml++:
>>>>>>>> =====
>>>>>>>> ... [100%] Building CXX object
>>>>>>>> museekd/CMakeFiles/museekd.dir/distributedsocket.cpp.o Linking CXX
>>>>>>>> executable museekd /usr/bin/ld: cannot find -lxml++-2.6 *** Error
>>>>>>>> code
>>>>>>>> 1
>>>>>>>> =====
>>>>>>>>
>>>>>>>> Concerning libxml++, cmake seems to find it OK - before building:
>>>>>>>> =====
>>>>>>>> -- checking for one of the modules 'libxml++-2.6' -- found
>>>>>>>> libxml++-2.6,
>>>>>>>> version 2.22.0
>>>>>>>> =====
>>>>>>>>
>>>>>>>> Previously I had a problem with cmake finding libiconv.h, but I
>>>>>>>> resolved
>>>>>>>> it
>>>>>>>> with "CMAKE_ARGS+=
>>>>>>>> -DCMAKE_REQUIRED_INCLUDES="${LOCALBASE}/include".
>>>>>>>> But
>>>>>>>> I guess it's irrelevant and not even similar.
>>>>>>>>
>>>>>>>> Is there anything to be specified in order to cmake to find libxml++
>>>>>>>> correctly?
>>>>>>>
>>>>>>> 1. Does /usr/local/lib/libxml++-2.6.a and/or
>>>>>>> /usr/local/lib/libxml++-2.6.so exist?
>>>>>>> 2. What are your CXXFLAGS / LDFLAGS?
>>>>>>>
>>>>>>
>>>>>> 1. Yes:
>>>>>> $ ls -1 /usr/local/lib/libxml++*
>>>>>> /usr/local/lib/libxml++-2.6.a
>>>>>> /usr/local/lib/libxml++-2.6.la
>>>>>> /usr/local/lib/libxml++-2.6.so
>>>>>> /usr/local/lib/libxml++-2.6.so.2
>>>>>>
>>>>>> 2. CXXFLAGS: -O2 -fno-strict-aliasing -pipe
>>>>>> LDFLAGS: nothing
>>>>>
>>>>> Sorry -- let me rephrase: what are CXXFLAGS and LDFLAGS set to for the
>>>>> port?
>>>>> -Garrett
>>>>>
>>>>
>>>> I got the values from pre-everything:
>>>>    @${ECHO_MSG} "${CXXFLAGS}"
>>>>    @${ECHO_MSG} "${LDFLAGS}"
>>>>
>>>> So I guess they are valid in this matter?
>>>
>>> Eh? It all depends on where you're doing the echo...
>>>
>>> Honestly I'd need to see more around where you're running configure,
>>> or passing in args for the parent make (if it doesn't use configure).
>>> You're probably just missing /usr/local/lib in your LDFLAGS though.
>>>
>>
>> I echoed these in "pre-everything" section. Now I set "LDFLAGS+=
>> -L${LOCALBASE}/lib", but it doesn't help much. My Makefile is structured
>> smth like that:
>>
>> PORTNAME=...
>> ...
>> USE_CMAKE=      yes
>> ...
>> LDFLAGS+=       -L${LOCALBASE}/lib
>> CMAKE_ARGS+=    -DCMAKE_REQUIRED_INCLUDES="${LOCALBASE}/include"
>> ...
>> OPTIONS=...
>> ...
>> .include <bsd.port.pre.mk>
>> ...
>> pre-everything::
>>         @${ECHO_MSG} "${CXXFLAGS}"
>>         @${ECHO_MSG} "${LDFLAGS}"
>> ...
>> post-install:
>> ...
>> .include <bsd.port.post.mk>
>>
>
> OK, the problem disappeared when I also set: CONFIGURE_ENV+=
> CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
>
> Thanks for your help! :)

    Bingo, ya got it ;) (I was kind of pointing you in that direction,
but I wasn't sure where you did or didn't pass the variables through).
Environment variables that need to be communicate to the underlying
processes for compiling things should be communicate via either
configure (which just is a wrapper produced by autotools / autoconf)
or gmake, or via the double-dashed args to configure. There are other
make systems like scons, or waf, etc that do different things, but
that's outside the scope of what most folks try to do, and the syntax
is similar.
Best of luck,
-Garrett



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7d6fde3d0812050027n712d78fxf9e70f2a4568e43>