Author Topic: [SOLVED] Compiling wih minimal dependencies  (Read 674 times)

Offline jseb

  • Shy artist
  • Posts: 4
[SOLVED] Compiling wih minimal dependencies
« on: September 05, 2018, 09:55:15 »
Hello,

I want to compile libopenmpt on an unix system, with as little dependencies as possible.
I need only trackers support, so i guess mpeg123 and ogg/vorbis are useless.

So i've edited Makefile and did this:

Code: [Select]
  NO_ZLIB=1        Avoid using zlib, even if found
  NO_MPG123=1      Avoid using libmpg123, even if found
  NO_OGG=1         Avoid using libogg, even if found
  NO_VORBIS=1      Avoid using libvorbis, even if found
  NO_VORBISFILE=1  Avoid using libvorbisfile, even if found
  NO_STBVORBIS=1   Do not fallback to stb_vorbis
#  USE_MINIMP3=1    Use minimp3.

  NO_PORTAUDIO=1      Avoid using PortAudio, even if found
  NO_PORTAUDIOCPP=1   Avoid using PortAudio C++, even if found

  NO_PULSEAUDIO=1     Avoid using PulseAudio, even if found
#  NO_SDL=1            Avoid using SDL, even if found
#  NO_SDL2=1           Avoid using SDL2, even if found
  NO_FLAC=1           Avoid using FLAC, even if found

I've even removed portaudio support and pulseaudio (i guess i could leave portaudio, though).

After compilation (i had made a make clean before), i still have all dependancies in the lib:

Code: [Select]
libopenmpt-0.3.11+release/bin$ ldd libopenmpt.so.1
        linux-vdso.so.1 (0x00007ffd97b0a000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007f38e06df000)
        libmpg123.so.0 => /usr/lib/libmpg123.so.0 (0x00007f38e0480000)
        libogg.so.0 => /usr/lib/libogg.so.0 (0x00007f38e0279000)
        libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0x00007f38e004d000)
        libvorbisfile.so.3 => /usr/lib/libvorbisfile.so.3 (0x00007f38dfe44000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f38dfcb5000)
        libm.so.6 => /usr/lib/libm.so.6 (0x00007f38dfb2e000)
        libmvec.so.1 => /usr/lib/libmvec.so.1 (0x00007f38dfb01000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f38dfae7000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007f38df923000)
        libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f38df91e000)
        /usr/lib64/ld-linux-x86-64.so.2 (0x00007f38e0b4c000)

Is it because i have left something which need those deps ?

Thank you.
« Last Edit: September 06, 2018, 15:27:15 by jseb »

Offline manx

  • OpenMPT Developers
  • *****
  • Posts: 196
Re: Compiling wih minimal dependencies
« Reply #1 on: September 05, 2018, 10:22:37 »
You have set the NO_ZLIB variable to "1        Avoid using zlib, even if found", literally. However, the Makefile expects it to be set to "1" in order to achieve what you want.

The comments at the top of Makefile are designed to be documentation only, and the listed options are designed to be used as make arguments instead of being usable by just uncommenting them (as you did). This probably needs to be documented better on our side, though.

For the time being, please just use the options on the make invocation itself, like:
Code: [Select]
make clean NO_ZLIB=1 NO_MPG123=1 NO_OGG=1 NO_VORBIS=1 NO_VORBISFILE=1 NO_STBVORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_FLAC=1
make       NO_ZLIB=1 NO_MPG123=1 NO_OGG=1 NO_VORBIS=1 NO_VORBISFILE=1 NO_STBVORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_FLAC=1
You can also use them by editing the Makefile, however be sure to set the variables to "1" exactly (in particular removing any other characters after that).

Maybe you also want "NO_SNDFILE=1"? Libsndfile is only used by openmpt123 for writing output files.

I'll look into improving documentation and probably even returning errors in the Makefile if the options are not set to literally "1" or "0".


Result for me with "make NO_ZLIB=1 NO_MPG123=1 NO_OGG=1 NO_VORBIS=1 NO_VORBISFILE=1 NO_STBVORBIS=1 NO_PORTAUDIO=1 NO_PORTAUDIOCPP=1 NO_PULSEAUDIO=1 NO_FLAC=1 NO_SNDFILE=1":
Code: [Select]
$ ldd bin/libopenmpt.so.1
linux-vdso.so.1 (0x00007fff527d8000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9bd9e37000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9bd9a99000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9bd9881000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9bd9490000)
/lib64/ld-linux-x86-64.so.2 (0x00007f9bda5e7000)


Just curious, is there any particular reason you are using the Makefile instead of the Autotools build system?

Offline jseb

  • Shy artist
  • Posts: 4
Re: Compiling wih minimal dependencies
« Reply #2 on: September 05, 2018, 10:41:12 »
Thank you for your reply. I had found my mistake but you have been faster than me !

Even after thinking «hey, i've forgotten to comment after the flag», and put a hash before the comment, it was not working. Because make doesn't strip spaces.

Adding this after declarations made thing clear for me:

Code: [Select]
ifeq ($(NO_VORBIS),1)
$(warningr ok NO_VORBIS  $(NO_VORBIS))
else
$(error ko NO_VORBIS $(NO_VORBIS))
endif

was giving:
Code: [Select]
Makefile:216: *** ko NO_VORBIS 1   .  Stop.


I've used the sources left by the Arch Linux packet generator, which use makefile source package.

Thank you :)

Offline Saga Musix

  • OpenMPT Developers
  • *****
  • Posts: 6,461
  • aka Jojo
    • Download music, samples, VST plugins: Saga Musix Website
  • Operating System: Windows 7 x64
Re: Compiling wih minimal dependencies
« Reply #3 on: September 05, 2018, 11:40:32 »
Please note that vorbis support is not "useless" for a libopenmpt build; Both MP3 and Vorbis decoders are required to be able to play all variants of MO3 files. To avoid external dependencies, libopenmpt supports stb_vorbis (which you disable) and minimp3 (which you do not enable).
» No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.