Bug 155157

Summary: devel/libdispatch don't build with clang on 8.2-RELEASE amd64
Product: Ports & Packages Reporter: Danilo Egêa Gondolfo <daniloegea>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Danilo Egêa Gondolfo 2011-03-01 14:30:10 UTC
Don't build with clang and clang-devel, works with GCC.

===>  Building for libdispatch-174
Making all in dispatch
Making all in man
Making all in src
make  all-am
/bin/sh ../libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I../config -I.. -I..   -Wall  -fblocks   -fPIC -MT libdispatch_la-apply.lo -MD -MP -MF .deps/libdispatch_la-apply.Tpo -c -o libdispatch_la-apply.lo `test -f 'apply.c' || echo './'`apply.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-apply.lo -MD -MP -MF .deps/libdispatch_la-apply.Tpo -c apply.c  -fPIC -DPIC -o .libs/libdispatch_la-apply.o
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-apply.lo -MD -MP -MF .deps/libdispatch_la-apply.Tpo -c apply.c -o libdispatch_la-apply.o >/dev/null 2>&1
mv -f .deps/libdispatch_la-apply.Tpo .deps/libdispatch_la-apply.Plo
/bin/sh ../libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I../config -I.. -I..   -Wall  -fblocks   -fPIC -MT libdispatch_la-benchmark.lo -MD -MP -MF .deps/libdispatch_la-benchmark.Tpo -c -o libdispatch_la-benchmark.lo `test -f 'benchmark.c' || echo './'`benchmark.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-benchmark.lo -MD -MP -MF .deps/libdispatch_la-benchmark.Tpo -c benchmark.c  -fPIC -DPIC -o .libs/libdispatch_la-benchmark.o
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-benchmark.lo -MD -MP -MF .deps/libdispatch_la-benchmark.Tpo -c benchmark.c -o libdispatch_la-benchmark.o >/dev/null 2>&1
mv -f .deps/libdispatch_la-benchmark.Tpo .deps/libdispatch_la-benchmark.Plo
/bin/sh ../libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I../config -I.. -I..   -Wall  -fblocks   -fPIC -MT libdispatch_la-object.lo -MD -MP -MF .deps/libdispatch_la-object.Tpo -c -o libdispatch_la-object.lo `test -f 'object.c' || echo './'`object.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-object.lo -MD -MP -MF .deps/libdispatch_la-object.Tpo -c object.c  -fPIC -DPIC -o .libs/libdispatch_la-object.o
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-object.lo -MD -MP -MF .deps/libdispatch_la-object.Tpo -c object.c -o libdispatch_la-object.o >/dev/null 2>&1
mv -f .deps/libdispatch_la-object.Tpo .deps/libdispatch_la-object.Plo
/bin/sh ../libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I../config -I.. -I..   -Wall  -fblocks   -fPIC -MT libdispatch_la-once.lo -MD -MP -MF .deps/libdispatch_la-once.Tpo -c -o libdispatch_la-once.lo `test -f 'once.c' || echo './'`once.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-once.lo -MD -MP -MF .deps/libdispatch_la-once.Tpo -c once.c  -fPIC -DPIC -o .libs/libdispatch_la-once.o
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-once.lo -MD -MP -MF .deps/libdispatch_la-once.Tpo -c once.c -o libdispatch_la-once.o >/dev/null 2>&1
mv -f .deps/libdispatch_la-once.Tpo .deps/libdispatch_la-once.Plo
/bin/sh ../libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I../config -I.. -I..   -Wall  -fblocks   -fPIC -MT libdispatch_la-queue.lo -MD -MP -MF .deps/libdispatch_la-queue.Tpo -c -o libdispatch_la-queue.lo `test -f 'queue.c' || echo './'`queue.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-queue.lo -MD -MP -MF .deps/libdispatch_la-queue.Tpo -c queue.c  -fPIC -DPIC -o .libs/libdispatch_la-queue.o
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-queue.lo -MD -MP -MF .deps/libdispatch_la-queue.Tpo -c queue.c -o libdispatch_la-queue.o >/dev/null 2>&1
mv -f .deps/libdispatch_la-queue.Tpo .deps/libdispatch_la-queue.Plo
/bin/sh ../libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I../config -I.. -I..   -Wall  -fblocks   -fPIC -MT libdispatch_la-queue_kevent.lo -MD -MP -MF .deps/libdispatch_la-queue_kevent.Tpo -c -o libdispatch_la-queue_kevent.lo `test -f 'queue_kevent.c' || echo './'`queue_kevent.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-queue_kevent.lo -MD -MP -MF .deps/libdispatch_la-queue_kevent.Tpo -c queue_kevent.c  -fPIC -DPIC -o .libs/libdispatch_la-queue_kevent.o
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-queue_kevent.lo -MD -MP -MF .deps/libdispatch_la-queue_kevent.Tpo -c queue_kevent.c -o libdispatch_la-queue_kevent.o >/dev/null 2>&1
mv -f .deps/libdispatch_la-queue_kevent.Tpo .deps/libdispatch_la-queue_kevent.Plo
/bin/sh ../libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I../config -I.. -I..   -Wall  -fblocks   -fPIC -MT libdispatch_la-semaphore.lo -MD -MP -MF .deps/libdispatch_la-semaphore.Tpo -c -o libdispatch_la-semaphore.lo `test -f 'semaphore.c' || echo './'`semaphore.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-semaphore.lo -MD -MP -MF .deps/libdispatch_la-semaphore.Tpo -c semaphore.c  -fPIC -DPIC -o .libs/libdispatch_la-semaphore.o
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-semaphore.lo -MD -MP -MF .deps/libdispatch_la-semaphore.Tpo -c semaphore.c -o libdispatch_la-semaphore.o >/dev/null 2>&1
mv -f .deps/libdispatch_la-semaphore.Tpo .deps/libdispatch_la-semaphore.Plo
/bin/sh ../libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I../config -I.. -I..   -Wall  -fblocks   -fPIC -MT libdispatch_la-source.lo -MD -MP -MF .deps/libdispatch_la-source.Tpo -c -o libdispatch_la-source.lo `test -f 'source.c' || echo './'`source.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-source.lo -MD -MP -MF .deps/libdispatch_la-source.Tpo -c source.c  -fPIC -DPIC -o .libs/libdispatch_la-source.o
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-source.lo -MD -MP -MF .deps/libdispatch_la-source.Tpo -c source.c -o libdispatch_la-source.o >/dev/null 2>&1
mv -f .deps/libdispatch_la-source.Tpo .deps/libdispatch_la-source.Plo
/bin/sh ../libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I../config -I.. -I..   -Wall  -fblocks   -fPIC -MT libdispatch_la-source_kevent.lo -MD -MP -MF .deps/libdispatch_la-source_kevent.Tpo -c -o libdispatch_la-source_kevent.lo `test -f 'source_kevent.c' || echo './'`source_kevent.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-source_kevent.lo -MD -MP -MF .deps/libdispatch_la-source_kevent.Tpo -c source_kevent.c  -fPIC -DPIC -o .libs/libdispatch_la-source_kevent.o
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-source_kevent.lo -MD -MP -MF .deps/libdispatch_la-source_kevent.Tpo -c source_kevent.c -o libdispatch_la-source_kevent.o >/dev/null 2>&1
mv -f .deps/libdispatch_la-source_kevent.Tpo .deps/libdispatch_la-source_kevent.Plo
/bin/sh ../libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I../config -I.. -I..   -Wall  -fblocks   -fPIC -MT libdispatch_la-time.lo -MD -MP -MF .deps/libdispatch_la-time.Tpo -c -o libdispatch_la-time.lo `test -f 'time.c' || echo './'`time.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-time.lo -MD -MP -MF .deps/libdispatch_la-time.Tpo -c time.c  -fPIC -DPIC -o .libs/libdispatch_la-time.o
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -Wall -fblocks -fPIC -MT libdispatch_la-time.lo -MD -MP -MF .deps/libdispatch_la-time.Tpo -c time.c -o libdispatch_la-time.o >/dev/null 2>&1
mv -f .deps/libdispatch_la-time.Tpo .deps/libdispatch_la-time.Plo
/bin/sh ../libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I../config -I.. -I..    -fPIC -MT mach.lo -MD -MP -MF .deps/mach.Tpo -c -o mach.lo `test -f 'shims/mach.c' || echo './'`shims/mach.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -fPIC -MT mach.lo -MD -MP -MF .deps/mach.Tpo -c shims/mach.c  -fPIC -DPIC -o .libs/mach.o
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -fPIC -MT mach.lo -MD -MP -MF .deps/mach.Tpo -c shims/mach.c -o mach.o >/dev/null 2>&1
mv -f .deps/mach.Tpo .deps/mach.Plo
/bin/sh ../libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I../config -I.. -I..    -fPIC -MT time.lo -MD -MP -MF .deps/time.Tpo -c -o time.lo `test -f 'shims/time.c' || echo './'`shims/time.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -fPIC -MT time.lo -MD -MP -MF .deps/time.Tpo -c shims/time.c  -fPIC -DPIC -o .libs/time.o
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../config -I.. -I.. -fPIC -MT time.lo -MD -MP -MF .deps/time.Tpo -c shims/time.c -o time.o >/dev/null 2>&1
mv -f .deps/time.Tpo .deps/time.Plo
/bin/sh ../libtool --tag=CC    --mode=link clang  -fPIC    -o libshims.la  mach.lo time.lo  -lpthread  -L/usr/local/lib -lBlocksRuntime
libtool: link: ar cru .libs/libshims.a .libs/mach.o .libs/time.o 
libtool: link: ranlib .libs/libshims.a
libtool: link: ( cd ".libs" && rm -f "libshims.la" && ln -s "../libshims.la" "libshims.la" )
/bin/sh ../libtool --tag=CC    --mode=link clang -Wall  -fblocks    -fPIC   -o libdispatch.la -rpath /usr/local/lib libdispatch_la-apply.lo  libdispatch_la-benchmark.lo libdispatch_la-object.lo  libdispatch_la-once.lo libdispatch_la-queue.lo  libdispatch_la-queue_kevent.lo libdispatch_la-semaphore.lo  libdispatch_la-source.lo libdispatch_la-source_kevent.lo  libdispatch_la-time.lo   libshims.la  -lpthread  -L/usr/local/lib -lBlocksRuntime
libtool: link: clang -shared  .libs/libdispatch_la-apply.o .libs/libdispatch_la-benchmark.o .libs/libdispatch_la-object.o .libs/libdispatch_la-once.o .libs/libdispatch_la-queue.o .libs/libdispatch_la-queue_kevent.o .libs/libdispatch_la-semaphore.o .libs/libdispatch_la-source.o .libs/libdispatch_la-source_kevent.o .libs/libdispatch_la-time.o  -Wl,--whole-archive ./.libs/libshims.a -Wl,--no-whole-archive  -L/usr/local/lib -lpthread -lBlocksRuntime    -Wl,-soname -Wl,libdispatch.so.0 -o .libs/libdispatch.so.0
/usr/local/bin/ld: .libs/libdispatch_la-apply.o: relocation R_X86_64_PC32 against symbol `_dispatch_hw_config' can not be used when making a shared object; recompile with -fPIC
/usr/local/bin/ld: final link failed: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop in /usr/ports/devel/libdispatch/work/libdispatch-r174/src.
*** Error code 1

Stop in /usr/ports/devel/libdispatch/work/libdispatch-r174/src.
*** Error code 1

Stop in /usr/ports/devel/libdispatch/work/libdispatch-r174.
*** Error code 1

Stop in /usr/ports/devel/libdispatch.
*** Error code 1

Stop in /usr/ports/devel/libdispatch.

How-To-Repeat: cd /usr/ports/devel/libdispatch
make
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2011-03-02 02:29:17 UTC
Responsible Changed
From-To: freebsd-ports-bugs->stas

Fix synopsis and assign. 

Note, however, that according to the wiki, we're still more interested 
in patches than in just acknowledgements that ports don't build: 

http://wiki.freebsd.org/PortsAndClang 

We're currently aware of around 900 errors ...
Comment 2 Danilo Egêa Gondolfo 2011-03-02 15:14:09 UTC
The problem is the binutils version, the port try to use the 
binutils-2.21. With the binutils-2.15 (native of the system) works fine.

-- 
Danilo Egêa Gondolfo
http://daniloegea.wordpress.com

__________________________________________________
Fale com seus amigos  de graça com o novo Yahoo! Messenger 
http://br.messenger.yahoo.com/
Comment 3 Pan Tsu 2011-05-19 06:39:10 UTC
This is a common linking error due to Clang excessive warnings and
affects many ports. Here is the excerpt

   if (exit $ac_status) && test -s "$ac_outfile"; then
     # The compiler can only warn and ignore the option if not recognized
     # So say no if there are warnings other than the usual output.
     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
       lt_cv_prog_compiler_pic_works=yes
     fi
   fi

Which can be worked around by either -Qunused-arguments in CFLAGS or
lt_cv_prog_compiler_pic_works=yes in CONFIGURE_ENV or below patch(es)

--- a.diff begins here ---
Index: devel/libdispatch/files/patch-clang
===================================================================
RCS file: devel/libdispatch/files/patch-clang
diff -N devel/libdispatch/files/patch-clang
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ devel/libdispatch/files/patch-clang	19 May 2011 05:23:51 -0000
@@ -0,0 +1,14 @@
+--- configure~
++++ configure
+@@ -9396,9 +9396,10 @@ else
+    echo "$as_me:9396: \$? = $ac_status" >&5
+    if (exit $ac_status) && test -s "$ac_outfile"; then
+      # The compiler can only warn and ignore the option if not recognized
++     # except for clang warnings about unused arguments.
+      # So say no if there are warnings other than the usual output.
+      $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
++     $SED '/argument unused/d; /^$/d; /^ *+/d' conftest.err >conftest.er2
+      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+        lt_cv_prog_compiler_pic_works=yes
+      fi
--- a.diff ends here ---

--- b.diff begins here ---
Index: Mk/bsd.port.mk
===================================================================
RCS file: /a/.cvsup/ports/Mk/bsd.port.mk,v
retrieving revision 1.682
diff -u -p -r1.682 bsd.port.mk
--- Mk/bsd.port.mk	6 May 2011 06:20:12 -0000	1.682
+++ Mk/bsd.port.mk	19 May 2011 05:28:07 -0000
@@ -3021,7 +3028,7 @@ CONFIGURE_MAX_CMD_LEN!=	${SYSCTL} -n ker
 .endif
 GNU_CONFIGURE_PREFIX?=	${PREFIX}
 CONFIGURE_ARGS+=	--prefix=${GNU_CONFIGURE_PREFIX} $${_LATE_CONFIGURE_ARGS}
-CONFIGURE_ENV+=		lt_cv_sys_max_cmd_len=${CONFIGURE_MAX_CMD_LEN}
+CONFIGURE_ENV+=		lt_cv_sys_max_cmd_len=${CONFIGURE_MAX_CMD_LEN} lt_cv_prog_compiler_pic_works=yes
 HAS_CONFIGURE=		yes
 
 SET_LATE_CONFIGURE_ARGS= \
--- b.diff ends here ---
Comment 4 dfilter service freebsd_committer freebsd_triage 2011-08-21 09:03:18 UTC
stas        2011-08-21 08:03:09 UTC

  FreeBSD ports repository

  Modified files:
    devel/libdispatch    Makefile 
  Log:
  - Force PIC support in configure, so the check will pass on broken
    compiler/linker combinations as well.
  
  PR:             ports/155157
  Submitted by:   Pan Tsu <inyaoo@gmail.com>
  
  Revision  Changes    Path
  1.14      +2 -0      ports/devel/libdispatch/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 5 Thomas Abthorpe freebsd_committer freebsd_triage 2011-11-05 04:12:38 UTC
Responsible Changed
From-To: stas->freebsd-ports-bugs

- back to the heap
Comment 6 Martin Wilke freebsd_committer freebsd_triage 2011-11-28 12:45:51 UTC
State Changed
From-To: open->closed

patch was committed on 21th august