<p>I have had similar issues.
I don't understand the Core to PLC plugin enough to explain why this happens, but I am fairly sure this is related to using types on-chain that have a <em>strict</em> field of type <code>BuiltinByteString</code>.</p>
<p>So removing the <code>!</code> in front of field <code>a</code> in <code>TypeD</code> should avoid running into this error.</p>

CC BY-SA 4.0
2023-02-23T12:41:30.830Z
2023-02-23T12:41:50.317Z
2023-02-23T12:41:50.317Z
Jan Bormet
<p>Has anyone encountered such an issue?</p>
<p>Validator works fine and cborHex is generated when &quot;<code>writeSerialisedScript</code>&quot; run in cabal's repl. But when building with <code>cabal build app</code>, the following error is thrown:</p>
<pre><code>GHC Core to PLC plugin: E042:Error: Unsupported feature: Type constructor: GHC.Prim.Addr#
Context: Compiling type: GHC.Prim.Addr#
Context: Compiling data constructor type: Data.ByteString.Internal.PS
Context: Compiling type: Data.ByteString.Internal.ByteString
Context: Compiling data constructor type: Model.TypeD.TypeD
Context: Compiling type: Model.TypeD.TypeD
Context: Compiling type: Model.TypeD.TypeD
                         -&gt; Model.TypeDAction.TypeDAction
                         -&gt; Plutus.V2.Ledger.Contexts.ScriptContext
                         -&gt; GHC.Types.Bool
Context: Compiling type: Model.ColonySettings.ColonySettings
                         -&gt; Model.TypeD.TypeD
                         -&gt; Model.TypeDAction.TypeDAction
                         -&gt; Plutus.V2.Ledger.Contexts.ScriptContext
                         -&gt; GHC.Types.Bool
Context: Compiling definition of: Validators.TypeD.mkColonyValidator
Context: Compiling expr: Validators.TypeD.mkColonyValidator
Context: Compiling expr at &quot;ship-shift-0.1.0.0-inplace:Validators.TypeD:(171,8)-(171,50)&quot;
</code></pre>
<p>Running <code>cabal configure -f defer-plugin-errors</code> before building seems to work, but I get the following linker warning:</p>
<pre><code>/nix/store/jfkmqz20q8fsaqizcml86adxqyzlwllx-binutils-2.38/bin/ld: warning: type and size of dynamic symbol cardanozmapizm1zi35zi4zm8209ae821a2638d4c1d3e2b96141de65263d756436220f129fed7d2f300d13d8_CardanoziApiziSerialiseTextEnvelope_zdfIsStringTextEnvelopeDescr_closure are not defined
</code></pre>
<p>I've tried troubleshooting by commenting out lines to find the culprit to no avail.</p>
<p>Definition of <code>Model.TypeD.TypeD</code> is as follows:</p>
<pre><code>
type TypeA = (TypeB, Value)

data TypeB = A
            | B
            | C
            | D
            | E
            deriving (Show, Generic, Prelude.Eq, ToJSON, FromJSON)

PlutusTx.makeLift ''TypeB
PlutusTx.makeIsDataIndexed ''TypeB [('A, 0), ('B, 1), ('C, 2), ('D, 3), ('E, 4)]

data TypeC = TypeC
    { y :: !Rational
    , z :: !Address
    } deriving (Prelude.Show, Generic, Prelude.Eq, ToJSON, FromJSON)

PlutusTx.makeLift ''TypeC
PlutusTx.unstableMakeIsData ''TypeC

data TypeD = TypeD
    { 
      a  :: !BuiltinByteString
    , b  :: ![PaymentPubKeyHash]
    , c  :: !Integer
    , d  :: ![TypeB]
    , e  :: ![TypeA]
    , f  :: !(Maybe TypeC)
    } deriving (Prelude.Show, Generic, Prelude.Eq, ToJSON, FromJSON)
    
PlutusTx.makeLift ''TypeD
PlutusTx.unstableMakeIsData ''TypeD

</code></pre>

<plutus>
E042:Error: Unsupported feature: Type constructor: GHC.Prim.Addr
# E042:Error: Unsupported feature: Type constructor: GHC.Prim.Addr

(Asked by: username_0 on 2022-12-16)

Has anyone encountered such an issue?

Validator works fine and cborHex is generated when "`writeSerialisedScript`" run in cabal's repl. But when building with `cabal build app`, the following error is thrown:

```
GHC Core to PLC plugin: E042:Error: Unsupported feature: Type constructor: GHC.Prim.Addr#
Context: Compiling type: GHC.Prim.Addr#
Context: Compiling data constructor type: Data.ByteString.Internal.PS
Context: Compiling type: Data.ByteString.Internal.ByteString
Context: Compiling data constructor type: Model.TypeD.TypeD
Context: Compiling type: Model.TypeD.TypeD
Context: Compiling type: Model.TypeD.TypeD
                         -> Model.TypeDAction.TypeDAction
                         -> Plutus.V2.Ledger.Contexts.ScriptContext
                         -> GHC.Types.Bool
Context: Compiling type: Model.ColonySettings.ColonySettings
                         -> Model.TypeD.TypeD
                         -> Model.TypeDAction.TypeDAction
                         -> Plutus.V2.Ledger.Contexts.ScriptContext
                         -> GHC.Types.Bool
Context: Compiling definition of: Validators.TypeD.mkColonyValidator
Context: Compiling expr: Validators.TypeD.mkColonyValidator
Context: Compiling expr at "ship-shift-0.1.0.0-inplace:Validators.TypeD:(171,8)-(171,50)"

```

Running `cabal configure -f defer-plugin-errors` before building seems to work, but I get the following linker warning:

```
/nix/store/jfkmqz20q8fsaqizcml86adxqyzlwllx-binutils-2.38/bin/ld: warning: type and size of dynamic symbol cardanozmapizm1zi35zi4zm8209ae821a2638d4c1d3e2b96141de65263d756436220f129fed7d2f300d13d8_CardanoziApiziSerialiseTextEnvelope_zdfIsStringTextEnvelopeDescr_closure are not defined

```

I've tried troubleshooting by commenting out lines to find the culprit to no avail.

Definition of `Model.TypeD.TypeD` is as follows:

```

type TypeA = (TypeB, Value)

data TypeB = A
            | B
            | C
            | D
            | E
            deriving (Show, Generic, Prelude.Eq, ToJSON, FromJSON)

PlutusTx.makeLift ''TypeB
PlutusTx.makeIsDataIndexed ''TypeB [('A, 0), ('B, 1), ('C, 2), ('D, 3), ('E, 4)]

data TypeC = TypeC
    { y :: !Rational
    , z :: !Address
    } deriving (Prelude.Show, Generic, Prelude.Eq, ToJSON, FromJSON)

PlutusTx.makeLift ''TypeC
PlutusTx.unstableMakeIsData ''TypeC

data TypeD = TypeD
    { 
      a  :: !BuiltinByteString
    , b  :: ![PaymentPubKeyHash]
    , c  :: !Integer
    , d  :: ![TypeB]
    , e  :: ![TypeA]
    , f  :: !(Maybe TypeC)
    } deriving (Prelude.Show, Generic, Prelude.Eq, ToJSON, FromJSON)
    
PlutusTx.makeLift ''TypeD
PlutusTx.unstableMakeIsData ''TypeD

```

**Tags:** plutus


---

## 1 answers

### Answer by username_1 on 2023-02-23. Score: 0

I have had similar issues.
I don't understand the Core to PLC plugin enough to explain why this happens, but I am fairly sure this is related to using types on-chain that have a *strict* field of type `BuiltinByteString`.

So removing the `!` in front of field `a` in `TypeD` should avoid running into this error.


---

