On Thu, Apr 09, 2015 at 08:26:30AM +0100, Stuart Henderson wrote:
> (note, this isn't anything to do with the recent libc/pthread changes).
> 
> Hitting this repeatable failure with the new games/megaglest/base update:
> 
> /usr/obj/ports/megaglest-3.11.1/megaglest-3.11.1/source/shared_lib/sources/platform/posix/ircclient.cpp:
>  In function 'void Shared::PlatformCommon::event_numeric(irc_session_t*, 
> unsigned int, const char*, const char**, unsigned int)':
> /usr/obj/ports/megaglest-3.11.1/megaglest-3.11.1/source/shared_lib/sources/platform/posix/ircclient.cpp:416:
>  error: 'LIBIRC_RFC_ERR_NICKNAMEINUSE' was not declared in this scope
> /usr/obj/ports/megaglest-3.11.1/megaglest-3.11.1/source/shared_lib/sources/platform/posix/ircclient.cpp:417:
>  error: 'LIBIRC_RFC_ERR_NICKCOLLISION' was not declared in this scope
> /usr/obj/ports/megaglest-3.11.1/megaglest-3.11.1/source/shared_lib/sources/platform/posix/ircclient.cpp:435:
>  error: 'LIBIRC_RFC_ERR_NOTREGISTERED' was not declared in this scope
> /usr/obj/ports/megaglest-3.11.1/megaglest-3.11.1/source/shared_lib/sources/platform/posix/ircclient.cpp:455:
>  error: 'LIBIRC_RFC_RPL_TOPIC' was not declared in this scope
> /usr/obj/ports/megaglest-3.11.1/megaglest-3.11.1/source/shared_lib/sources/platform/posix/ircclient.cpp:457:
>  error: 'LIBIRC_RFC_RPL_NAMREPLY' was not declared in this scope
> /usr/obj/ports/megaglest-3.11.1/megaglest-3.11.1/source/shared_lib/sources/platform/posix/ircclient.cpp:491:
>  error: 'LIBIRC_RFC_RPL_ENDOFNAMES' was not declared in this scope
> 
> It's because HAS_LIBIRCCLIENT_1_6 is not set so it doesn't pull in
> the header defining these macros. During cmake config it runs this test,
> which fails:
> 
> -- -- -- --
> Performing C++ SOURCE FILE Test HAS_LIBIRCCLIENT_1_6 failed with the 
> following output:
> Change Dir: /usr/obj/ports/megaglest-3.11.1/build-i386/CMakeFiles/CMakeTmp
> 
> Run Build Command:"/usr/local/bin/ninja" "cmTryCompileExec2631527859"
> [1/2] Building CXX object CMakeFiles/cmTryCompileExec2631527859.dir/src.cxx.o
> [2/2] Linking CXX executable cmTryCompileExec2631527859
> FAILED: : && /usr/bin/c++   -O2 -pipe     -DHAS_LIBIRCCLIENT_1_6   
> CMakeFiles/cmTryCompileExec2631527859.dir/src.cxx.o  -o 
> cmTryCompileExec2631527859 -L/usr/local/lib -lircclient 
> -Wl,-rpath-link,/usr/X11R6/lib:/usr/local/lib && :
> /usr/local/lib/libircclient.so.1.0: warning: strcpy() is almost always 
> misused, please use strlcpy()
> /usr/local/lib/libircclient.so.1.0: warning: sprintf() is often misused, 
> please use snprintf()
> /usr/local/lib/libircclient.so.1.0: undefined reference to 
> `pthread_mutexattr_settype'
> /usr/local/lib/libircclient.so.1.0: undefined reference to 
> `pthread_mutex_unlock'
> /usr/local/lib/libircclient.so.1.0: undefined reference to `pthread_self'
> /usr/local/lib/libircclient.so.1.0: undefined reference to 
> `pthread_mutexattr_init'
> /usr/local/lib/libircclient.so.1.0: undefined reference to 
> `pthread_mutex_destroy'
> /usr/local/lib/libircclient.so.1.0: undefined reference to 
> `pthread_mutex_lock'
> /usr/local/lib/libircclient.so.1.0: undefined reference to 
> `pthread_mutex_init'
> collect2: ld returned 1 exit status
> ninja: build stopped: subcommand failed.
> 
> Return value: 1
> Source file was:
> 
>                 #include <stdio.h>
>                 #include <stdlib.h>
>                 #include <libircclient.h>
>                 int main()
>                 {
>                 unsigned int high = 0;
>                 unsigned int low = 0;
>                 irc_get_version(&high,&low);
>                 if( (high == 1 && low >= 6) || (high > 1)) {
>                   return 0;
>                 }
>                 throw 1;
>                 }
> -- -- -- --
> 
> libircclient simply doesn't link libpthread.so to its library (despite
> using functions from it). The previous cmake file explicitly used
> -lpthread when it checked libircclient, but that isn't included in
> this one. Anyway it seems most sensible to just register the pthread
> dependency in ircclient. OK?
> 
> (I didn't look into how this would have built in testing, but
> perhaps some other cmake test caused it to add pthread to the library
> list, and that didn't happen in my tests/bulk build due to having
> different things installed).

Yep, that looks sane to me.


> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/net/libircclient/Makefile,v
> retrieving revision 1.6
> diff -u -p -r1.6 Makefile
> --- Makefile  5 Apr 2015 23:31:08 -0000       1.6
> +++ Makefile  9 Apr 2015 07:09:27 -0000
> @@ -2,6 +2,7 @@
>  
>  COMMENT =            library which implements the IRC protocol
>  DISTNAME =           libircclient-1.8
> +REVISION =           0
>  CATEGORIES =         net
>  HOMEPAGE =           http://www.ulduzsoft.com/linux/libircclient/
>  
> @@ -10,7 +11,7 @@ SHARED_LIBS =               ircclient 1.0
>  # LGPLv2
>  PERMIT_PACKAGE_CDROM =       Yes
>  
> -WANTLIB += crypto ssl
> +WANTLIB += crypto pthread ssl
>  
>  MASTER_SITES =               ${MASTER_SITE_SOURCEFORGE:=libircclient/}
>  
> Index: patches/patch-src_Makefile_in
> ===================================================================
> RCS file: patches/patch-src_Makefile_in
> diff -N patches/patch-src_Makefile_in
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_Makefile_in     9 Apr 2015 07:09:27 -0000
> @@ -0,0 +1,12 @@
> +$OpenBSD$
> +--- src/Makefile.in.orig     Thu Apr  9 07:58:09 2015
> ++++ src/Makefile.in  Thu Apr  9 07:58:59 2015
> +@@ -27,7 +27,7 @@ install:
> +     ln -fs libircclient.so.$(APIVERSION) $(DESTDIR)@libdir@/libircclient.so
> + 
> + libircclient.so: libircclient.o
> +-    $(CC) -shared -s -Wl,-soname,libircclient.so.$(APIVERSION) -o 
> libircclient.so libircclient.o @LIBS@
> ++    $(CC) -shared -s -lpthread -Wl,-soname,libircclient.so.$(APIVERSION) -o 
> libircclient.so libircclient.o @LIBS@
> + 
> + libircclient.dll: libircclient.o
> +     $(CC) -shared -s -o libircclient.dll -Wl,-out-implib,libircclient.lib 
> libircclient.o libircclient.def -lkernel32 -lwsock32 @LIBS@
> 

-- 
Antoine

Reply via email to