undefined references .... or underlinking

Help
Philippe D
2012-12-18
2013-05-23
  • Philippe D
    Philippe D
    2012-12-18

    Hi Nick Copeland !

    For several years I haved used Bristol,  and enjoyed to see your program getting better and better….

    I used to use Mandriva distribution, for wich we created a rpm…
    now I am using Mageia (a Mandriva fork) for which we created a rpm with your last 0.60.10 version…

    Compiling with   ./configure  and make   seems OK : we can create the binaries and libraries, everything works, but in the end of the build log we discover these warnings :

    Warning: unused libraries in /usr/lib/libbristolic.so.0.0.610: libpthread.so.0

    Warning: unused libraries in /usr/lib/libB11.so.0.0.610: libpthread.so.0

    Warning: unused libraries in /usr/lib/libbvg.so.0.0.610: libpthread.so.0

    Warning: unused libraries in /usr/lib/libC11.so.0.0.610: libpthread.so.0

    Warning: unused libraries in /usr/bin/bristol: libjack.so.0
    libasound.so.2

    Warning: unused libraries in /usr/bin/brighton: libX11.so.6
    libbvg.so.0
    libasound.so.2
    libm.so.6

    Warning: unused libraries in /usr/bin/bristoljackstats: libm.so.6

    that reveal some overlinking (not so bad)

    And :

    Warning: undefined symbols in /usr/lib/libbristolic.so.0.0.610: tanhf powf expf bristolfree bristolmalloc
    Warning: undefined symbols in /usr/lib/libbrighton.so.0.0.610: brightonControlKeyInput brightonShiftKeyInput bvgRenderInt brightonKeyInput brightonRegisterController cleanout brightonControlShiftKeyInput clearout
    Warning: undefined symbols in /usr/lib/libbristol.so.0.0.610: audioOpen setAudioStart2 audioClose audioRead audioWrite
    Warning: undefined symbols in /usr/lib/libbristolaudio.so.0.0.610: dupfd bristolmalloc jackMidiRoutine doAudioOps initAudioThread bristolJackSetMidiHandle bristolfree
    Warning: undefined symbols in /usr/lib/libbvg.so.0.0.610: imageMap lroundf roundf brightonGetGC

    That reveal underlinking (not too good generally)

    Trying to prevent from overlinking or underlinking libraries Mageia team choosed to compile now each package with configure2_5x and two default options :
    -as-needed and  -no-undefined

    That leads immediately to stop compilation of libbristolaudio :
    libbristolaudio/audioEngineALSA.c:136: undefined reference to `bristolfree'
    libbristolaudio/audioEngineALSA.c:400: undefined reference to `bristolmalloc'
    libbristolaudio/audioEngineJack.c:272: undefined reference to `doAudioOps'
    libbristolaudio/audioEngineJack.c:278: undefined reference to `dupfd'
    etc…
    then the whole make process is aborted…

    We must use the option : disable_ld_no_undefined 1
    and then it builds like when using simply  ./configure … and we get the same warnings in the buildlog showing underlinking for the libraries.

    That seems logical because libbristolaudio is built before libbristol which has the needed sources :   bristolcdefs.c   audioRoutines.c mixroutines.c  opmgt.c ! (adding these inside the list of libbristolaudio_la_SOURCES solved this)

    Nevertheless some underlinking problems can't be resolved :
    the problems is caused by references from the libraries to the program - that is only allowed with modules (.so files loaded explicitly by the program)

    One of the developpers looked at the source code and discovered that indeed
    the only needed shared library is libbristolmidi.so.0.0.610 (used by both bristol and brighton),  

    and that we may consider that libbrighton is a module for only brighton
    and that libbristolaudio, libbvg, libbristol,  libbristolic etc… are modules for only bristol

    He created a patch modifying the makefile.am in each directory, and the configure.ac file of  the root…

    The build process is OK and we get binaries : bristol, brighton, bristoljackstats and the script startBristol
    and only one shared libray : libbristolmidi.so.0.0.610

    Of course there is no more any underlinking warning…

    and only one overlinking warning :
    Warning: unused libraries in /usr/bin/bristoljackstats: libm.so.6

    The result is OK : we can use several synths side by side …

    building bristol this way can make it faster in theory because many shared lib references are gone

    the patch is a huge file… perhaps too big to be read in the forum.

    Are you interested to have it sent as an attached file to you e.mail address ?
    Or do you want it to be pasted in a post on this topic ? so that every bristol dev may have a look on it ?
    NB it's quite a draft to be improved… but it works yet as it is !

    Hope you'll find some interest in this proposal

    Regards
    And thanks for your huge work !
    Philippe

     
  • Nick Copeland
    Nick Copeland
    2012-12-18

    Hi Philippe,

    Wow, that sounds like quite an effort. I am very interested in getting hold of the changes you have made since I do recognise some rather ugly calls between the libraries that could cause such issues. I can clean up the last issue in jackstats since I don't actually need to use it anymore.

    If you can mail me the diffs I can apply them or if that is so much then send through a 'make dist'  and I will package it into something like 0.70. The changes sound a bit big for 0.60.11!

    Please let me also thank you and your team for some huge work.

    Kind regards, nick.

     
  • Philippe D
    Philippe D
    2012-12-18

    Hi Nick !
    I'm gonna send you the diff as an attached file

     
  • Philippe D
    Philippe D
    2012-12-26

    Hi Nick !
    I hope you received the diff file that I sent to your e.mail address (suppoing it is the same as the one I found in Bristol sources)
    If you didn't tell me : I can paste it here… or send it to another address !

    Regards
    Philippe

     
  • Philippe D
    Philippe D
    2013-02-01

    Hi Nick!
    Just downloaded the last source file…
    Thanks for having merged the patches…  (we don't need to add them now)
    It 's OK for building on Mageia…
    I just hope it doesn't break anything on other distributions

    Regards
    Philippe