Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 334797 - media-sound/rezound-0.12.3_beta-r2 build fails on linking problem with -O2
Summary: media-sound/rezound-0.12.3_beta-r2 build fails on linking problem with -O2
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: High minor (vote)
Assignee: Professional Audio Applications Maintainers
URL:
Whiteboard:
Keywords:
: 341011 351317 (view as bug list)
Depends on:
Blocks: 340997
  Show dependency tree
 
Reported: 2010-08-27 11:13 UTC by Petr Novak
Modified: 2012-06-08 13:26 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build log with -02 (rezound-0.12.3_beta-r2-fail-build.log,193.71 KB, text/plain)
2010-08-27 11:17 UTC, Petr Novak
Details
Instantiate createPool<sample_t> (gentoo334797a.patch,1.27 KB, patch)
2011-01-11 08:18 UTC, Martin von Gagern
Details | Diff
Proposed new ebuild (rezound-0.12.3_beta-r2.ebuild,2.42 KB, text/plain)
2011-01-13 13:24 UTC, John
Details
Proposed patch for new ebuild (same as previous patch, but renamed) (rezound-0.12.3_beta-O2.patch,1.27 KB, patch)
2011-01-13 13:25 UTC, John
Details | Diff
Let gcc handle template instantiation (gentoo334797b.patch,2.30 KB, patch)
2012-05-22 20:12 UTC, Martin von Gagern
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Novak 2010-08-27 11:13:46 UTC
Build of rezound-0.12.3_beta-r2 fails to link one of its internal libraries. The error is similar to bug #275437, but it shows up even with my CFLAGS="-O2 -pipe -march=core2". The problem disappears only when I decrease optimizations to -O1. (e.g. build it with CFLAGS="-O1 -pipe -march=core2" CXXFLAGS="${CFLAGS}" MAKEOPTS=-j1 emerge -1 rezound).

Maybe -O2 should be filtered as well in some cases?

Reproducible: Always

Steps to Reproduce:
1. MAKEOPTS=-j1 emerge -1 rezound
Actual Results:  
/bin/sh ../../libtool --tag=CXX   --mode=link x86_64-pc-linux-gnu-g++  -O2 -pipe -march=core2 -g -Wall -Wno-unused-function -Wno-unused-variable -Wno-unused  -Wl,-O1 -Wl,--as-needed -Xlinker -lpthread -o rezound main.o libfrontend.la ../../src/backend/libbackend.la ../../src/backend/File/libFile.la ../../src/backend/Edits/libEdits.la ../../src/backend/Effects/libEffects.la ../../src/backend/Filters/libFilters.la ../../src/backend/Looping/libLooping.la ../../src/backend/Remaster/libRemaster.la ../../src/backend/Generate/libGenerate.la ../../src/backend/LADSPA/libLADSPA.la ../../src/misc/CNestedDataFile/libmiscCN.la ../../src/PoolFile/libPoolFile.la  -lFOX-1.6         -lrfftw -lfftw -lasound -lm -ldl -lpthread -lpthread -lpthread
libtool: link: x86_64-pc-linux-gnu-g++ -O2 -pipe -march=core2 -g -Wall -Wno-unused-function -Wno-unused-variable -Wno-unused -Wl,-O1 -Wl,-lpthread -o rezound main.o  -Wl,--as-needed ./.libs/libfrontend.a -L/usr/lib64 ../../src/backend/.libs/libbackend.a /usr/lib64/libaudiofile.so /usr/lib64/libvorbisfile.so /usr/lib64/libvorbisenc.so /usr/lib64/libvorbis.so -logg ../../src/backend/File/.libs/libFile.a ../../src/backend/Edits/.libs/libEdits.a ../../src/backend/Effects/.libs/libEffects.a ../../src/backend/Filters/.libs/libFilters.a ../../src/backend/Looping/.libs/libLooping.a ../../src/backend/Remaster/.libs/libRemaster.a /usr/lib64/libSoundTouch.so ../../src/backend/Generate/.libs/libGenerate.a ../../src/backend/LADSPA/.libs/libLADSPA.a ../../src/misc/CNestedDataFile/.libs/libmiscCN.a ../../src/PoolFile/.libs/libPoolFile.a /usr/lib64/libFOX-1.6.so /usr/lib64/libXft.so /usr/lib64/libfontconfig.so /usr/lib64/libfreetype.so /usr/lib64/libexpat.so /usr/lib64/libXcursor.so /usr/lib64/libXfixes.so /usr/lib64/libXrandr.so /usr/lib64/libXext.so /usr/lib64/libXrender.so /usr/lib64/libX11.so /usr/lib64/libxcb.so /usr/lib64/libXau.so /usr/lib64/libXdmcp.so /usr/lib64/libpng14.so /usr/lib64/libtiff.so /usr/lib64/libjpeg.so -lc -lz -lbz2 -lcups -lnsl -lGLU /usr/lib64/libdrfftw.so /usr/lib64/libdfftw.so /usr/lib64/libasound.so -lrt -lm -ldl -lpthread -Wl,-rpath -Wl,/usr/lib64 -Wl,-rpath -Wl,/usr/lib64
../../src/backend/.libs/libbackend.a(CNativeSoundClipboard.o): In function `CNativeSoundClipboard::temporarilyShortenLength(unsigned int, unsigned long)':
/var/tmp/portage/media-sound/rezound-0.12.3_beta-r2/work/rezound-0.12.3beta/src/backend/CNativeSoundClipboard.cpp:140: undefined reference to `TStaticPoolAccesser<float, TPoolFile<unsigned long, unsigned long> > TPoolFile<unsigned long, unsigned long>::createPool<float>(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'
../../src/backend/.libs/libbackend.a(CNativeSoundClipboard.o): In function `CNativeSoundClipboard::copyFrom(CSound const*, bool const*, unsigned long, unsigned long)':
/var/tmp/portage/media-sound/rezound-0.12.3_beta-r2/work/rezound-0.12.3beta/src/backend/CNativeSoundClipboard.cpp:68: undefined reference to `TStaticPoolAccesser<float, TPoolFile<unsigned long, unsigned long> > TPoolFile<unsigned long, unsigned long>::createPool<float>(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool)'
collect2: ld returned 1 exit status
make[2]: *** [rezound] Error 1
make[2]: Leaving directory `/var/tmp/portage/media-sound/rezound-0.12.3_beta-r2/work/rezound-0.12.3beta/src/frontend_fox'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/media-sound/rezound-0.12.3_beta-r2/work/rezound-0.12.3beta/src'
make: *** [all-recursive] Error 1

Expected Results:  
emerge cleanly even with -O2 in default CFLAGS

nok ~ # emerge --info =media-sound/rezound-0.12.3_beta-r2
Portage 2.1.8.3 (default/linux/amd64/10.0, gcc-4.4.3, glibc-2.11.2-r0, 2.6.34.5 x86_64)
=================================================================
                        System Settings
=================================================================
System uname: Linux-2.6.34.5-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T5870_@_2.00GHz-with-gentoo-1.12.13
Timestamp of tree: Fri, 27 Aug 2010 10:00:22 +0000
ccache version 2.4 [disabled]
app-shells/bash:     4.0_p37
dev-java/java-config: 2.1.11
dev-lang/python:     2.6.5-r3, 3.1.2-r4
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.65
sys-devel/automake:  1.4_p6, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.3-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA @FREE dlj-1.1 skype-eula AdobeFlash-10.1"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=core2"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/init.d /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=core2"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://gentoo.inode.at"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en_US"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/kde /usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac acpi alsa amd64 arts avi berkdb bluetooth bzip2 cdr cli cracklib crypt css cups cxx dbus divx4linux dri dts dvd dvdr dvdread encode exif fortran gdbm gif gtk2 hal iconv icq imagemagick imap jabber jpeg kde lcms live matroska mmx modules mozilla mp3 mpeg mudflap multilib ncurses nls nptl nptlonly offensive opengl openmp pam pcre perl png pppd python qt qt3support qt4 quicktime readline reflection session spl sse sse2 ssl svg sysfs tcpd theora tiff truetype unicode usb vhosts vorbis wifi x264 xml2 xorg xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="rewrite authz_host dir mime" CAMERAS="canon ptp2" ELIBC="glibc" INPUT_DEVICES="evdev keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_US" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

media-sound/rezound-0.12.3_beta-r2 was built with the following:
USE="alsa (multilib) nls soundtouch vorbis -16bittmp -flac -jack -oss -portaudio" 
CFLAGS="-O1 -pipe -march=core2"
CXXFLAGS="-O1 -pipe -march=core2"

^ That seems to come from the successful build I've tried before.

nok ~ # emerge -pqv =media-sound/rezound-0.12.3_beta-r2
[ebuild   R   ] media-sound/rezound-0.12.3_beta-r2  USE="alsa nls soundtouch vorbis -16bittmp -flac -jack -oss -portaudio"
Comment 1 Petr Novak 2010-08-27 11:17:16 UTC
Created attachment 244917 [details]
build log with -02
Comment 2 Plopmaster 2010-09-28 09:41:28 UTC
It even fails with -O1 IF USE=portaudio :)
When USE=-portaudio, it's ok with -O1, but not with -O2
Comment 3 Michael Weber (RETIRED) gentoo-dev 2010-10-14 23:59:51 UTC
*** Bug 340997 has been marked as a duplicate of this bug. ***
Comment 4 Michael Weber (RETIRED) gentoo-dev 2010-10-15 00:00:02 UTC
*** Bug 341011 has been marked as a duplicate of this bug. ***
Comment 5 DEMAINE Benoît-Pierre, aka DoubleHP 2010-10-15 00:17:50 UTC
#CFLAGS="-O2 -march=athlon64 -pipe -fomit-frame-pointer"
CFLAGS="-O1 -march=athlon64 -pipe -fomit-frame-pointer"

fixed it for me (for one shot).
Comment 6 Martin von Gagern 2010-12-21 19:56:11 UTC
Some detective work: The symbol in question,
 TStaticPoolAccesser<float, TPoolFile<unsigned long, unsigned long> >
 TPoolFile<unsigned long, unsigned long>::
 createPool<float>(string, bool)
has the mangled name
 _ZN9TPoolFileImmE10createPoolIfEE19TStaticPoolAccesserIT_S0_ESsb

This name is referenced in CNativeSoundClipboard.o, as the error message states. In the -O1 build, the name is defined in CSound.o. Towards the end of CSound.cpp there is a number of explicit template initializations, none of which matches the version mentioned above, as they use a different template parameter for the createPool itself.

My guess is that some other code in this file uses createPool<float>. Seems to be via some typedef, perhaps createPool<sample_t> or some such. In the -O1 build, the function is instantiated, its code generated, and other code can reference it. In the -O2 build, the compiler inlines the function, therefore sees no reason to generate function code for it, therefore the symbol remains unreferenced.

http://gcc.gnu.org/onlinedocs/gcc/Template-Instantiation.html might be interesting reading. And adding the correct explicit instantiation to CSound.cpp should do the trick. Haven't tried yet, though.
Comment 7 Lars Wendler (Polynomial-C) gentoo-dev 2011-01-11 00:22:05 UTC
*** Bug 351317 has been marked as a duplicate of this bug. ***
Comment 8 Martin von Gagern 2011-01-11 08:18:38 UTC
Created attachment 259521 [details, diff]
Instantiate createPool<sample_t>

This patch does seem to fix the issue for me. Please test.

Reported this whole issue upstream:
https://sourceforge.net/tracker/?func=detail&aid=3155234&group_id=5056&atid=105056
Comment 9 Petr Novak 2011-01-11 22:04:41 UTC
(In reply to comment #8)
> This patch does seem to fix the issue for me. Please test.

Fixes this for me as well. Thank you!
Comment 10 John 2011-01-13 13:24:16 UTC
Created attachment 259698 [details]
Proposed new ebuild
Comment 11 John 2011-01-13 13:25:21 UTC
Created attachment 259699 [details, diff]
Proposed patch for new ebuild (same as previous patch, but renamed)

Could this find it's way into the tree? Compiles fine here.
Comment 12 Jesse Adelman 2011-04-09 03:42:43 UTC
It would seem that development upstream has stalled.

http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTindNh5rpbHaXgH6irMnzeVNLf4KQhHF9yXoyQpJ%40mail.gmail.com&forum_name=rezound-users (no response to friendly query regarding development status)

No SVN updates for 13 months.

http://rezound.svn.sourceforge.net/viewvc/rezound/

And, no response from upstream (publicly) on the SF Rezound bugtracker to patch submitted in comment #8. Perhaps this package should be put out to pasture?
Comment 13 Martin von Gagern 2011-04-09 09:41:18 UTC
(In reply to comment #12)
> Perhaps this package should be put out to pasture?

Meaning remove it from tree? I would hate to see it go. There is a patch, it has twice been confirmed to work, why not simply include it in portage and close this bug? I see no urgent reason to stop supporting the package unless bigger problems occur and neither the devs nor the community seem willing to write patches for it.
Comment 14 DEMAINE Benoît-Pierre, aka DoubleHP 2011-04-09 13:14:49 UTC
Jesse; Gentoo distributes software for people who want them; not because of people who write them.

We shall not remove apps just because upstream died; apps may keep working ... especially if WE maintain them. Especially if some other people wrote patches to keep them working.
Comment 15 Florian Berger 2012-03-16 12:29:21 UTC
Ebuild and patch work fine here.

+1 for keeping Rezound in the tree and adding the patch to files/.
Comment 16 Lars Wendler (Polynomial-C) gentoo-dev 2012-05-21 14:47:29 UTC
I'd be happy to fix this bug but...

Martin, the patch doesn't work for me. It fails with this error message:

/var/tmp/portage/media-sound/rezound-0.12.3_beta-r2/work/rezound-0.12.3beta/src/frontend_fox/../../src/PoolFile/TStaticPoolAccesser.cpp:79: undefined reference to `void TPoolFile<unsigned long, unsigned long>::removeAccesser<float>(TStaticPoolAccesser<float, TPoolFile<unsigned long, unsigned long> > const*)'
../../src/backend/.libs/libbackend.a(CMIDISDSSoundTranslator.o): In function `~TStaticPoolAccesser':
/var/tmp/portage/media-sound/rezound-0.12.3_beta-r2/work/rezound-0.12.3beta/src/backend/../../src/PoolFile/TStaticPoolAccesser.cpp:79: undefined reference to `void TPoolFile<unsigned long, unsigned long>::removeAccesser<short>(TStaticPoolAccesser<short, TPoolFile<unsigned long, unsigned long> > const*)'
collect2: ld returned 1 exit status
make[2]: *** [rezound] Error 1


This is with gcc-4.6.3 on a octacore machine (MAKEOPTS="-j8").
If you can provide a working patch I'd be happy to commit it so we can finally close this bug.
Comment 17 Martin von Gagern 2012-05-22 20:12:07 UTC
Created attachment 312751 [details, diff]
Let gcc handle template instantiation

OK, here is an alternative patch. Instead of adding yet more explicit template instantiations, and hoping that those will be sufficient this time, this patch here goes for implicit template instantiation. It makes the template source code available wherever it might be required. This should be more robust across various gcc versions and settings. It will cause slight increases in build time resource demand, as templates will be instantiated several times, but the linker should remove duplicates so the final result should be the same.

Please EVERYONE subscribed to this bug, give this patch a try. As my previous patch doesn't work for everybody, it would be good to know that this patch here is not inferior to that one.
Comment 18 Lars Wendler (Polynomial-C) gentoo-dev 2012-05-22 21:32:31 UTC
Thank you for your quick reply Martin. That new patch works for me. I hope we get some more feedback soon so I can commit this patch ASAP.
Comment 19 Petr Novak 2012-05-22 22:42:50 UTC
I've just tried to emerge the package again using portage ebuild and it no longer fails for me, so I'm afraid I can't help in this matter :/
Comment 20 Lars Wendler (Polynomial-C) gentoo-dev 2012-06-08 13:26:21 UTC
Finally fixed in the tree. Thanks for your contributions and your patience :)