Bug 34 - Resampler.h : Compile problem with gcc 4.1.0
Summary: Resampler.h : Compile problem with gcc 4.1.0
Alias: None
Product: LinuxSampler
Classification: Unclassified
Component: other (show other bugs)
Version: 0.3.3
Hardware: PC Linux
: P2 major
Assignee: Christian Schoenebeck
Depends on:
Reported: 2006-04-22 00:54 CEST by Marc-Olivier Barre
Modified: 2007-05-13 00:44 CEST (History)
1 user (show)

See Also:

Possible fix to compile with gcc-4 (1.17 KB, patch)
2006-10-22 15:28 CEST, Christian Schoenebeck

Note You need to log in before you can comment on or make changes to this bug.
Description Marc-Olivier Barre 2006-04-22 00:54:37 CEST
"../common/Resampler.h:142: error: memory input 2 is not directly addressable"

This bug was previously reported when using gcc prior to 3.3 (as indicated in
the FAQ).

FAQ needs to be corrected to state this fact and eventualy, a patch could help
since people using gcc 4.1 will need to disable assembly code to get things
going (it's a shame on a system that's meant to be real time ;-) )
Comment 1 Christian Schoenebeck 2006-04-22 01:19:19 CEST
Could you please give additional information about your system, like 
distribution, gcc -v, etc.
Comment 2 Marc-Olivier Barre 2006-04-22 11:25:21 CEST
Output of "gcc -v" :

Target: i686-pc-linux-gnu
Configured with: ../gcc-4.1.0/configure --prefix=/usr --libexecdir=/usr/lib
--enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-clocale=gnu --enable-languages=c,c++
Thread model: posix
gcc version 4.1.0
system is an LFS with the folowing key packages :
Linux with ingo molnar's RT patch
binutils : 2.16.1
glibc : 2.4
jack : 0.100.0
libgig : 2.0.2
liblscp : 0.3.2
qsampler : 0.1.2
Hardware is an Asus A7v laptop (Pentium M 1.7 GHz, RAM : 2x512Gb, chipset is
i915GM) with a Hammerfall multiface.
I had time last evening to test my setup with linuxsampler by disabling assembly
code. I used a midi keyboard as input, a huge Grand Piano Gig, and my HDSP as
output. Seems to be stable, but CPU consuming when using to much of the sustain
Comment 3 David Paleino 2006-05-20 15:59:08 CEST
I've tried compiling it with gcc 4.0.4. Same problem.
Then I tried installing gcc 4.1.1 (which is 4.1.0-4 in Debian repositories), but
the problem is still there. Any solution?

Comment 4 James Stone 2006-05-25 14:00:31 CEST
Same problem on my system. 

g++ -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-awt=gtk-default --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0- --enable-mpfr
--disable-werror --with-tune=i686 --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.0.4 20060507 (prerelease) (Debian 4.0.3-3)
Comment 5 Christian Schoenebeck 2006-06-19 18:38:38 CEST
I'm sorry to say, but chances are low that we'll investigate this problem any 
further. Either use an older version of GCC (i.e. 3.3 or 3.4) to compile the 
old 0.3.3 tarball release of LinuxSampler or try using the latest CVS version 
of LinuxSampler.

Read this thread for details:
Comment 6 Christian Schoenebeck 2006-10-22 15:28:19 CEST
Created attachment 15 [details]
Possible fix to compile with gcc-4

I just accidently stumbled on this patch from the Gentoo BTS. Please try if it
works for you (both on compile time as well as on runtime).
Comment 7 Michał Gawron 2007-01-30 16:21:06 CET

C++ does NOT allow getting pointers to consts, and there are two places in
Resampler.h where it is tried to be done. Look at:
  const float __4f = 4.0f;
Few lines below a pointer to __4f is requested (in asm).
Just remove `const' from variable declaration and it will work.
This repeats in:
  void GetNext4SamplesMonoMMXSSE(sample_t* pSrc, void* Pos, float& Pitch)
  void GetNext4SamplesStereoMMXSSE(sample_t* pSrc, void* Pos, float& Pitch)
Comment 8 Jordan B 2007-03-30 19:32:02 CEST
(In reply to comment #6)
> Created an attachment (id=15) [edit]
> Possible fix to compile with gcc-4
> I just accidently stumbled on this patch from the Gentoo BTS. Please try if it
> works for you (both on compile time as well as on runtime).

Compiling with gcc 4.1, 4.0, and 3.4 all failed, so I tried this attachment and
it worked! Basically you change the __4f s to &__4f. Thanks!
Comment 9 Christian Schoenebeck 2007-05-12 22:44:15 CEST
Closing this report as WONTFIX now, since we don't maintain the old 0.3.x 
branch of LinuxSampler anymore. In case this bug affects you, please update to 
the 0.4.x branch of LinuxSampler.