Bug 104064 - palm/libmal: fails to build when palm/pilot-link compiled with threads and usb support
Summary: palm/libmal: fails to build when palm/pilot-link compiled with threads and us...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-06 16:00 UTC by Scot Hetzel
Modified: 2006-10-07 14:00 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Scot Hetzel 2006-10-06 16:00:44 UTC
When I tried to update libmal to 0.42 with portmaster, I enabled the OPTIONS
PNG, THREADS, and USB in the palm/pilot-link port.  This caused palm/libmal to fail to build due to libpisock.so was compiled with thread support.

(cd .libs && rm -f libmal.la && ln -s ../libmal.la libmal.la)
if cc -DHAVE_CONFIG_H -I. -I. -I..    -Wall -g -DMALSYNC  -I../malsync/mal/common -I../malsync/mal/client/common -I../malsync/mal/client/unix  -I/usr/local/include  -MT malsync.o -MD -MP -MF ".deps/malsync.Tpo" -c -o malsync.o malsync.c; \
        then mv -f ".deps/malsync.Tpo" ".deps/malsync.Po"; else rm -f ".deps/malsync.Tpo"; exit 1; fi
/bin/sh ../libtool --tag=CC --mode=link cc -Wall -g -DMALSYNC  -I../malsync/mal/common -I../malsync/mal/client/common -I../malsync/mal/client/unix  -I/usr/local/include    -o malsync  malsync.o -L/usr/local/lib -lpisock libmal.la

*** Warning: Linking the executable malsync against the loadable module
*** libmal.so is not portable!
cc -Wall -g -DMALSYNC -I../malsync/mal/common -I../malsync/mal/client/common -I../malsync/mal/client/unix -I/usr/local/include -o .libs/malsync malsync.o  -L/usr/local/lib ./.libs/libmal.so -lpisock -Wl,--rpath -Wl,/usr/local/lib
/usr/local/lib/libpisock.so: undefined reference to `pthread_create'
/usr/local/lib/libpisock.so: undefined reference to `pthread_cancel'
/usr/local/lib/libpisock.so: undefined reference to `pthread_setcanceltype'
/usr/local/lib/libpisock.so: undefined reference to `pthread_cond_timedwait'
gmake[2]: *** [malsync] Error 1
gmake[2]: Leaving directory `/usr/ports/palm/libmal/work/libmal-0.42/src'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/ports/palm/libmal/work/libmal-0.42'
gmake: *** [all] Error 2
*** Error code 2

Stop in /usr/ports/palm/libmal.

I believe this problem may be showing up do to the following conditions in the palm/pilot-link port:

When THREADS is selected, LDFLAGS are set to PTHREAD_LIBS, but are not added to the CONFIGURE_ENV.

Then when USB is selected, additional options are added to LDFLAGS, and then the CONFIGURE_ENV is set to use the LDFLAGS during the configure stage.

Fix: 

The fix for palm/pilot-link is to change:

.if defined(WITH_USB)
LIB_DEPENDS+=   usb-0.1.8:${PORTSDIR}/devel/libusb
CONFIGURE_ARGS+=--enable-libusb
CONFIGURE_ENV+="LDFLAGS=${LDFLAGS} -L${PREFIX}/lib -lusb"
.endif

to

.if defined(WITH_USB)
LIB_DEPENDS+=   usb-0.1.8:${PORTSDIR}/devel/libusb
CONFIGURE_ARGS+=--enable-libusb
LDFLAGS+=-L${PREFIX}/lib -lusb"
.endif
CONFIGURE_ENV+= LDFLAGS="${LDFLAGS}"

This would then allow PTHREAD_LIBS to pass to the configure stage.

Then add the following to the palm/libmal port:

OPTIONS=        THREADS "built-in thread safety" on

.if !defined(WITHOUT_THREADS)
LDFLAGS+=      ${PTHREAD_LIBS}
CONFIGURE_ENV+= LDFLAGS="${LDFLAGS}"
.endif
How-To-Repeat: Install the palm/pilot-link port with both THREADS and USB enabled.
Then try to build palm/libmal.
Comment 1 Edwin Groothuis freebsd_committer 2006-10-06 16:00:56 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback
Comment 2 dfilter service freebsd_committer 2006-10-07 13:51:45 UTC
pav         2006-10-07 12:51:39 UTC

  FreeBSD ports repository

  Modified files:
    palm/pilot-link      Makefile 
  Log:
  - Record -pthread requirement in pkg-config file, if threads are turned on
  - USB always needs threads turned on
  
  PR:             ports/104064
  
  Revision  Changes    Path
  1.80      +15 -4     ports/palm/pilot-link/Makefile
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 dfilter service freebsd_committer 2006-10-07 13:52:19 UTC
pav         2006-10-07 12:52:14 UTC

  FreeBSD ports repository

  Modified files:
    palm/libmal          Makefile 
  Added files:
    palm/libmal/files    patch-configure 
  Log:
  - Refer to pkg-config for pilot-link linking details. This will fix the build
    when pilot-link was compiled with threads
  
  PR:             ports/104064
  
  Revision  Changes    Path
  1.12      +1 -1      ports/palm/libmal/Makefile
  1.1       +11 -0     ports/palm/libmal/files/patch-configure (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 4 Pav Lucistnik freebsd_committer 2006-10-07 13:52:21 UTC
State Changed
From-To: feedback->closed

I think I fixed this real clever.