MATLAB Libraries conflict with Existing Libraries

2019-05-18 20:10发布

问题:

I am working on C++ code on a Ubuntu 16.04 64-bit machine. As part of the code I have to call upon Matlab which I do using the libmat and libmx libraries.

When supplying CMake with the path to these libraries I get a warning from CMake that existing libraries may conflict (see error below). I can still generate the code but when I execute it I get a crash.


CMake Warning:

Cannot generate a safe runtime search path for target depth_forest_trainer because files in some directories may conflict with libraries in implicit directories:

runtime library [libpng12.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in: /usr/local/MATLAB/R2016a/bin/glnxa64

Some of these libraries may not be found correctly.

Error at runtime:

Error in `./depth_forest_trainer': free(): invalid pointer: 0x00000000021c7328

======= Backtrace: =========

/lib/x86_64-linux-gnu/libc.so.6(+0x77725)[0x7fe7abf49725]

/lib/x86_64-linux-gnu/libc.so.6(+0x7ff4a)[0x7fe7abf51f4a]

/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fe7abf55abc]

./depth_forest_trainer(_ZN5boost10filesystem4pathD1Ev+0x18)[0x5290a8]

/lib/x86_64-linux-gnu/libc.so.6(__cxa_finalize+0x9a)[0x7fe7abf0c35a]

/usr/local/MATLAB/R2016a/bin/glnxa64 /libboost_filesystem.so.1.56.0(+0x7ba6)

[0x7fe7ab0beba6]

======= Memory map: ========

[...]

7fe7a0000000-7fe7a0021000 rw-p 00000000 00:00 0 

7fe7a0021000-7fe7a4000000 ---p 00000000 00:00 0 

7fe7a49bd000-7fe7a537c000 r--p 00000000 08:01 4201449    

/usr/lib/locale/locale-archive

7fe7a537c000-7fe7a5381000 r-xp 00000000 08:01 4202446                    /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0

7fe7a5381000-7fe7a5580000 ---p 00005000 08:01 4202446                    /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0

7fe7a5580000-7fe7a5581000 r--p 00004000 08:01 4202446                    /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0

7fe7a5581000-7fe7a5582000 rw-p 00005000 08:01 4202446                    /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0

7fe7a5582000-7fe7a5584000 r-xp 00000000 08:01 4202435                    /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0

[it continues ...]


My question is if anyone has seen a similar behavior and could comment on how to solve this?

标签: matlab cmake