mouse07410 / asn1c

The ASN.1 Compiler
http://lionet.info/asn1c/
BSD 2-Clause "Simplified" License
101 stars 73 forks source link

Missing constraint function "asn_PER_memb_OCTET_STRING_SIZE_3__constr_48" #81

Open gatopeich opened 3 years ago

gatopeich commented 3 years ago

After compiling F1AP spec there is a reference to undefined function asn_PER_memb_OCTET_STRING_SIZE_3__constr_48 in generated file "ProtocolExtensionField.c":

image

f1ap-v15.10.asn

mouse07410 commented 3 years ago

Stupid standards writers really abuse ASN.1, making it impossible for their definitions to compile with "normal" tools.

This seems to be yet another example of that. I think the cause is circular dependency similar to #78 that you hit in XNAP. I suspect the solution would be similar too...

Maybe re-ordering the ASN.1 files that were concatenated together could help? I don't know.

Wish I could help more. But extending asn1c to handle this is beyond my skill and available time.

mouse07410 commented 3 years ago

@gatopeich I checked the generated *.[ch] files, and observed this:

$ rg asn_PER_memb_id_constr_282 *.[ch]
ProtocolExtensionField.c
12103:static asn_per_constraints_t asn_PER_memb_id_constr_282 CC_NOTUSED = {
23585:          &asn_PER_memb_id_constr_282,

ProtocolIE-Field.c
18573:static asn_per_constraints_t asn_PER_memb_id_constr_282 CC_NOTUSED = {
30409:          &asn_PER_memb_id_constr_282,

Perhaps your problem is caused by CC_NOTUSED? If CC_NOTUSED is present - perhaps you can manually remove it from the definition, and try to compile again?

Also, I tried to compile the converter-example, but apparently the order of the includes and their circular dependencies are in the way. Do you have a way past this?

$ make -f converter-example.mk
clang -O3 -std=gnu18 -march=native -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk  -DASN_PDU_COLLECTION -I. -o F1AP-PDU.o -c F1AP-PDU.c
In file included from F1AP-PDU.c:8:
In file included from ./F1AP-PDU.h:58:
In file included from ./InitiatingMessage.h:20:
In file included from ./Reset.h:15:
In file included from ./ProtocolIE-Container.h:528:
In file included from ./ProtocolIE-Field.h:23:
In file included from ./UE-associatedLogicalF1-ConnectionItem.h:48:
In file included from ./ProtocolExtensionContainer.h:1375:
In file included from ./ProtocolExtensionField.h:54:
In file included from ./CP-TransportLayerAddress.h:59:
./ProtocolIE-SingleContainer.h:22:9: error: unknown type name 'F1AP_PDU_ExtIEs_t'
typedef F1AP_PDU_ExtIEs_t        ProtocolIE_SingleContainer_4949P0_t;
        ^
./ProtocolIE-SingleContainer.h:23:9: error: unknown type name 'ResetType_ExtIEs_t'
typedef ResetType_ExtIEs_t       ProtocolIE_SingleContainer_4949P1_t;
        ^
./ProtocolIE-SingleContainer.h:24:9: error: unknown type name 'UE_associatedLogicalF1_ConnectionItemRes_t'; did you mean 'UE_associatedLogicalF1_ConnectionItem_t'?
typedef UE_associatedLogicalF1_ConnectionItemRes_t       ProtocolIE_SingleContainer_4949P2_t;
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        UE_associatedLogicalF1_ConnectionItem_t
./UE-associatedLogicalF1-ConnectionItem.h:38:3: note: 'UE_associatedLogicalF1_ConnectionItem_t' declared here
} UE_associatedLogicalF1_ConnectionItem_t;
  ^
In file included from F1AP-PDU.c:8:
In file included from ./F1AP-PDU.h:58:
In file included from ./InitiatingMessage.h:20:
In file included from ./Reset.h:15:
In file included from ./ProtocolIE-Container.h:528:
In file included from ./ProtocolIE-Field.h:23:
In file included from ./UE-associatedLogicalF1-ConnectionItem.h:48:
In file included from ./ProtocolExtensionContainer.h:1375:
In file included from ./ProtocolExtensionField.h:54:
In file included from ./CP-TransportLayerAddress.h:59:
./ProtocolIE-SingleContainer.h:25:9: error: unknown type name 'UE_associatedLogicalF1_ConnectionItemResAck_t'; did you mean 'UE_associatedLogicalF1_ConnectionItem_t'?
typedef UE_associatedLogicalF1_ConnectionItemResAck_t    ProtocolIE_SingleContainer_4949P3_t;
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        UE_associatedLogicalF1_ConnectionItem_t
./UE-associatedLogicalF1-ConnectionItem.h:38:3: note: 'UE_associatedLogicalF1_ConnectionItem_t' declared here
} UE_associatedLogicalF1_ConnectionItem_t;
  ^
In file included from F1AP-PDU.c:8:
In file included from ./F1AP-PDU.h:58:
In file included from ./InitiatingMessage.h:20:
In file included from ./Reset.h:15:
In file included from ./ProtocolIE-Container.h:528:
In file included from ./ProtocolIE-Field.h:23:
In file included from ./UE-associatedLogicalF1-ConnectionItem.h:48:
In file included from ./ProtocolExtensionContainer.h:1375:
In file included from ./ProtocolExtensionField.h:54:
In file included from ./CP-TransportLayerAddress.h:59:
./ProtocolIE-SingleContainer.h:26:9: error: unknown type name 'GNB_DU_Served_Cells_ItemIEs_t'
typedef GNB_DU_Served_Cells_ItemIEs_t    ProtocolIE_SingleContainer_4949P4_t;
        ^
./ProtocolIE-SingleContainer.h:27:9: error: unknown type name 'Cells_to_be_Activated_List_ItemIEs_t'
typedef Cells_to_be_Activated_List_ItemIEs_t     ProtocolIE_SingleContainer_4949P5_t;
        ^
./ProtocolIE-SingleContainer.h:28:9: error: unknown type name 'Served_Cells_To_Add_ItemIEs_t'
typedef Served_Cells_To_Add_ItemIEs_t    ProtocolIE_SingleContainer_4949P6_t;
        ^
./ProtocolIE-SingleContainer.h:29:9: error: unknown type name 'Served_Cells_To_Modify_ItemIEs_t'
typedef Served_Cells_To_Modify_ItemIEs_t         ProtocolIE_SingleContainer_4949P7_t;
        ^
./ProtocolIE-SingleContainer.h:30:9: error: unknown type name 'Served_Cells_To_Delete_ItemIEs_t'
typedef Served_Cells_To_Delete_ItemIEs_t         ProtocolIE_SingleContainer_4949P8_t;
        ^
./ProtocolIE-SingleContainer.h:31:9: error: unknown type name 'Cells_Status_ItemIEs_t'
typedef Cells_Status_ItemIEs_t   ProtocolIE_SingleContainer_4949P9_t;
        ^
./ProtocolIE-SingleContainer.h:32:9: error: unknown type name 'Dedicated_SIDelivery_NeededUE_ItemIEs_t'
typedef Dedicated_SIDelivery_NeededUE_ItemIEs_t  ProtocolIE_SingleContainer_4949P10_t;
        ^
./ProtocolIE-SingleContainer.h:33:9: error: unknown type name 'GNB_DU_TNL_Association_To_Remove_ItemIEs_t'
typedef GNB_DU_TNL_Association_To_Remove_ItemIEs_t       ProtocolIE_SingleContainer_4949P11_t;
        ^
./ProtocolIE-SingleContainer.h:34:9: error: unknown type name 'Cells_to_be_Deactivated_List_ItemIEs_t'
typedef Cells_to_be_Deactivated_List_ItemIEs_t   ProtocolIE_SingleContainer_4949P12_t;
        ^
./ProtocolIE-SingleContainer.h:35:9: error: unknown type name 'GNB_CU_TNL_Association_To_Add_ItemIEs_t'
typedef GNB_CU_TNL_Association_To_Add_ItemIEs_t  ProtocolIE_SingleContainer_4949P13_t;
        ^
./ProtocolIE-SingleContainer.h:36:9: error: unknown type name 'GNB_CU_TNL_Association_To_Remove_ItemIEs_t'
typedef GNB_CU_TNL_Association_To_Remove_ItemIEs_t       ProtocolIE_SingleContainer_4949P14_t;
        ^
./ProtocolIE-SingleContainer.h:37:9: error: unknown type name 'GNB_CU_TNL_Association_To_Update_ItemIEs_t'
typedef GNB_CU_TNL_Association_To_Update_ItemIEs_t       ProtocolIE_SingleContainer_4949P15_t;
        ^
./ProtocolIE-SingleContainer.h:38:9: error: unknown type name 'Cells_to_be_Barred_ItemIEs_t'
typedef Cells_to_be_Barred_ItemIEs_t     ProtocolIE_SingleContainer_4949P16_t;
        ^
./ProtocolIE-SingleContainer.h:39:9: error: unknown type name 'Protected_EUTRA_Resources_ItemIEs_t'
typedef Protected_EUTRA_Resources_ItemIEs_t      ProtocolIE_SingleContainer_4949P17_t;
        ^
./ProtocolIE-SingleContainer.h:40:9: error: unknown type name 'Cells_Failed_to_be_Activated_List_ItemIEs_t'
typedef Cells_Failed_to_be_Activated_List_ItemIEs_t      ProtocolIE_SingleContainer_4949P18_t;
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [converter-example.mk:23: F1AP-PDU.o] Error 1
$ 
gatopeich commented 3 years ago

Yep, I worked around the (apparent) circular deps by manually reordering ProtocolIE-Field file, like explained in #78 The dependencies are not really circular, but they are badly ordered when generating Protocol-XXX files.