OpenZeppelin Verify failing for contract with library

Reported on Telegram.

Unable to verify using openzeppelin verify on Etherscan when deployed to Rinkeby.

$ oz create
✓ Compiled contracts with solc 0.5.11 (commit.c082d0b4)
? Pick a contract to instantiate SyscoinSuperblocks
? Pick a network rinkeby
✓ Set library uploaded
✓ SyscoinMessageLibrary library uploaded
✓ Contract SyscoinERC20Manager deployed
✓ Contract SyscoinERC20ManagerForTests deployed
✓ Contract SyscoinSuperblocks deployed
✓ Contract SyscoinBattleManager deployed
✓ Contract SyscoinClaimManager deployed
All contracts have been deployed
? Do you want to call a function on the instance after creating it? No
Possible initialization method (initialize, init) found in contract. Make sure you initialize your instance.
✓ Setting everything up to create contract instances
✓ Instance created at 0x23b4dE9340a6223D162cDaFA2a771290332Be615
0x23b4dE9340a6223D162cDaFA2a771290332Be615
$ oz verify
? Pick a contract SyscoinSuperblocks
? Pick a network rinkeby
? Was the optimizer enabled when you compiled your contracts? Yes
? Specify the optimizer runs 200
? Select an endpoint etherscan
? Provide an etherscan API KEY 
✖ Verifying and publishing contract source code of SyscoinSuperblocks on etherscan (this usually takes under 30 seconds)
Error while trying to verify contract: Fail - Unable to verify

Manually verify (successful):

Flatten the contract

$ npx truffle-flattener ./contracts/SyscoinSuperblocks.sol > FlatSyscoinSuperblocks.sol

Get the library name and address from rinkeby.json

    "SyscoinMessageLibrary": {
      "address": "0x205056183b864609f48dB1e17EB35F0Af4b29f42",
      "constructorCode": "610269610026600b82828239805160001a60731461001957fe5b30600052607381538281f3fe",
      "bodyBytecodeHash": "1ee232660e0eea9f09a20c24e9c4b04a3f9aca73cb3d7c9b8b4421f75f16934f",
      "localBytecodeHash": "d9ff11606612b37882fec7d13c9151d3b0f914aad0dfecf05025ecffea4e0ee8",
      "deployedBytecodeHash": "d9ff11606612b37882fec7d13c9151d3b0f914aad0dfecf05025ecffea4e0ee8"
    },

Get the logic contract address:

"sysethereum-contracts/SyscoinSuperblocks": [
      {
        "address": "0x23b4dE9340a6223D162cDaFA2a771290332Be615",
        "version": "1.0.0",
        "implementation": "0x0c66b9B6b839A7647C49afFC9fA7e4464F1D4a0d",
        "admin": "0x4C35D82Cfb01E8FAB6E801bB655652222Ad6aD98",
        "kind": "Upgradeable"
      }
    ]

Manually verified compiler 0.5.11, optimizer 200 runs, library
https://rinkeby.etherscan.io/address/0x0c66b9b6b839a7647c49affc9fa7e4464f1d4a0d#code

Assume that openzeppelin verify may not support libraries.

OpenZeppelin SDK doesn’t currently support verifying logic contracts with external libraries. See open Issue: https://github.com/OpenZeppelin/openzeppelin-sdk/issues/251

Contracts can be manually verified on Etherscan by flattening the contract and specifying the library name and address.