libxmp / xmp-cli

Command-line mod player using libxmp
GNU General Public License v2.0
75 stars 22 forks source link

Alternative path for libxmp #9

Closed ivanbistrovic closed 8 years ago

ivanbistrovic commented 8 years ago

I am trying to build xmp-cli without installing libxmp but it seems that I can't find a way how to instruct configure script to look for libxmp.so in another directory. I am stuck at checking for libxmp... no You need libxmp version 4.4 or later to build this package

I would really appreciate your help.

cmatsuoka commented 8 years ago

This should work: libxmp_CFLAGS=-I/my/path/include libxmp_LIBS="-L/my/path/lib -lxmp" ./configure

ivanbistrovic commented 8 years ago

This worked but... now the problem is that there is no Makefile generated. These are the last two lines of my .configure output: checking for libxmp... yes checking for xmp_version in -lxmp... no

Sorry if this is a trivial problem, I am not a linux expert.

cmatsuoka commented 8 years ago

Indeed, it doesn't work! But this one worked for me:

LDFLAGS=-L/path/to/lib CFLAGS=-I/path/to/include ./configure

(tested in MacOS X with: LDFLAGS=-L/Users/claudio/xmp/libxmp/lib CFLAGS=-I/Users/claudio/xmp/libxmp/include ./configure). You need absolute pathnames, it won't work if you put a relative path such as ../libxmp/lib because it enters src/ before building. Check if that one works for you.

ivanbistrovic commented 8 years ago

Unfortunately it does not work for me, I used absolute paths. It gets me back to the problem from the first post.

This is the line which returns the problem from my second post. libxmp_LIBS=-L/home/user/libxmp/lib libxmp_CFLAGS=-I/home/user/libxmp/include ./configure

My system is Linux Mint 17.3 64bit.

cmatsuoka commented 8 years ago

Note that the variables are now LDFLAGS and CFLAGS instead of libxmp_LIBS and libxmp_CFLAGS. If that doesn't work, I'll probably have to fix configure.ac.

ivanbistrovic commented 8 years ago

Yes, I tried both solutions, and both of them does not work.

LDFLAGS=-L/home/user/libxmp/lib/ CFLAGS=-I/home/user/libxmp/include/ ./configure The line above returns me this: ... checking for libxmp... no You need libxmp version 4.4 or later to build this package

libxmp_LIBS=-L/home/user/libxmp/lib libxmp_CFLAGS=-I/home/user/libxmp/include ./configure And the line above returns this. ... checking for libxmp... yes checking for xmp_version in -lxmp... no

So I could conclude that the latter command is nearest to success.

Thank you for your patience.

cmatsuoka commented 8 years ago

Could you check if you're really building against libxmp 4.4? After pulling the latest version, you'll have to re-run the configure script there to update the Makefile. Also check if include/xmp.h has XMP_VERSION set to 4.4.0. (The latest xmp-cli needs the 4.4 to use the Amiga mixers, older versions won't work)

ivanbistrovic commented 8 years ago

Here is more detailed description of the process. I checked an xmp.h file and it says: #define XMP_VERSION "4.4.0"

When I pull the repository, first thing I do is run "autoconf". Then I get an error message:

configure.ac:2: error: possibly undefined macro: AM_SILENT_RULES
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:30: error: possibly undefined macro: AM_INIT_AUTOMAKE
configure.ac:82: error: possibly undefined macro: AM_CONDITIONAL

But .configure file shows up.

After that I run autoreconf -i and this is the message I receive:

configure.ac:15: installing 'build-aux/compile'
configure.ac:14: installing 'build-aux/config.guess'
configure.ac:14: installing 'build-aux/config.sub'
configure.ac:29: installing 'build-aux/install-sh'
configure.ac:30: installing 'build-aux/missing'
src/Makefile.am: installing 'build-aux/depcomp'

I guess it passes fine and then I run ./configure with alternative paths specified which gives me this:

checking whether make supports nested variables... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking how to create a pax tar archive... gnutar
checking dependency style of gcc... gcc3
checking dependency style of g++... gcc3
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for libxmp... yes
checking for xmp_version in -lxmp... no

This is where I am stuck because there is no Makefile.

cmatsuoka commented 8 years ago

Ok, I reproduced the problem in a Debian box. I'll check what's happening and report back.

cmatsuoka commented 8 years ago

Ok, try this:

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/user/libxmp LDFLAGS=-L/home/user/libxmp/lib CFLAGS=-I/home/user/libxmp/include ./configure

Don't forget to set LD_LIBRARY_PATH to /home/user/libxmp/lib before running the binary, to link against the library.

ivanbistrovic commented 8 years ago

That solution worked for me and I got the Makefile. Now I am having another problem with compiling. I set the LD_LIBRARY_PATH as you wrote, checked with env. After I run make I receive this error message:

Making all in src
make[1]: Entering directory /home/user/xmp-cli/src'
  CC       info.o
info.c: In function ‘info_frame’:
info.c:152:8: error: ‘XMP_MIXER_STANDARD’ undeclared (first use in this function)
   case XMP_MIXER_STANDARD:
        ^
info.c:152:8: note: each undeclared identifier is reported only once for each function it appears in
info.c:155:8: error: ‘XMP_MIXER_A500’ undeclared (first use in this function)
   case XMP_MIXER_A500:
        ^
info.c:158:8: error: ‘XMP_MIXER_A500F’ undeclared (first use in this function)
   case XMP_MIXER_A500F:
        ^
make[1]: *** [info.o] Error 1
make[1]: Leaving directory '/home/user/xmp-cli/src'
make: *** [all-recursive] Error 1
cmatsuoka commented 8 years ago

These are macros that exist only in version 4.4. For some reason you're trying to build against an older version. Check if you have CFLAGS = -I/home/user/libxmp/include -Wall ... in the Makefile. Also, run ./autogen.sh instead of running autoconf directly in xmp-cli since it also uses automake.

I tested the build in Debian with an older library version installed, and the player was correctly built against the library version specified when running the configure script. It seems that this problem is caused by something in your environment.

ivanbistrovic commented 8 years ago

I tried it now the way you wrote and the result is the same. The line in Makefile exists. Am I maybe missing some dependencies despite .configure passes fine?

cmatsuoka commented 8 years ago

Hmm, here's the full command sequence I used, on a Debian system with libxmp-dev 4.3.0, autoconf, and automake already installed:

$ git clone http://github.com/cmatsuoka/libxmp
$ git clone http://github.com/cmatsuoka/xmp-cli
$ cd libxmp
$ autoconf
$ ./configure
$ make
$ cd ../libxmp-cli
$ ./autogen.sh
$ PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/claudio/libxmp LDFLAGS=-L/home/claudio/libxmp/lib CFLAGS=-I/home/claudio/libxmp/include ./configure
$ make
$ LD_LIBRARY_PATH=/home/claudio/libxmp/lib src/xmp

The build output was:

claudio@n004994:~/xmp-cli$ make
Making all in src
make[1]: Entering directory '/home/claudio/xmp-cli/src'
  CC       commands.o
  CC       getopt.o
  CC       getopt1.o
  CC       info.o
  CC       main.o
  CC       options.o
  CC       read_config.o
  CC       sound.o
  CC       sound_file.o
  CC       sound_null.o
  CC       sound_wav.o
  CC       sound_aiff.o
  CC       terminal.o
  CC       sound_oss.o
  CC       sound_alsa.o
  CC       sound_pulseaudio.o
  CXXLD    xmp
make[1]: Leaving directory '/home/claudio/xmp-cli/src'
make[1]: Entering directory '/home/claudio/xmp-cli'
make[1]: Nothing to be done for 'all-am'.
make[1]: Leaving directory '/home/claudio/xmp-cli'

Flags in Makefile are configured as:

claudio@n004994:~/xmp-cli$ grep ^CFLAGS Makefile
CFLAGS = -I/home/claudio/libxmp/include -Wall -Wno-unused-result
claudio@n004994:~/xmp-cli$ grep ^LDFLAGS Makefile
LDFLAGS = -L/home/claudio/libxmp/lib
ivanbistrovic commented 8 years ago

I followed your command sequence and everything was good. Player works like a charm!

Thank you very much!

cmatsuoka commented 8 years ago

Good. You're welcome.