Skip to content

Fix linker error when building complex contracts#199

Merged
cmichi merged 5 commits into
masterfrom
cmichi-fix-linker-error
Feb 24, 2021
Merged

Fix linker error when building complex contracts#199
cmichi merged 5 commits into
masterfrom
cmichi-fix-linker-error

Conversation

@cmichi

@cmichi cmichi commented Feb 24, 2021

Copy link
Copy Markdown
Collaborator

Closes #198 and use-ink/ink#701.

My understanding is that the linker error was a result of conflicting build artifacts in the target directory.

The root contract is build with the ink-as-dependency feature enabled for sub-contracts, whereas the sub-contracts are build without this flag. This results in the external function __ink_generate_metadata (which is only build when ink-as-dependency is disabled) not being available in the artifacts, but cargo still tries to reuse the artifacts. Hence the linker error.

I fixed it now by building sub-contracts into sub-folders of target/ink/. This way all artifacts are separate.

@cmichi
cmichi requested a review from ascjones February 24, 2021 07:51
@cmichi
cmichi force-pushed the cmichi-fix-linker-error branch from b756dbe to 3af6fbe Compare February 24, 2021 07:53
@cmichi
cmichi force-pushed the cmichi-fix-linker-error branch from 3af6fbe to 5847584 Compare February 24, 2021 07:54
@ascjones

Copy link
Copy Markdown
Collaborator

Ahhh I was wondering what I was getting at in the original issue #60

Need to auto remove the ink-as-dependency feature in the root workspace manifest for the sub contracts

@cmichi

cmichi commented Feb 24, 2021

Copy link
Copy Markdown
Collaborator Author

Ahhh I was wondering what I was getting at in the original issue #60

Need to auto remove the ink-as-dependency feature in the root workspace manifest for the sub contracts

Yeah me too when I implemented it 😬.

@ascjones

Copy link
Copy Markdown
Collaborator

Well if I don't even understand my own cryptic comments I don't expect you to 😓

Comment thread src/util.rs Outdated

@ascjones ascjones left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we'll need to do a 0.9.1 release with this

@cmichi
cmichi merged commit b4d61f6 into master Feb 24, 2021
@cmichi
cmichi deleted the cmichi-fix-linker-error branch February 24, 2021 11:24
@cmichi cmichi mentioned this pull request Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The delegator example is successful only on the first compilation.

2 participants