Stratego/XT JIRA  History | Log In     View a printable version of the current page. Get help!  
Issue Details (XML | Word)

Key: STR-672
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Eelco Visser
Reporter: Martin Bravenboer
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Stratego/XT

strc: fix multiple external definitions problems

Created: 2006-12-03 13:49   Updated: 2008-04-14 08:23
Component/s: strc - Stratego compiler
Affects Version/s: 0.16 (Stratego Core Compiler)
Fix Version/s: 0.17

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Issue Links:
Solve
 
This issue will be solved by:
STR-673 multiple definitions of symbols throu... Critical Open


 Description  « Hide
The following warnings are common:

I'm not 100% sure that this is a compiler problem, maybe it's a problem with duplicate imports of signatures.

        <tsuna> [ strc | info ] Compiling '../../../src/tools/pp-prism.str'
<tsuna> [ strc | warning ] multiple external definitions with same signature
<tsuna> [ExtSDef("FILE",[VarDec("g_13",FunType([ConstType(Sort("ATerm",[]))],ConstType(Sort("ATerm",[]))))],[]),ExtSDef("FILE",[VarDec("k_27",FunType([ConstType(Sort("ATerm",[]))],ConstType(Sort("ATerm",[]))))],[])]
<tsuna> [ strc | warning ] multiple external definitions with same signature
<tsuna> [ExtSDef("DIR",[VarDec("h_13",FunType([ConstType(Sort("ATerm",[]))],ConstType(Sort("ATerm",[]))))],[]),ExtSDef("DIR",[VarDec("l_27",FunType([ConstType(Sort("ATerm",[]))],ConstType(Sort("ATerm",[]))))],[])]
<tsuna> [ strc | warning ] multiple external definitions with same signature
<tsuna> [ExtSDef("TEMP",[],[]),ExtSDef("TEMP",[],[])]
<tsuna> [ strc | warning ] multiple external definitions with same signature
<tsuna> [ExtSDef("TempFiles",[],[]),ExtSDef("TempFiles",[],[])]
<tsuna> [ strc | warning ] multiple external definitions with same signature
<tsuna> [ExtSDef("TempDirs",[],[]),ExtSDef("TempDirs",[],[])]
<tsuna> [ strc | warning ] multiple external definitions with same signature
<tsuna> [ExtSDef("Tool",[VarDec("i_13",FunType([ConstType(Sort("ATerm",[]))],ConstType(Sort("ATerm",[]))))],[]),ExtSDef("Tool",[VarDec("m_27",FunType([ConstType(Sort("ATerm",[]))],ConstType(Sort("ATerm",[]))))],[])]
<tsuna> [ strc | warning ] multiple external definitions with same signature
<tsuna> [ExtSDef("Repository",[],[]),ExtSDef("Repository",[],[])]
<tsuna> [ strc | warning ] multiple external definitions with same signature
<tsuna> [ExtSDef("Import",[],[]),ExtSDef("Import",[],[])]
<tsuna> [ strc | warning ] multiple external definitions with same signature
<tsuna> [ExtSDef("Imported",[VarDec("j_13",FunType([ConstType(Sort("ATerm",[]))],ConstType(Sort("ATerm",[]))))],[]),ExtSDef("Imported",[VarDec("n_27",FunType([ConstType(Sort("ATerm",[]))],ConstType(Sort("ATerm",[]))))],[])]
<tsuna> [ strc | warning ] multiple external definitions with same signature
<tsuna> [ExtSDef("XTC",[],[]),ExtSDef("XTC",[],[])]
<tsuna> [ strc | info ] Front-end succeeded : [user/system] = [3.58s/1.38s]
<tsuna> [ strc | info ] Optimization succeeded -O 2 : [user/system] = [0.09s/0.02s]
<tsuna> [ strc | info ] Back-end succeeded : [user/system] = [1.66s/0.10s]
<tsuna> [ strc | info ] Compilation succeeded : [user/system] = [5.35s/1.51s]
<tsuna> and then
<tsuna> linking pp-prism leads to *tons* of warnings from ld such as:
<tsuna> /usr/bin/ld: warning multiple definitions of symbol _FILE_1_0
<tsuna> /nix/store/9g6qzzmahjfh5p7hfpvc13anblkwvacb-strategoxt/lib/libstratego-gpp.dylib(libstratego_gpp_la-libstratego-gpp.o) definition of _FILE_1_0
<tsuna> /nix/store/9g6qzzmahjfh5p7hfpvc13anblkwvacb-strategoxt/lib/libstratego-xtc.dylib(libstratego_xtc_la-libstratego-xtc-posix-xsi.o) definition of _FILE_1_0
<tsuna> the following symbols are concerned: _FILE_1_0, _Import_0_0, _Import_1_0, _Repository_0_0, _TEMP_0_0, _TempDirs_0_0, _TempFiles_0_0, _Tool_1_0, _XTC_0_0, _DIR_1_0, _DYNAMIC__CALLS_0_0

 All   Comments   Work Log   Change History      Sort Order:
Eelco Visser [2008-04-11 09:32]
From the names of the strategies I guess these are congruence definitions. While proper strategy
definitions that are imported as externals are not exported as externals from a library, constructors
imported by a library, are also exported by that library. This causes congruences to be regenerated,
possibly not in that same library, but in a library one step further in the import chain.

front/introduce-congdefs.str :

  // avoid double definitions of congruences by registering already defined operators

Thus, the external definitions for congruences from an imported library, prevent generation of new congruences.

However, since imported external definitions are not exported, the next library does not see those congruence
definitions, and will re-generate them.

What is needed is a distinction between internal and external constructor.

Or we should even not export imported constructors.

That requires a notion of external constructor definition.

Eelco Visser [2008-04-14 08:23]
fixed by introducing external constructors (STR-751) and not exporting imported constructors from a library