Opened 8 years ago

Last modified 7 years ago

#3998 accepted defect

OMC does not search in the correct places for libs under Linux

Reported by: Dietmar Winkler Owned by: Martin Sjölund
Priority: high Milestone: Future
Component: Backend Version: v1.11.0
Keywords: Cc: Adrian Pop

Description

When working on Modelica_DeviceDrivers gh#114 I tried to run (on OpenModelica 1.11.0~dev-42-g1a73b84 under Ubuntu 16.04 64bit):

model Try4
  parameter String mem_name = "COM4";
  import Modelica_DeviceDrivers.Communication.SharedMemory;
  import Modelica_DeviceDrivers.Communication.SharedMemory_;
  import Modelica_DeviceDrivers.Packaging.SerialPackager;
  import Modelica_DeviceDrivers.Packaging.SerialPackager_;
protected
  SharedMemory sm = SharedMemory(mem_name, 16 * 1024);
  SerialPackager pkg = SerialPackager();
equation
  SharedMemory_.read(sm, pkg);
  annotation(uses(Modelica_DeviceDrivers(version="1.4.4")));
end Try4;

which compiles fine and even seems to execute but I got a translation warning:

[4] 09:08:37 Translation Warning
[Modelica_DeviceDrivers.Communication.SharedMemory: 17:3-25:17]: 
Could not find library pthread in either of:
  /usr/lib/x86_64-linux-gnu/omc/libpthread.a
  /usr/lib/x86_64-linux-gnu/omc/libpthread.so
  /usr/lib//libpthread.a
  /usr/lib//libpthread.so
 ...

the lib actually resides in:

$ locate libpthread.a
/usr/lib/x86_64-linux-gnu/libpthread.a
/usr/lib32/libpthread.a
/usr/libx32/libpthread.a

Same goes for librt.

So OMC should first search /usr/lib/x86_64-linux-gnu/ then /usr/lib/x86_64-linux-gnu/omc/

Change History (5)

comment:1 by Martin Sjölund, 8 years ago

Cc: Adrian Pop added
Owner: changed from Lennart Ochel to Martin Sjölund
Status: newaccepted

Can be queried by clang -print-search-dirs (or gcc ...). But the question is if we should do it during ./configure (to cache the result and not call external processes over and over again), or if we perhaps should do it once per translateModel call.

@adrpo, @dietmarw: any preferences?

comment:2 by Dietmar Winkler, 8 years ago

I would probably try the most efficient way first and if that fails investigate again.

comment:3 by Martin Sjölund, 8 years ago

The only problem with that one is that if clang is used, and the user selects gcc as the compiler, llvm-specific libraries might be found (when we are looking for installed libraries).

comment:4 by Martin Sjölund, 8 years ago

Milestone: 1.11.01.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:5 by Francesco Casella, 7 years ago

Milestone: 1.12.0Future

The milestone of this ticket has been reassigned to "Future".

If you think the issue is still valid and relevant for you, please select milestone 1.13.0 for back-end, code generation and run-time issues, or 2.0.0 for front-end issues.

If you are aware that the problem is no longer present, please select the milestone corresponding to the version of OMC you used to check that, and set the status to "worksforme".

In both cases, a short informative comment would be welcome.

Note: See TracTickets for help on using tickets.