[Bug 768] New: Component loader factory can not be used directly in static application

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=768

Summary: Component loader factory can not be used directly in
static application
Product: OCL
Version: trunk
Platform: i386 Compatible
OS/Version: GNU/Linux
Status: NEW
Severity: normal
Priority: P3
Component: Deployment
AssignedTo: orocos-dev [..] ...
ReportedBy: kiwi [dot] net [..] ...
CC: orocos-dev [..] ...
Estimated Hours: 0.0

This works in macosx, but not in gnulinux Ubuntu Lynx.

A static program can not directly use the ComponentFactories class to load
components, due to an error of the form

relocation R_386_GOTOFF against undefined hidden symbol

or
hidden symbol "OCL::TimeServiceFactories::Factories" isn't defined

Which of the above two you get appears to be a glibc version issue.

Solution appears to be to add

ORO_CREATE_COMPONENT_TYPE();

directly into the main() file.

nm over the orocos-deployment dynamic library shows that
"OCL::TimeServiceFactories::Factories" is an undefined symbol.

I don't know why the deployer's don't show the same behaviour ...?

[Bug 768] Component loader factory can not be used directly in s

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=768

Peter Soetens <peter [..] ...> changed:

What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |next-bugfix
Status|NEW |ASSIGNED

--- Comment #4 from Peter Soetens <peter [..] ...> 2010-06-18 13:25:42 ---
That should have been 'OCL_EXPORT'. Only change this qualifier for
ComponentFactories::Instance() ? The ComponentFactories::Factories member is
private anyway...

Peter

diff --git a/ocl/ComponentLoader.hpp b/ocl/ComponentLoader.hpp
index 0615232..767f842 100644
--- a/ocl/ComponentLoader.hpp
+++ b/ocl/ComponentLoader.hpp
@@ -58,7 +58,7 @@ namespace OCL
          */
         OCL_HIDE static FactoryMap* Factories;
     public:
-        OCL_HIDE static FactoryMap& Instance() {
+        OCL_EXPORT static FactoryMap& Instance() {
             if ( Factories == 0)
                 Factories = new FactoryMap();
             return *Factories;

[Bug 768] Component loader factory can not be used directly in s

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=768

--- Comment #3 from S Roderick <kiwi [dot] net [..] ...> 2010-05-28 23:12:38 ---
The correct solution is to change "ORO_HIDE" to "ORO_EXPORT" in
ocl/ComponentLoader.hpp

[Bug 768] Component loader factory can not be used directly in s

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=768

--- Comment #2 from S Roderick <kiwi [dot] net [..] ...> 2010-05-28 15:33:38 ---
Created an attachment (id=601)
--> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=601)
testcase

In Ubuntu Lynx (maybe in other gnulinux also?), comment out the
"ORO_CREATE_COMPONENT_TYPE();" line and build.

[Bug 768] Component loader factory can not be used directly in s

https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=768

--- Comment #1 from S Roderick <kiwi [dot] net [..] ...> 2010-05-28 15:32:37 ---
Sorry, that second error should read "OCL::ComponentFactories::Factories"
instead of "OCL::TimeServiceFactories::Factories". I've been chasing the same
problem with the time service factory as well.