Menu

#103 unresolved symbol with libmuparser.a on linux

open
nobody
None
5
2012-10-10
2009-03-07
SauLus
No

When building up the directory structure as described in the wiki meshlab seems to compile successful.
After starting you can find the logs:

./meshlab

Current Plugins Dir: /home/david/build/meshlab/meshlab-svn/src/meshlab/plugins
error loading plugin with filename: "libfilter_func.so"
"Cannot load library /home/david/build/meshlab/meshlab-svn/src/meshlab/plugins/libfilter_func.so: (/home/david/build/meshlab/meshlab-svn/src/meshlab/plugins/libfilter_func.so: undefined symbol: _ZTVN2mu6ParserE)"
Shader directory found '/home/david/build/meshlab/meshlab-svn/src/meshlab/shaders', and it contains 17 gdp files
Shader directory found '/home/david/build/meshlab/meshlab-svn/src/meshlab/shadersrm', and it contains 12 rfx files
Using the texture of the mesh /home/david/build/meshlab/meshlab-svn/src/meshlab

The symbol is defined, but can not be found. I solved this problem, but I dont know, if this is the most correct way:

svn diff

Index: fgt/filter_func/filter_func.pro

--- fgt/filter_func/filter_func.pro (revision 3104)
+++ fgt/filter_func/filter_func.pro (working copy)
@@ -1,17 +1,17 @@
-include (../../shared.pri)
-
-HEADERS = filter_func.h
-
-SOURCES = filter_func.cpp\

- ../../meshlab/filterparameter.cpp

-TARGET = filter_func

-INCLUDEPATH += ../../external/muparser_v130/include
+include (../../shared.pri)
+HEADERS = filter_func.h

+SOURCES = filter_func.cpp\

  • ../../meshlab/filterparameter.cpp
    +TARGET = filter_func
    +
    +INCLUDEPATH += ../../../../code/lib/muparser/include/
    +
    # Note: we need static libs so when building muparser lib use
    # ./configure --enable-shared=no
    -
    +
    win32-msvc2005:LIBS += ../../../../code/lib/muparser/lib/muparser.lib
    mac:LIBS += ../../../../code/lib/muparser/lib/libmuparser.a
    -win32-g++:LIBS += ../../external/lib/win32-gcc/libmuparser.a
    \ No newline at end of file
    +unix:LIBS += ../../../../code/lib/muparser/lib/libmuparser.a
    +LIBS += ../../../../code/lib/muparser/lib/libmuparser.a
    +win32-g++:LIBS += ../../external/lib/win32-gcc/libmuparser.a
    Index: meshlabv12.pro
    ===================================================================
    --- meshlabv12.pro (revision 3104)
    +++ meshlabv12.pro (working copy)
    @@ -2,4 +2,7 @@
    TEMPLATE = subdirs
    SUBDIRS = meshlab \
    meshlabserver \
  • meshlabplugins/meshlabpluginsv12.pro
    \ No newline at end of file
  • meshlabplugins/meshlabpluginsv12.pro
    +LIBS += ../../../../code/lib/muparser/lib/libmuparser.a
    +unix:LIBS += ../../../../code/lib/muparser/lib/libmuparser.a

One Problem is, that the current version uses ../../external/muparser_v130/include instead of the path ../../../../code/lib/muparser/include/ as the wiki refers to.
Another Problem is that there is no definition for *nix based systems in the project files at all. I tried defining this with the redundant definition
LIBS += ../../../../code/lib/muparser/lib/libmuparser.a -and-
unix:LIBS += ../../../../code/lib/muparser/lib/libmuparser.a
(I dont know if unix:LIBS exists).

After this I got another Problem with the linker to muparser:

~/build/meshlab/meshlab-svn/src/fgt/filter_func$ g++ -Wl,-O1 -shared -o libfilter_func.so release/filter_func.o release/filterparameter.o release/moc_filter_func.o -L/usr/lib ../../../../code/lib/muparser/lib/libmuparser.a -lQtGui -lQtCore -lpthread -fPIC

/usr/bin/ld: ../../../../code/lib/muparser/lib/libmuparser.a(muParser_lib_muParser.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
../../../../code/lib/muparser/lib/libmuparser.a: could not read symbols: Bad value
collect2: ld returned 1

The solution is written on the screen as well. So I changed in ~/build/meshlab/code/lib/muparser the macro CXXFLAGS = -O2 to CXXFLAGS = -O2 -fPIC, did a
./configure --enable-shared=no && make and recompiled meshlab.
This time the Symbol got resolved.

My REQUESTS:
Please
-remove ../../external/muparser_v130 and all links from the repository
-remove the link-problem with libmuparser.a
-report the 'best' way to solve the problem

Ps: Meshlab is great, thank you for your good work!

Discussion


Log in to post a comment.

MongoDB Logo MongoDB