Page 1 of 1

tcl.h in Ubuntu 2022

Posted: 25 Jan 2023, 16:01
by blanco-garcia
Dear all,

I am compiling elegant in Ubuntu 2022, and there is an error due to tcl.h

Code: Select all

/usr/bin/gcc  -D_GNU_SOURCE -D_DEFAULT_SOURCE          -D_X86_64_ -DUNIX  -Dlinux      -O3 -g   -Wall -Werror-implicit-function-declaration    -DUSE_TCL_STUBS  -mtune=generic     -m64  -fPIC -I. -I../O.Common -I. -I. -I.. -I../../../../../include/compiler/gcc -I../../../../../include/os/Linux -I../../../../../include    -I../../../../../../../epics/base/include/compiler/gcc -I../../../../../../../epics/base/include/os/Linux -I../../../../../../../epics/base/include   -I../../../../../../../epics/extensions/include        -c ../tclCa.c
In file included from ../tclCa.c:173:
../tclCa.h:105:10: fatal error: tcl.h: No such file or directory
  105 | #include <tcl.h>
      |          ^~~~~~~
However, the file tcl.h is present in the system and installed in /usr/include/tcl/

Code: Select all

ls /usr/include/tcl
tclDecls.h  tcl.h  tclOODecls.h  tclOO.h  tclPlatDecls.h  tcl-private  tclTomMathDecls.h  tclTomMath.h  tkDecls.h  tk.h  tkPlatDecls.h  tk-private
Is there a way to let the tcl.h location be seen by the system ?

Best regards,
o

Re: tcl.h in Ubuntu 2022

Posted: 26 Jan 2023, 05:02
by blanco-garcia
I found out a solution,

might be not the best one but I'll share it in case it is of any use

Add to epics/base/configure/CONFIG, the following lines:

Code: Select all

OPT_CFLAGS_YES += -I/usr/include/tcl
OPT_CXXFLAGS_YES += -I/usr/include/tcl
This topic could be closed. Best regards,

o

Re: tcl.h in Ubuntu 2022

Posted: 26 Jan 2023, 10:16
by soliday
The file oag/apps/configure/os/CONFIG_SITE.linux-x86_64.linux-x86_64 has a field that you can edit for this.

The default is:
TK_TCL = /usr/lib64
TK_LIB = /usr/lib64
TK_INC = /usr/include
TCL_LIB = /usr/lib64
TCL_INC = /usr/include

You could change TCL_INC to /usr/include/tcl

Re: tcl.h in Ubuntu 2022

Posted: 26 Jan 2023, 10:18
by blanco-garcia
Dear Soliday, great ! Thank you.

Re: tcl.h in Ubuntu 2022

Posted: 09 Feb 2023, 11:00
by blanco-garcia
Dear Soliday,

I changed the TCL_INC to /usr/include/tcl as you said and compilation finished w/o errors.
However, Pelegant and sddsedit do not work. I get the following error when launching Pelegant :

Code: Select all

$ Pelegant 
Error:
passed size is not equal to expected size for SDDS_DATASET structure
Passed size is 2680, library size is 2672
Have you had this error message before ?
Is there any suggestion ?

I tried to grep the error message through out the sources and it seems to come from libtclSDDS

Code: Select all

$ grep "passed size is not equal to expected size for SDDS_DATASET structure" oag/*/*/*/*/*/*/*
...
grep: oag/apps/src/tcltkinterp/extensions/sdds/O.linux-x86_64/libtclSDDS.so: binary file matches
Best regards,
o

Re: tcl.h in Ubuntu 2022

Posted: 09 Feb 2023, 11:09
by blanco-garcia
Dear Soliday,

I have found the error message implemented in epics/extensions/src/SDDS/SDDSlib/SDDS_utils.c :

Code: Select all

epics/extensions/src/SDDS/SDDSlib/SDDS_utils.c:3135:    SDDS_SetError("passed size is not equal to expected size for SDDS_DATASET structure");

Re: tcl.h in Ubuntu 2022

Posted: 09 Feb 2023, 11:38
by soliday
It sounds like your SDDS libraries and Pelegant were built with different versions of SDDS.h. Try rebuilding everything.

Re: tcl.h in Ubuntu 2022

Posted: 02 Mar 2023, 11:40
by blanco-garcia
Dear Soliday,

you were right, there was a problem while building. After several trials I found out that the compilation sequence was different to the one suggested with the flag MPI=1 , and the order was important. Now elegant and Pelegant work.

I, however, have now another issue with tcl. I get the following error message wrt tclStubsPtr

Code: Select all

$ tclsh
% package require sdds
couldn't load file "~/elegant_compilation/build/oag/apps/lib/linux-x86_64/sdds/libtclSDDS.so": ~/elegant_compilation/build/oag/apps/lib/linux-x86_64/sdds/libtclSDDS.so: undefined symbol: tclStubsPtr
package require sdds is used by sddsedit, therefore, I can not yet open an sdds file with it.
Do you have any suggestion in this case ?
Is this related to the changes in TLC_INC ?
Or I might be missing a library or flag ?

Best regards,
o

Re: tcl.h in Ubuntu 2022

Posted: 02 Mar 2023, 13:28
by soliday
I believe the proper values on Ubuntu 22.04 are:
TCL_INC=/usr/include/tcl
TCL_LIB=/usr/lib/x86_64-linux-gnu
MOTIF_LIB=/usr/lib/x86_64-linux-gnu
X11_LIB=/usr/lib/x86_64-linux-gnu

Make sure you have tcl-dev installed

Here is the logic the build script uses to set these values:

Code: Select all

        set tclInc "TCL_INC=/usr/include/tcl"
        
	if {[file exists /usr/lib64/libXm.so]} {
	    set motifLib "MOTIF_LIB=/usr/lib64"
	} elseif {[file exists /usr/lib/x86_64-linux-gnu/libXm.so]} {
	    set motifLib "MOTIF_LIB=/usr/lib/x86_64-linux-gnu"
	} elseif {[file exists /usr/lib/libXm.so]} {
	    set motifLib "MOTIF_LIB=/usr/lib"
	}
	
	if {[file exists /usr/lib64/libXt.so]} {
	    set x11Lib "X11_LIB=/usr/lib64"
	} elseif {[file exists /usr/lib/x86_64-linux-gnu/libXt.so]} {
	    set x11Lib "X11_LIB=/usr/lib/x86_64-linux-gnu"
	} elseif {[file exists /usr/lib/libXt.so]} {
	    set x11Lib "X11_LIB=/usr/lib"
	}
	
	if {[file exists /usr/lib64/libtclstub8.6.so]} {
	    set tclLib "TCL_LIB=/usr/lib64"
	} elseif {[file exists /usr/lib64/libtclstub8.6.a]} {
	    set tclLib "TCL_LIB=/usr/lib64"
	} elseif {[file exists /usr/lib64/libtclstub8.5.so]} {
	    set tclLib "TCL_LIB=/usr/lib64"
	} elseif {[file exists /usr/lib64/libtclstub8.5.a]} {
	    set tclLib "TCL_LIB=/usr/lib64"
	} elseif {[file exists /usr/lib64/libtclstub8.4.so]} {
	    set tclLib "TCL_LIB=/usr/lib64"
	} elseif {[file exists /usr/lib64/libtclstub8.4.a]} {
	    set tclLib "TCL_LIB=/usr/lib64"
	} elseif {[file exists /usr/lib64/libtclstub8.3.so]} {
	    set tclLib "TCL_LIB=/usr/lib64"
	} elseif {[file exists /usr/lib64/libtclstub8.3.a]} {
	    set tclLib "TCL_LIB=/usr/lib64"
        } elseif {[file exists /usr/lib/x86_64-linux-gnu/libtclstub8.6.so]} {
	    set tclLib "TCL_LIB=/usr/lib/x86_64-linux-gnu"
        } elseif {[file exists /usr/lib/x86_64-linux-gnu/libtclstub8.6.a]} {
	    set tclLib "TCL_LIB=/usr/lib/x86_64-linux-gnu"
        } elseif {[file exists /usr/lib/x86_64-linux-gnu/libtclstub8.5.so]} {
	    set tclLib "TCL_LIB=/usr/lib/x86_64-linux-gnu"
        } elseif {[file exists /usr/lib/x86_64-linux-gnu/libtclstub8.5.a]} {
	    set tclLib "TCL_LIB=/usr/lib/x86_64-linux-gnu"
        } elseif {[file exists /usr/lib/x86_64-linux-gnu/libtclstub8.4.so]} {
	    set tclLib "TCL_LIB=/usr/lib/x86_64-linux-gnu"
        } elseif {[file exists /usr/lib/x86_64-linux-gnu/libtclstub8.4.a]} {
	    set tclLib "TCL_LIB=/usr/lib/x86_64-linux-gnu"
        } elseif {[file exists /usr/lib/x86_64-linux-gnu/libtclstub8.3.so]} {
	    set tclLib "TCL_LIB=/usr/lib/x86_64-linux-gnu"
        } elseif {[file exists /usr/lib/x86_64-linux-gnu/libtclstub8.3.a]} {
	    set tclLib "TCL_LIB=/usr/lib/x86_64-linux-gnu"
	} elseif {[file exists /usr/lib/libtclstub8.6.so]} {
	    set tclLib "TCL_LIB=/usr/lib"
	} elseif {[file exists /usr/lib/libtclstub8.6.a]} {
	    set tclLib "TCL_LIB=/usr/lib"
	} elseif {[file exists /usr/lib/libtclstub8.5.so]} {
	    set tclLib "TCL_LIB=/usr/lib"
	} elseif {[file exists /usr/lib/libtclstub8.5.a]} {
	    set tclLib "TCL_LIB=/usr/lib"
	} elseif {[file exists /usr/lib/libtclstub8.4.so]} {
	    set tclLib "TCL_LIB=/usr/lib"
	} elseif {[file exists /usr/lib/libtclstub8.4.a]} {
	    set tclLib "TCL_LIB=/usr/lib"
	} elseif {[file exists /usr/lib/libtclstub8.3.so]} {
	    set tclLib "TCL_LIB=/usr/lib"
	} elseif {[file exists /usr/lib/libtclstub8.3.a]} {
	    set tclLib "TCL_LIB=/usr/lib"
	}


Re: tcl.h in Ubuntu 2022

Posted: 03 Mar 2023, 04:48
by blanco-garcia
Dear Soliday,

it works ! Thank you very much.