Compiling libaam.so for 32-bit - EnergyXT2

A while back I bought a Behringer UC6102 USB sound card so I can play my guitar and use this dongle as an input, and use Jack and Rakarack as a guitar effects engine - works beautifully well. Incredible fun.

But, the Behringer also came with EnergyXT2, which - get this - they provide native Linux binaries for. Of course, I have to try this too. Turns out though that the version of libaam.so they provide is not compatible with Jack, as described at jack.cpp - energyXT2 and KVR: Which Linux Distribution with Energy XT?

There are many posts out there regarding this, and normally compiling your own is not a big deal. However, I’m trying to compile a 32-bit binary on my 64-bit OpenSuse 11.3 system. I have installed the various 32-bit compatibility libs I would think necessary, but it appears gcc is still trying to use /usr/lib64, etc - but I’m not sure why

I’m invoking gcc with the following:

$:~/energyXT/libaam-0.0.2> g++ -m32 -shared  -L/usr/lib -lasound -ljack jack.cpp -o libaam.so

The resulting error is:

/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: i386:x86-64 architecture of input file `/usr/lib64/gcc/x86_64-suse-linux/4.3/crtbeginS.o' is incompatible with i386 output
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: i386:x86-64 architecture of input file `/usr/lib64/gcc/x86_64-suse-linux/4.3/crtendS.o' is incompatible with i386 output
collect2: ld returned 1 exit status

Here are the 32-bit libs I have:

rpm -qa | egrep ‘glibc-devel|jack-devel|asound-devel’

linux-glibc-devel-2.6.32-3.3.noarch
libjack-devel-1.9.5-2.8.i586
glibc-devel-32bit-2.11.2-3.3.1.x86_64



If anyone could provide some input I would appreciate it, as I'd really like to check this application out. I'm very happy to see they provide a native Linux version - if you would like you can download a trial copy from the [EnergyXT site](http://www.energy-xt.com).

Cheers,
Lews Therin

Hi
Looking now (Their website if funky) got the source off the wiki.

Hi
Is this the same?
libaam-jack | Download libaam-jack software for free at SourceForge.net

Hi
So I have built libaam.so and xt2-config as an i586 rpm for 11.3, is that what your after?

Hi
OK, so here is an rpm for i586 and a src rpm;
http://www.muppetwifi.homeunix.net/openSUSE/jack-libaam-0.0.1-1.i586.rpm
http://www.muppetwifi.homeunix.net/openSUSE/jack-libaam-0.0.1-1.src.rpm

I compiled with;


g++ -m32 -shared -Wall -fPIC -lasound -ljack jack.cpp -o libaam.so

Hi Malcom,

Fantastic - thank you very much. I will try compiling this again today and let you know how it goes. Thank you as well for the RPMs.

I appreciate your really going to this extent to compile yourself - I look forward to getting this working now.

Cheers,
Lews Therin

Hi Malcom,

Unfortunately, when I tried the library you compiled, I get:

./energyXT: symbol lookup error: /home/lews/energyXT/energyXT/libaam.so: undefined symbol: snd_seq_open

So I went back to trying to compile again - but using the source from the Sourceforge projectthat you found rather than from the EnergyXT2 website.

I was able to get it to compile, and I’ll note here what I did in case others wish to build this as well:

  1. My previous error:
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: 
i386:x86-64 architecture of input file `/usr/lib64/gcc/x86_64-suse-linux/4.3/crtbeginS.o' is incompatible with i386 output

Was simply due to missing the proper gcc and g++ 32 bit packages - oops. (While I had the necessary 32-bit libs for qt and Jack, I in advertantly had not installed the gcc and g++ libs, so it indeed was missing the 32-bit version of crtbeginS.o

  1. This then allowed libaam.so to build, but building the xt2-config failed with: giving missing qmake-qt4, though it was installed. That was corrected with a symlink:
ln -s /usr/lib/qt4/bin/qmake /usr/bin/qmake-qt4
  1. The next problem building xt2-config was with it expecting a 32-bit build environment - Note that -m32 is specified in the Makefile for libaam, but NOT in the config/Makefile for xt2-config, thus:
g++ -c -m32 -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I. -I. -o moc_configw.o moc_configw.cpp
g++  -o xt2-config main.o configw.o moc_configw.o    -L/usr/lib -lQtGui -L/usr/lib -L/usr/X11R6/lib -lQtCore -lpthread 
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: skipping incompatible /usr/lib/libQtGui.so when searching for -lQtGui
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: skipping incompatible /usr/lib/libQtGui.so when searching for -lQtGui
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: skipping incompatible /usr/lib/libQtGui.so when searching for -lQtGui
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: cannot find -lQtGui

Now, I can see that g++ is not being called with -m32 when it links the three compiled files main.o configw.o moc_configw.o To get this to build correctly I modified the Makefile in config/Makefile (which is called from the Makefile in the build root), and added:

#CFLAGS        = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
CFLAGS        =  -m32 -march=i386 -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
#CXXFLAGS      = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS      =  -m32 -march=i386 -pipe -g -Wall -W -D_REENTRANT $(DEFINES)

And . . .

####### Build rules

all: Makefile $(TARGET)

$(TARGET): ui_config.h $(OBJECTS)
        $(LINK) $(LFLAGS) $(CXXFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)

The result is a working libaam.so you can copy to your energyXT folder (backup and replace the existing) which supports Jack, and a working xt2-config (move it from config/ to /usr/bin)

Of course on a 32-bit OS EnergXT2 should just run out of the box, but you still would not have Jack support, and as more users move to 64-bit and RT kernels for audio applications, this may come in handy.

Cheers,
Lews Therin