Bug 131021

Summary: audio/openal builds broken library when built with nasm present
Product: Ports & Packages Reporter: Dmitry Marakasov <amdmi3>
Component: Individual Port(s)Assignee: Dmitry Marakasov <amdmi3>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Dmitry Marakasov freebsd_committer 2009-01-26 18:40:06 UTC
When devel/nasm is installed on the system, openal's configure will detect in and include optimized assembly versions of some functions.
However, for some reason this produces unuseable openal library.

--- excerpt from openal build log ---
...
checking for dlopen in -ldl... no
checking for MMX support... yes
checking for nasm... /usr/local/bin/nasm
checking whether /usr/local/libexec/ccache/cc accepts -fvisibility=hidden... yes
...
gmake[4]: Entering directory `/usr/home/amdmi3/projects/freebsd/ports/audio/openal/work/openal-0.0.8/src/arch/i386'
test -d .libs || mkdir .libs
echo '# Generated by ltmain.sh - GNU libtool 1.5 (1.1220 2003/04/05 19:32:58)' >x86_cpu_caps_detect_prk.lo
echo "pic_object='.libs/x86_cpu_caps_detect_prk.o'" >>x86_cpu_caps_detect_prk.lo
echo "non_pic_object='x86_cpu_caps_detect_prk.o'" >>x86_cpu_caps_detect_prk.lo
/usr/local/bin/nasm -f elf x86_cpu_caps_detect_prk.nasm -o .libs/x86_cpu_caps_detect_prk.o -l x86_cpu_caps_detect_prk.lo.lst
x86_cpu_caps_detect_prk.nasm:65: warning: label alone on a line without a colon might be in error
test -d .libs || mkdir .libs
echo '# Generated by ltmain.sh - GNU libtool 1.5 (1.1220 2003/04/05 19:32:58)' >memcpy_mmx_prk.lo
echo "pic_object='.libs/memcpy_mmx_prk.o'" >>memcpy_mmx_prk.lo
echo "non_pic_object='memcpy_mmx_prk.o'" >>memcpy_mmx_prk.lo
/usr/local/bin/nasm -f elf memcpy_mmx_prk.nasm -o .libs/memcpy_mmx_prk.o -l memcpy_mmx_prk.lo.lst
memcpy_mmx_prk.nasm:62: warning: label alone on a line without a colon might be in error
memcpy_mmx_prk.nasm:84: warning: label alone on a line without a colon might be in error
/bin/sh /usr/local/bin/libtool --mode=link /usr/local/libexec/ccache/cc  -O2 -pipe -march=prescott -fno-strict-aliasing  -L/usr/local/lib -o libx86_asm_routines.la   x86_cpu_caps_detect_prk.lo memcpy_mmx_prk.lo  -lpthread 
ar cru .libs/libx86_asm_routines.a .libs/x86_cpu_caps_detect_prk.o .libs/memcpy_mmx_prk.o
ranlib .libs/libx86_asm_routines.a
creating libx86_asm_routines.la
(cd .libs && rm -f libx86_asm_routines.la && ln -s ../libx86_asm_routines.la libx86_asm_routines.la)
gmake[4]: Leaving directory `/usr/home/amdmi3/projects/freebsd/ports/audio/openal/work/openal-0.0.8/src/arch/i386'
...
---

Now trying to link with the library:

---
% cat test.c 
int main() { return 0; }
% cc test.c -o /dev/null -L/usr/local/lib -lopenal
/usr/local/lib/libopenal.so: undefined reference to `_alMMXmemcpy'
/usr/local/lib/libopenal.so: undefined reference to `_alDetectx86CPUCaps'
/usr/local/lib/libopenal.so: undefined reference to `__alMMXmemcpy'
/usr/local/lib/libopenal.so: undefined reference to `__alDetectx86CPUCaps'
%
---

The problem goes away if I deinstall nasm and recompile openal.

Fix: 

1) Hack configure to not detect nasm at all. For some reason, the test for nasm is completely missing from pointyhat/tinderbox builds, and I couldn't determine cause of that from configure
2) Fix it so correct library is produced. No ideas here as well, link command line produced by libtool seems quite correct for me:

cc -shared ... -Wl,--whole-archive ../src/arch/i386/.libs/libx86_asm_routines.a -Wl,--no-whole-archive ...
How-To-Repeat: - Install nasm
- Rebuild openal
- Try to install, say, audio/freealut
Comment 1 Edwin Groothuis freebsd_committer 2009-01-26 18:40:17 UTC
Responsible Changed
From-To: freebsd-ports-bugs->amdmi3

Submitter has GNATS access (via the GNATS Auto Assign Tool)
Comment 2 Edwin Groothuis freebsd_committer 2009-01-26 18:40:19 UTC
Maintainer of audio/openal,

Please note that PR ports/131021 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/131021

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 3 Edwin Groothuis freebsd_committer 2009-01-26 18:40:21 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 4 Dmitry Marakasov freebsd_committer 2009-03-16 00:54:48 UTC
State Changed
From-To: feedback->closed

Committed. Thanks!
Comment 5 dfilter service freebsd_committer 2009-03-16 00:54:48 UTC
amdmi3      2009-03-16 00:54:39 UTC

  FreeBSD ports repository

  Modified files:
    audio/openal         Makefile 
  Log:
  - Don't detect nasm, as it will lead to broken openal library built
  
  PR:             131021
  Submitted by:   myself
  Approved by:    maintainer timeout
  
  Revision  Changes    Path
  1.49      +2 -0      ports/audio/openal/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 6 dfilter service freebsd_committer 2009-03-16 22:57:41 UTC
amdmi3      2009-03-16 22:57:07 UTC

  FreeBSD ports repository

  Modified files:
    audio/openal         Makefile 
  Added files:
    audio/openal/files   patch-src-arch-i386-memcpy_mmx_prk.nasm 
                         patch-src-arch-i386-x86_cpu_caps_detect_prk.nasm 
  Log:
  - Improve previous fix:
    - add patches by [3] to fix assembly
    - make use of assembly OPTIONal and depend on nasm when it's enabled
  
  PR:             131021 [1], 129362 [2]
  Submitted by:   myself [1], "J. Altman <freebsd at chthonic dot com> [2]
  Patch by:       Edward Sutton <mirror176 at hotmail dot com> [3]
  Approved by:    oliver, maintainer timeout
  
  Revision  Changes    Path
  1.50      +10 -2     ports/audio/openal/Makefile
  1.1       +10 -0     ports/audio/openal/files/patch-src-arch-i386-memcpy_mmx_prk.nasm (new)
  1.1       +10 -0     ports/audio/openal/files/patch-src-arch-i386-x86_cpu_caps_detect_prk.nasm (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"