Menu

#49 error building soource

v1.0_(example)
closed
nobody
1
2020-11-30
2020-08-05
No

Hi to all

i just upgraded my linuxbox to ubuntu server amd64 20.04, remake harbour, remake hwgui last commit

this is the output

enerating C source output to '/tmp/hbmk_3unp7r.dir/serv0020.c'... Done.
/usr/bin/ld: /home/nikko/hb32/hwgui/lib/libhwgui.a(draw.o): undefined reference to symbol 'sqrt@@GLIBC_2.2.5'
/usr/bin/ld: /lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

what is my mistake ?

regards

Discussion

  • Wilfried Brunken

    Hello Domenico,
    this is a well known problem, but easy to solve.
    Because i am very busy with my work on Ticket #48,
    i give you at first the following hints:

    Please refer the following tickets:

    46 Hwgui Linux GCC 9.3 64Bit "sqrt@@GLIBC_2.2.5"

    closed ticket #4:

    4 Compiler Error "reference to symbol 'fmod@@GLIBC_2.2.5'" on Ubuntu-Linux building

    Please check your build script:
    Try to move all $SYSTEM_LIBS at the end of the link command.
    (Look into build script for tutorial for example).
    Please try first to build an example ot the tutor.

    If you have no success, send me a response.
    Then i will build the complete system new for more
    investigations.

    If you have success, send a rsponse to Alexander Kresin, that he can close the ticket.

    With regards,
    MNI TNX, 73 es 55 de

    Wilfried, DF7BE

     
  • Itamar M. Lins Jr.

    Hi!
    See this file hbmk.hbm into directory

    #
    # hbmk.hbm
    #
    # $Id: hbmk.hbm 2862 2020-07-05 06:13:41Z df7be $
    #
    # Default values for hbmk2
    #
    # Not necessary many, several files *.hbp
    # hbmk2 get it and set defatult config for all files into folder
    # say only:
    #   hbmk2 a.prg
    # and HWGUI sample program a.prg will be build.
    #
    
    -n -w
    -lm    
    -static 
    # -strip
    -d__LINUX__ -d__GTK__
    
    ../../hwgui.hbc
    
    # ================ EOF of hbmk.hbm ===============
    

    Best regards,
    Itamar M. Lins Jr.

     
  • Wilfried Brunken

    Hello Itamar,
    can you try following and send me the output ? :
    1.) Build sample a.prg in samples/gtk_samples by calling "./build.sh a.prg".
    (set execute permission before by "chmod 755 build.sh", if not set)
    2.). Remove "-lm" from hbmk.hbm and try:
    hbmk2 -trace a.prg

    With regards,
    MNI TNX, 73 es 55 de

    Wilfried, DF7BE

     
  • Itamar M. Lins Jr.

    Hi!
    build.sh

    itamar@itamar-desktop:~/hwgui-code/hwgui/samples/gtk_samples$ ./build.sh a.prg 
    ./build.sh: linha 42: /home/itamar/Harbour/core-master/bin/linux/gcc/harbour: file or directory not found
    gcc: error: a.c: file not found
    

    hbmk2

    itamar@itamar-desktop:~/hwgui-code/hwgui/samples/gtk_samples$ hbmk2 a.prg -trace
    hbmk2: Processando script local: hbmk.hbm
    hbmk2: Harbour compiler command (built-in):
    (/usr/local/bin/harbour) -n2 a.prg -n -w -d__LINUX__ -d__GTK__ -DHBMK_HAS_HWGUI=1 -o/tmp/hbmk_y245gn.dir/ -i/usr/local/include/harbour -i../../include
    Harbour 3.2.0dev (r2006301601)
    Copyright (c) 1999-2020, https://harbour.github.io/
    Compiling 'a.prg'...
    Lines 3761, Functions/Procedures 7
    Generating C source output to '/tmp/hbmk_y245gn.dir/a.c'... Done.
    hbmk2: Comando do compilador C/C++:
    gcc -c -O3  -W -Wall -pipe -I/usr/local/include/harbour -I'../../home/itamar/hwgui-code/hwgui/include' '/tmp/hbmk_y245gn.dir/a.c' '/tmp/hbmk_2cwazg.c'
    hbmk2: Comando do Linkeditor:
    gcc '/tmp/hbmk_y245gn.dir/a.o' '/tmp/hbmk_y245gn.dir/hbmk_2cwazg.o'   -Wl,--start-group -lhwgui -lprocmisc -lhbxml -lhwgdebug -lhbextern -lhbdebug -lhbvm -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgttrm -lhbrdd -lhbuddall -lhbusrrdd -lrddntx -lrddcdx -lrddnsx -lrddfpt -lhbrdd -lhbhsx -lhbsix -lhbmacro -lhbcplr -lhbpp -lhbcommon -lm -ldl -lrt -lpcre -lz   -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype  -Wl,--end-group -oa -L/usr/local/lib64/harbour -L../../lib
    itamar@itamar-desktop:~/hwgui-code/hwgui/samples/gtk_samples$ 
    

    Best regards,
    Itamar M. Lins Jr.

     
  • Wilfried Brunken

    Hello Itamar,
    Ohh, in build.sh you forgot to configure the path to Harbour:

    Modify path to Harbour to your own needs

    export HB_ROOT=$HOME/Harbour/core-master

    export HB_ROOT=../../..

    Modify an please try again.

    The entry for libm (-lm) was delivered by the hbmk2 tool
    (seen in the trace output).
    So i removed it with the recent commit (r2866).
    But it not set at the last position for
    fixing the link error.

    I cannot retrace the build error on my systems
    (Ubuntu 16 and LINUXMint).
    First I suggest to update your system.

    If the sample can be build with build.sh and runs
    successfully and not with the hbmk2,
    i think that is not an error of HWGUI but in Harbour.
    Please register at Github.io and create a new ticket.
    Could you retrace the error with a simple sample
    terminal app program ?

    Otherwise build your app with your own script,
    using build.sh as a template.

    I hope, this help.

    With regards,
    MNI TNX, 73 es 55 de
    DF7BE, Wilfried

     
  • Itamar M. Lins Jr.

    Hi!
    >you forgot to configure the path to Harbour:
    Harbour it is configurated, with default build.
    hbmk2 is tool of harbour.
    >First I suggest to update your system.
    Here I use, Linux 20.04 Ubuntu(Kubuntu), is more new distro Ubuntu!
    You Ubuntu is 16(mint) very old! 17,18,19,20...20.04

    Best regards,
    Itamar M. Lins Jr.

     

    Last edit: Itamar M. Lins Jr. 2020-08-13
  • domenico d'oria

    domenico d'oria - 2020-08-19

    Hi to all

    this is my hbp

    Initial of l8scout.hbp

    -i../include
    -i/usr/include
    l8scout.prg
    l8sinifi.prg
    l8s00010.prg
    sett0000.prg
    sett0001.prg
    sett0002.prg
    sett0003.prg
    serv0020.prg
    /usr/local/share/harbour/contrib/hbct/hbct.hbc
    /usr/local/share/harbour/contrib/xhb/xhb.hbc
    /home/nikko/harbour/hwgui/hwgui.hbc
    -n -w

    and this is the output
    Generating C source output to '/tmp/hbmk_wlebh1.dir/serv0020.c'... Done.
    /usr/bin/ld: /home/nikko/harbour/hwgui/lib/libhwgui.a(draw.o): undefined reference to symbol 'sqrt@@GLIBC_2.2.5'
    /usr/bin/ld: /lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
    collect2: error: ld returned 1 exit status
    hbmk2[l8scout]: Error: Running linker. 1
    gcc '/tmp/hbmk_wlebh1.dir/l8scout.o' '/tmp/hbmk_wlebh1.dir/l8sinifi.o' '/tmp/hbmk_wlebh1.dir/l8s00010.o' '/tmp/hbmk_wlebh1.dir/sett0000.o' '/tmp/hbmk_wlebh1.dir/sett0001.o' '/tmp/hbmk_wlebh1.dir/sett0002.o' '/tmp/hbmk_wlebh1.dir/sett0003.o' '/tmp/hbmk_wlebh1.dir/serv0020.o' '/tmp/hbmk_wlebh1.dir/hbmk_jedty1.o' -Wl,--start-group -lhbct -lxhb -lhbtip -lhbfship -lhbxpp -lhwgui -lprocmisc -lhbxml -lhwgdebug -lhbcplr -lhbdebug -lharbour -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype -Wl,--end-group -ol8scout -L/usr/local/lib/harbour -L/home/nikko/harbour/hwgui/lib

    the question is :

    where i have to change the hbp to make the things working ?

    regards

    Domenico

     
  • Itamar M. Lins Jr.

    Hi!
    Just add this flag, if or case it not present. "-lm"
    See in line of linker absence of flag "-lm"

    https://stackoverflow.com/questions/16006145/ld-undefined-reference-to-symbol-log2glibc-2-2-5

    If your code includes mathematical functions (like exp, cos, etc.), you need to link to the mathematics library libm.so. This is done, just like for serial compiling, by adding -lm to the end of your compile command, that is,

    mpicc -o sample sample.c -lm

    Troubleshoot - Undefined Reference to Symbol sqrt
    https://abdillah.me/doc/code/troubleshoot-undefined-ref-to-sqrt

    Best regards,
    Itamar M. Lins Jr.

     

    Last edit: Itamar M. Lins Jr. 2020-08-19
  • domenico d'oria

    domenico d'oria - 2020-08-19

    Many thank's Itamar M-Lins Jr. , now compilation is working
    for administrator : the ticket can be closed.
    regards

     
  • Maurizio la Cecilia

    • status: open --> closed
     

Log in to post a comment.