This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

shared library - undefined symbols


I'm porting a C++ application that builds and runs on linux.  This application allows for "plugins" and will dynamically load any shared object found in its plugin directory.  This works fine on linux.  The trouble I'm having is getting the plugin "shared library" are in to build.  I'm running into undefined references (which should be allowed because they will be resolved when the shared library is loaded -- these symbols exist in the main application).

The failing g++ line:

g++ -o build/unknown-pc-cygwin/debug/plugin.so -shared -Wl,--allow-shlib-undefined build/unknown-pc-cygwin/debug/.objs/plugin.o build/unknown-pc-cygwin/debug/.objs/NullFilter.o build/unknown-pc-cygwin/debug/.objs/NullFilterFactory.o

The failing output:

build/unknown-pc-cygwin/debug/.objs/NullFilter.o: In function `_ZN10NullFilter7processERSt4listI14MatchingPeriodSaIS1_EE':
/home/OBrienDM/gpm/src/NullFilter.cpp:32: undefined reference to `getLoggerVerbosity()'
/home/OBrienDM/gpm/src/NullFilter.cpp:32: undefined reference to `isLoggerEnabledFor(int)'
/home/OBrienDM/gpm/src/NullFilter.cpp:32: undefined reference to `TimeStamp::TimeStamp()'
/home/OBrienDM/gpm/src/NullFilter.cpp:32: undefined reference to `operator<<(std::basic_ostream<char, std::char_traits<char> >&, TimeStamp const&)'
/home/OBrienDM/gpm/src/NullFilter.cpp:32: undefined reference to `TimeStamp::~TimeStamp()'
build/unknown-pc-cygwin/debug/.objs/NullFilter.o: In function `_ZN10NullFilter7processERSt4listI14MatchingPeriodSaIS1_EE':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/sstream:511: undefined reference to `log(int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*, unsigned int)'
build/unknown-pc-cygwin/debug/.objs/NullFilter.o: In function `_ZN10NullFilter7processERSt4listI14MatchingPeriodSaIS1_EE':
/home/OBrienDM/gpm/src/NullFilter.cpp:32: undefined reference to `TimeStamp::~TimeStamp()'
build/unknown-pc-cygwin/debug/.objs/NullFilterFactory.o: In function `_ZN17NullFilterFactoryC1Ev':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/ext/new_allocator.h:62: undefined reference to `MatcherFactory::instance()'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/ext/new_allocator.h:62: undefined reference to `MatcherFactory::registerFilterFactory(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, FilterFactoryAdapter*)'
build/unknown-pc-cygwin/debug/.objs/NullFilterFactory.o: In function `_ZN17NullFilterFactoryC2Ev':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/ext/new_allocator.h:62: undefined reference to `MatcherFactory::instance()'
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/ext/new_allocator.h:62: undefined reference to `MatcherFactory::registerFilterFactory(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, FilterFactoryAdapter*)'
collect2: ld returned 1 exit status

These missing references are found in the executable:

 nm --demangle  ./build/unknown-pc-cygwin/debug/gpm.exe |grep 'getLoggerVerbosity()'
00456820 T getLoggerVerbosity()
 nm --demangle  ./build/unknown-pc-cygwin/debug/gpm.exe |grep 'TimeStamp::~TimeStamp()'
004b4470 T TimeStamp::~TimeStamp()
004b4460 T TimeStamp::~TimeStamp()

And will get resolved at load time.

The g++ line works fine under linux.

Any other flags I'm missing?

Rgds,

Dan O'Brien, daniel.obrien@yahoo.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]