Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit bd8571d

Browse files
sjoelundOpenModelica-Hudson
authored andcommitted
Look for external libraries in /usr
This resolves an issue in ticket:4523 Belonging to [master]: - #2095
1 parent ee6b27b commit bd8571d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Compiler/SimCode/SimCodeFunctionUtil.mo

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,8 +1785,11 @@ protected function lookForExtFunctionLibrary
17851785
input Option<String> resources;
17861786
input Absyn.Path path;
17871787
input SourceInfo info;
1788+
protected
1789+
list<String> dirs2;
17881790
algorithm
1789-
if not max(System.regularFileExists(d+"/"+n) for d in dirs, n in names) then
1791+
dirs2 := "/usr/lib/"+System.getTriple()::"/lib/"+System.getTriple()::"/usr/lib/"::"/lib/"::dirs; // We could also try to look in ldconfig, etc for system libraries
1792+
if not max(System.regularFileExists(d+"/"+n) for d in dirs2, n in names) then
17901793
_ := match resources
17911794
local
17921795
String resourcesStr, tmpdir, cmd, pwd, contents, found;
@@ -1813,10 +1816,10 @@ algorithm
18131816
Error.addSourceMessage(Error.COMPILER_WARNING, {"Failed to run "+cmd+": " + contents}, info);
18141817
else
18151818
Error.addSourceMessage(Error.COMPILER_NOTIFICATION, {"Succeeded with compilation and installation of the library using:\ncommand: "+cmd+"\n" + contents}, info);
1816-
if not max(System.regularFileExists(d+"/"+n) for d in dirs, n in names) then
1819+
if not max(System.regularFileExists(d+"/"+n) for d in dirs2, n in names) then
18171820
Error.addSourceMessage(Error.EXT_LIBRARY_NOT_FOUND_DESPITE_COMPILATION_SUCCESS, {cmd, System.pwd()}, info);
18181821
else
1819-
found := listHead(list(x for x guard System.regularFileExists(x) in List.flatten(list(d+"/"+n for d in dirs, n in names))));
1822+
found := listHead(list(x for x guard System.regularFileExists(x) in List.flatten(list(d+"/"+n for d in dirs2, n in names))));
18201823
Error.addSourceMessage(Error.COMPILER_NOTIFICATION, {"Compiled "+found+" by running build project " + resourcesStr + "/BuildProjects/" + dir}, info);
18211824
didFind := true;
18221825
end if;
@@ -1835,10 +1838,10 @@ algorithm
18351838
then ();
18361839
else ();
18371840
end match;
1838-
if not max(System.regularFileExists(d+"/"+n) for d in dirs, n in names) then
1841+
if not max(System.regularFileExists(d+"/"+n) for d in dirs2, n in names) then
18391842
// suppress this warning if we're running the testsuite
18401843
if not Config.getRunningTestsuite() then
1841-
Error.addSourceMessage(Error.EXT_LIBRARY_NOT_FOUND, {name, sum("\n " + d + "/" + n for d in dirs, n in names)}, info);
1844+
Error.addSourceMessage(Error.EXT_LIBRARY_NOT_FOUND, {name, sum("\n " + d + "/" + n for d in dirs2, n in names)}, info);
18421845
end if;
18431846
end if;
18441847
end if;

0 commit comments

Comments
 (0)