Skip to content

Commit cdd0ec1

Browse files
Merge pull request #76 from RNA-FRETools/readme-mex-linux
Add "readme" for mex compilation issue on Linux
2 parents b7db508 + b756f9a commit cdd0ec1

2 files changed

Lines changed: 152 additions & 0 deletions

File tree

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
function checkMASHmex()
2+
3+
% compile molecule localization method Schmied2012
4+
if exist('forloop','file')~=3
5+
cd(fileparts(which('forloop.c')));
6+
try
7+
mex('forloop.c');
8+
catch err
9+
dispMatlabErr(err);
10+
end
11+
end
12+
13+
% compile image filters
14+
% if exist('FilterArray','file')~=3
15+
% pname = fileparts(which('FilterArray.c'));
16+
% % set runtime library path for LINUX
17+
% if strcmp(computer,'GLNXA86') || strcmp(computer,'GLNXA64')
18+
% system(['LD_LIBRARY_PATH=$LD_LIBRARY_PATH:',matlabroot,filesep,...
19+
% 'glnxa64:',matlabroot,filesep,'sys',filesep,'os',filesep,...
20+
% 'glnxa64']);
21+
% end
22+
% if strcmp(computer,'PCWIN') || strcmp(computer,'GLNX86') % 32bit OS
23+
% runtimefolder = 'runtime32';
24+
% libflag = '-lITASL32';
25+
%
26+
% elseif strcmp(computer,'PCWIN64') || strcmp(computer,'GLNX64') % 64bit OS
27+
% runtimefolder = 'runtime64';
28+
% libflag = '-lITASL64';
29+
% end
30+
% cd([pname,filesep,'..',filesep,runtimefolder]);
31+
% try
32+
% mex('-R2018a',[pname,filesep,'FilterArray.c'],...
33+
% ['-L',pname,filesep,'lib'],libflag);
34+
% catch err
35+
% dispMatlabErr(err);
36+
% end
37+
% end
38+
39+
% compile SIF file import
40+
if exist('SIFImport','file')~=3
41+
42+
% libraries unavailable for LINUX
43+
if strcmp(computer,'GLNXA86') || strcmp(computer,'GLNXA64') || ...
44+
strcmp(computer,'MACI86') || strcmp(computer,'MACI64')
45+
disp(['import of old versions of SIF files is not supported ',...
46+
'on MacOS and Linux systems']);
47+
else
48+
pname = fileparts(which('SIFImport.c'));
49+
50+
if strcmp(computer,'PCWIN') || strcmp(computer,'MACI86') % 32bit OS
51+
runtimefolder = 'runtime32';
52+
libflag = '-lITASL32';
53+
54+
elseif strcmp(computer,'PCWIN64') || strcmp(computer,'MACI64') % 64bit OS
55+
runtimefolder = 'runtime64';
56+
libflag = '-lITASL64';
57+
end
58+
cd([pname,filesep,'..',filesep,runtimefolder]);
59+
try
60+
mex('-R2018a',[pname,filesep,'SIFImport.c'],...
61+
['-L',pname,filesep,'lib'],libflag);
62+
catch err
63+
dispMatlabErr(err);
64+
end
65+
end
66+
end
67+
68+
% compile SPE file import
69+
if exist('SPEImport','file')~=3
70+
71+
% libraries unavailable for LINUX
72+
if strcmp(computer,'GLNXA86') || strcmp(computer,'GLNXA64') || ...
73+
strcmp(computer,'MACI86') || strcmp(computer,'MACI64')
74+
disp(['import of SPE files is not supported on MacOS and Linux ',...
75+
'systems']);
76+
else
77+
pname = fileparts(which('SPEImport.c'));
78+
79+
if strcmp(computer,'PCWIN') % 32bit OS
80+
runtimefolder = 'runtime32';
81+
libflag = '-lITASL32';
82+
83+
elseif strcmp(computer,'PCWIN64') % 64bit OS
84+
runtimefolder = 'runtime64';
85+
libflag = '-lITASL64';
86+
end
87+
cd([pname,filesep,'..',filesep,runtimefolder]);
88+
try
89+
mex('-R2018a',[pname,filesep,'SPEImport.c'],...
90+
['-L',pname,filesep,'lib'],libflag);
91+
catch err
92+
dispMatlabErr(err);
93+
end
94+
end
95+
end
96+
97+
% compile DPH training algorithm
98+
if exist('trainPH','file')~=3
99+
cd(fileparts(which('trainPH.c')));
100+
try
101+
mex -R2018a -O trainPH.c vectop.c
102+
catch err
103+
dispMatlabErr(err);
104+
end
105+
end
106+
107+
% compile Baum-Welch algorithm
108+
if exist('baumwelch','file')~=3
109+
cd(fileparts(which('baumwelch.c')));
110+
try
111+
mex -R2018a -O baumwelch.c vectop.c fwdbwd.c
112+
catch err
113+
dispMatlabErr(err);
114+
end
115+
end
116+
117+
% compile model error calculation
118+
if exist('calcmdlconfiv','file')~=3
119+
cd(fileparts(which('calcmdlconfiv.c')));
120+
try
121+
mex -R2018a -O calcmdlconfiv.c vectop.c fwdbwd.c
122+
catch err
123+
dispMatlabErr(err);
124+
end
125+
end
126+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
To solve MEX file compilation issues happening at MASH-FRET startup on Linux, please read the following instructions.
2+
3+
ERROR MESSAGE 1:
4+
An error occurred:
5+
Supported compiler not found. For options, visit https://www.mathworks.com/support/compilers.
6+
function: checkMASHmex, line: 7
7+
function: MASH, line: 13
8+
9+
SOLUTION 1:
10+
MATLAB supports GCC compiler up to version 9.x
11+
Install gcc-9 package with the shell command:
12+
sudo apt install gcc-9
13+
Create a soft link "gcc" pointing to gcc-9 with the shell comand:
14+
sudo ln -s /usr/bin/gcc-9 /usr/bin/gcc
15+
16+
ERROR MESSAGE 2:
17+
An error occurred:
18+
/usr/bin/ld : ne peut trouver -lstdc++
19+
collect2: error: ld returned 1 exit status
20+
function: checkMASHmex, line: 7
21+
function: MASH, line: 13
22+
23+
SOLUTION 2:
24+
MATLAB looks for a file named libstdc++.so which is named "libstdc++.so.6" on your computer
25+
Create a soft link "libstdc++.so" pointing to libstdc++.so.6 with the shell comand:
26+
sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/x86_64-linux-gnu/libstdc++.so

0 commit comments

Comments
 (0)