Description of problem: We have a class defined like this defined in a header file: template <class state_t, class event_t> class UFSM_Base_FSM { ... virtual ~UFSM_Base_FSM() { monitor.release(); } } and a class that inherits from it: class MFSM_FSM : public UFSM_Base_FSM<int,mobj_msg_id_t> { ... virtual ~MFSM_FSM(); /* Destructor */ } with the empty destructor being defined non-inline. When the MFSM_FSM class is compiled using -fvisibility-inlines-hidden and the code is built into a shared library, this error results: /usr/bin/ld: mfsm_fsm.o: relocation R_X86_64_PC32 against `UFSM_Base_FSM<int, mobj_msg_id_t>::~UFSM_Base_FSM()' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value The -fPIC flag is being used when compiling all code. Version-Release number of selected component (if applicable): gcc43-4.3.2-7.el5 How reproducible: Every time Steps to Reproduce: 1. Compile code like the above and link into shared library (not sure how reproducible the problem is without the entire code base) 2. 3. Actual results: link succeeds Expected results: link fails Additional info:
This kind of error can result from incorrect command line options, undefined virtual methods, a linker bug with protected symbols, etc. Without a full testcase we can not fully analyze this problem to determine if it is a problem in your code, the compiler, assembler or linker. A full testcase would consist of source code and the exact commands you use to show the problem. It is also the case that gcc43 is no longer supported on the Red Hat Enterprise Linux platform. It was replaced by "gcc44" a while back. I'm closing this as INSUFFICIENT_DATA; you may reopen it by providing the requested information so that we can fully analyze the issue.