From: Eugene T. <Eug...@sy...> - 2017-08-18 01:40:57
|
Its been a while so I don't know if its still valid. These were some of my notes that I took to compile plotfamily many years ago. Hope this helps. The following is a documentation of the steps taken and the problems encountered: 1) The compile script was given by Greg Portmann and is relatively simple (below). eval(['mcc -mv -a Tada.wav -a Chord.wav -a UtopiaQuestion.wav -a UtopiaError.wav -a Ap erturePass -a BndMPoleSymplectic4Pass -a BndMPoleSymplectic4RadPass -a CavityPass -a C orrectorPass -a DriftPass -a EAperturePass -a IdentityPass -a Matrix66Pass -a QuadLine arPass -a SolenoidLinearPass -a StrMPoleSymplectic4Pass -a StrMPoleSymplectic4RadPass -a ThinMPolePass -a findmpoleraddiffmatrix -a StrCorrMPoleSymplectic4RadPass -a StrCor rMPoleSymplectic4Pass ',ApplicationName]); 2) First problem was that it needed the MCR directory (Matlab Runtime files). I tried to use the scripts that Greg provided that uses the locally installed Matlab runtime files however it didn't work (STILL NEEDS TO BE LOOKED AT WITH GREG). I was able to generate the MCR files using BUILDMCR to create a MCRInstaller.zip. This was extracted into a temporary directory. To run the compiled plotfamily you need to run "./run_plotfamily.sh <mcr dir>" shell script that is generated at compile time. 3) It complained that it couldn't find and load B_vs_I_data.mat. The reason was the it was defined with relative paths. Better solution is to always define absolute: load(fullfile(getmmlroot,'machine','ASP','StorageRing','magnet_calibration_curves','B_vs_I_data.mat')); 4) It then complained about not being able to find StrCorrMPoleSymplectic4RadPass. The first thing I did was try to add it to the search path using ADDPATH, however this is not permitted when running in standalone mode. The way the compiler works is to recursively follow the all the links within the program that you want to compile however if you call C programs that then also call other libraries, these libraries need to be linked. Hence you need to add the extra parameter "-a StrCorrMPoleSymplectic4RadPass" when calling MCC. 5) Plotfamily automatically checks if the AO is loaded and if not will call AOINIT. 6) After fixing the above problems it seemed to load fine with MCA as the comms. The GUI came out however when trying to retrieve data it couldn't find the EPICS libraries. After compiling, MCC will generate a run_plotfamily.sh file that is a script that gets things going and in that file you need to define the necessary ENV variables. So you have to add the /asp/ics/common/epics/base/lib/linux-x86/ to LD_LIBRARY_PATH. And for good measure also added /asp/ics/common/epics/base/bin/linux-x86/ to PATH. 7) After adding the library path it seemed to then run but then returned with an Out Of Memory error and crashed when I closed plotfamily. 8) Next was to try it with LabCA instead. The complication was that OPI05 where the compiler was installed was a 64 bit machine and didn't have the new LabCA files and had to modify setpathmml to add the new _64 option. The new LabCA distribution comes precompiled for 64bit. 9) Realised that the compiled program will use whatever comms is originally defined in the session when the compiler was called. EG "setpathasp mca; cc;" will compile and use only MCA, while "setpathasp labca; cc;" will use LabCA. 10) With LabCA, like MCA I had to add the library path /asp/usr/middleLayer/links/labca_new/lib/l inux-x86_64 to LD_LIBRARY_PATH. Note that "labca_new" is only a temporary directory and will eventually be merged with the nominal directory "labca". 11) Before compiling I had to move the *.m files in /asp/usr/middleLayer/links/labca_new/bin/l inux-x86_64/labca/ into another folder because the *.m files would shadow the *.mexa64 files and cause compile problems. WOHO Compiled and running plotfamily. All the applications under "Common Tasks" also work (not extensively tested yet). Unfortunately this only runs on OPI05 because its the only one with the new Matlab and associated compiler. Reason being the GLIBC version has been updated on OPI05 while OPI01-OPI04 and PHY01 haven't and therefore can't use the new Matlab and compiler. Error running on PHY01: Fatal error loading library /asp/usr/temp/ASPcompile/ASP/compile/v76/bin/glnxa64/libmx.so Error: /lib64/tls/libc.so.6: version `GLIBC_2.3.4' not found (required by /asp/usr/temp/ASPcompile/ASP/compile/v76/bin/glnxa64/libut.so) Error running on OPI01: ./run_plotfamily.sh: line 42: ./plotfamily: cannot execute binary file -----Original Message----- From: Corbett, Jeff [mailto:co...@sl...] Sent: Friday, August 18, 2017 10:14 AM To: Eugene Tan; Zeus Martí Cc: atc...@li... Subject: compiling labca into matlab Hi, all, We are trying to use the matlab compiler to compile m-files that contain lcaGet and lcaPut calls to create executable files on windows. Does anyone know the correct >>mcc command? Thanks, Jeff -----Original Message----- From: Eugene Tan [mailto:Eug...@sy...] Sent: Tuesday, August 01, 2017 2:14 AM To: Zeus Martí Cc: atc...@li... Subject: Re: [Atcollab-general] help with AT error I just checked the symbols in the compiled files using nm and they do not contain the global symbols for passFunction or trackFunction, only local. Matlab has changed the way it MEXs again. Matlab2016a [opi@CR01OPI05 ~]$ cd /usr/local/MATLAB/R2016a/extern/lib/glnxa64/ fexport.map mexFunction.map Matlab2017a user@asci: /usr/local/MATLAB/R2017a ls extern/lib/glnxa64/ c_exportsmexfileversion.map fexport.map fortran_exportsmexfileversion.map mexFunction.map It now has a two layer approach with LINKEXPORT(mexFunction.map) followed by LINKEXPORTVER (c_exportsmexfileversion.map). So what works for me is to make some small changes to the *.map file and mexpassmethod.m (attached). The change appears to have happened in R2016b! Some nitty gritty detail below if you're interested. Can people also check that these changes don't break anything before I commit this change to AT2.0? I don't know how to push this out to AT1.4, so if it works can someone please do this? Eugene >> !nm /user/home/at14/atintegrators/AperturePass.mexa64 0000000000000b0c t AperturePass 0000000000000ac5 t atGetDoubleArray 0000000000202090 b __bss_start 0000000000202090 b completed.6344 w __cxa_finalize@@GLIBC_2.2.5 00000000000009e0 t deregister_tm_clones 0000000000000a50 t __do_global_dtors_aux 0000000000201d80 t __do_global_dtors_aux_fini_array_entry 0000000000201d90 d __dso_handle 0000000000201d98 d _DYNAMIC 0000000000202090 d _edata 0000000000202098 b _end 0000000000000d04 t _fini 0000000000000a90 t frame_dummy 0000000000201d78 t __frame_dummy_init_array_entry 0000000000000ed0 r __FRAME_END__ 0000000000202000 d _GLOBAL_OFFSET_TABLE_ w __gmon_start__ 00000000000008c0 t _init w _ITM_deregisterTMCloneTable w _ITM_registerTMCloneTable 0000000000201d88 d __JCR_END__ 0000000000201d88 d __JCR_LIST__ w _Jv_RegisterClasses 0000000000000000 A MEX U mexErrMsgIdAndTxt 0000000000000cf1 T mexfilerequiredapiversion 0000000000000bfc T mexFunction U mexMakeMemoryPersistent U mxCreateCellMatrix@@v7.3 U mxCreateString U mxDuplicateArray U mxGetField@@v7.3 U mxGetInf U mxGetM U mxGetN U mxGetPr U mxIsNaN U mxMalloc U mxSetCell@@v7.3 0000000000000a10 t register_tm_clones 0000000000202090 d __TMC_END__ 0000000000000ba2 t trackFunction (small t means local) >> !nm /user/home/at14/atintegrators/AperturePass.mexa64 0000000000000b3c t AperturePass 0000000000000af5 t atGetDoubleArray 0000000000202090 b __bss_start 0000000000202090 b completed.6344 w __cxa_finalize@@GLIBC_2.2.5 0000000000000a10 t deregister_tm_clones 0000000000000a80 t __do_global_dtors_aux 0000000000201d80 t __do_global_dtors_aux_fini_array_entry 0000000000201d90 d __dso_handle 0000000000201d98 d _DYNAMIC 0000000000202090 d _edata 0000000000202098 b _end 0000000000000d34 t _fini 0000000000000ac0 t frame_dummy 0000000000201d78 t __frame_dummy_init_array_entry 0000000000000f00 r __FRAME_END__ 0000000000202000 d _GLOBAL_OFFSET_TABLE_ w __gmon_start__ 00000000000008f0 t _init w _ITM_deregisterTMCloneTable w _ITM_registerTMCloneTable 0000000000201d88 d __JCR_END__ 0000000000201d88 d __JCR_LIST__ w _Jv_RegisterClasses 0000000000000000 A MEX U mexErrMsgIdAndTxt 0000000000000d21 T mexfilerequiredapiversion 0000000000000c2c T mexFunction U mexMakeMemoryPersistent U mxCreateCellMatrix@@v7.3 U mxCreateString U mxDuplicateArray U mxGetField@@v7.3 U mxGetInf U mxGetM U mxGetN U mxGetPr U mxIsNaN U mxMalloc U mxSetCell@@v7.3 0000000000000a40 t register_tm_clones 0000000000202090 d __TMC_END__ 0000000000000bd2 T trackFunction (capital T means global) Matlab2016a: LINKEXPORT="-Wl,--version-script,"$MATLABROOT/extern/lib/$ARCH/mexFunction.map"" LDFLAGS="$LDFLAGS $LDTYPE $LINKLIBS $LINKEXPORT" Matlab2017a: FUNCTIONMAP=""$MATLABROOT/extern/lib/$ARCH/mexFunction.map"" VERSIONMAP=""$MATLABROOT/extern/lib/$ARCH/c_exportsmexfileversion.map"" LINKEXPORT="-Wl,--version-script,$FUNCTIONMAP" LINKEXPORTVER="-Wl,--version-script,$VERSIONMAP" LDFLAGS="-pthread -Wl,--no-undefined -Wl,-rpath-link,$MATLABROOT/bin/$ARCH" LDFLAGS="$LDFLAGS $LDTYPE $LINKLIBS $LINKEXPORT" CMDLINE2="$LD $LDFLAGS $LDTYPE $LINKOPTIM $LINKEXPORTVER $OBJS $CLIBS $LINKLIBS -o $EXE" From: Zeus Martí [mailto:ze...@ce...] Sent: Tuesday, August 01, 2017 3:47 PM To: atc...@li... Subject: Re: [Atcollab-general] help with AT error Hi there, We just noticed yesterday some similar problems with a similar configuration "CentOS7 + Matlab2017a + AT1.3". AT1.4 also fails, but AT1.3 has the wonderful ability to crash Matlab2017a every time it is executed. It has been recently updated, the previous version was "CentOS7 + Matlab2015a + AT1.3", so far we workaround using the old release. In our case, the same files are used by different machines with different Matlab versions so we decided not to recompile yet. Eugene, do you by any chance know if the recompiled files work in earlier versions? Best regards, Zeus On 01/08/2017 5:07, Eugene Tan wrote: We have been trying to get AT running on CentOS7 + Matlab2017a + AT1.4 and comes up with: Error using atpass Element # 0: Library file: /usr/home/at14/atintegrators/AperturePass.mexa64, No passFunction or trackFunction available I've recompiles all the pass methods using "atmexall" and compiles successfully. Has anyone had this problem before? Windows + Matlab2016a + AT2.0 is OK. Eugene ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Atcollab-general mailing list Atc...@li... https://lists.sourceforge.net/lists/listinfo/atcollab-general |