[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: admin patch to get KDE built on FreeBSD with libqt-mt
From:       Jason Stephenson <panda () mis ! net>
Date:       2001-09-15 16:32:12
[Download RAW message or body]

On Saturday 15 September 2001 04:10 am, Alex Zepeda wrote:
> Hmm.  What about setting LDFLAGS before running configure?  I seem to
> recall that configure picks this up and appends/prepends it to whatever
> the app's makefile sets it to.

Yeah, it does. If you do it in ports like so:

make LDFLAGS=-lc_r install

then it gets picked up.

I'm not 100% sure that configure picks it up, but I know that make will once 
you run make to build something from sources. So, export or setenv will 
ensure that make sees the extra stuff for LDFLAGS, CFLAGS, etc.

>
> However, for getting it to link, I've found linking libqt-mt with (in my
> case) -lc_r seems to be an easier solution.  I imagine -pthread would work
> as well.  For now, it's not running.  But I guess I'll update and go from
> there.

If you look in /usr/ports/Mk/bsd.port.mk, you'll find the following if 
statement:

.if ${OSVERSION} < 500016
PTHREAD_CFLAGS= -D_THREAD_SAFE
PTHREAD_LIBS=           "-pthread"
.else
PTHREAD_CFLAGS= ""
PTHREAD_LIBS=           "-lc_r"
.endif

So depending on your release version of FreeBSD, the proper way to do it is 
to use -pthread. That said, I have found that linking with c_r (the reentrant 
C library) also works on FreeBSD 4.3. In addition, you can install libpthread 
from the ports and link against that. With broken ports, I've usually just 
taken the values for PTHREAD_CFLAGS and PTHREAD_LIBS and set them as CFLAGS, 
like so:

CFLAGS="-D_THREAD_SAFE -pthread" make install

or whatever the proper syntax is for bash. Then they are picked up during the 
build. Of course, with KDE, you have to use gmake. 

Should the autoconf scripts check for the FreeBSD release version and do the 
appropriate thing with CFLAGS from above? Making KDE from ports usually 
works, but compiling it from source on FreeBSD is a bit of an adventure.

This isn't just a problem with libqt-mt and KDE. Many ports that use Mesa or 
that use threads get broken from time on FreeBSD when folks forget that they 
need to use the PTHREAD_* variables listed above. I've spent many hours 
playing with Makefiles to get things working and discovered the above tricks. 
If anyone has any more, please let me know.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic