Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » The type of the expression must be union or anytype(Issue found while building the 3gpp conformance code in ttcn.)
The type of the expression must be union or anytype [message #1833480] Wed, 14 October 2020 13:05 Go to next message
Gajula Lalithaditya is currently offline Gajula LalithadityaFriend
Messages: 12
Registered: October 2020
Junior Member
Hi
I am having errors while testing the 5g nr test cases.
ERROR : The type of the expression must be union or anytype,
Actually the CHOICE is defined in the asn, and it is imported as a union in the ttcn 3 module in a ttcn file.
Can you give a solution to solve the error ?
Re: The type of the expression must be union or anytype [message #1833518 is a reply to message #1833480] Thu, 15 October 2020 13:31 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Gajula,

can you add the concrete example here? This is pretty thin for a bug report.



Re: The type of the expression must be union or anytype [message #1833545 is a reply to message #1833480] Fri, 16 October 2020 11:38 Go to previous messageGo to next message
Gajula Lalithaditya is currently offline Gajula LalithadityaFriend
Messages: 12
Registered: October 2020
Junior Member
Hi ,
The example scenario is as follows.

$ function fl_NR_ConvertN(PCCH_Config.nAndPagingFrameOffset p_NAndPagingFrameOffset) return integer
  {
    var integer v_N;
    select union (p_NAndPagingFrameOffset){
      case(oneT)          { v_N := 1; }
      case(halfT)         { v_N := 2; }
      case(quarterT)      { v_N := 4; }
      case(oneEighthT)    { v_N := 8; }
      case(oneSixteenthT) { v_N := 16; }
    } 
    return v_N;
  }


The above union is imported from the following ASN.1 module ( import from NR_RRC_ASN1_Definitions language "ASN.1:2002" all with {encode "UNALIGNED_PER_OctetAligned"};) and it is as follows.
 $  PCCH-Config ::=             SEQUENCE {
    defaultPagingCycle                  PagingCycle,
    nAndPagingFrameOffset               CHOICE {
        oneT                                NULL,
        halfT                               INTEGER (0..1),
        quarterT                            INTEGER (0..3),
        oneEighthT                          INTEGER (0..7),
        oneSixteenthT                       INTEGER (0..15)
    },


When I am building this code, I am getting the error "The type of expression must be union or anytype".
Can you please let me know how to solve the issue.
Re: The type of the expression must be union or anytype [message #1833553 is a reply to message #1833545] Fri, 16 October 2020 16:04 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Gajula,

which compiler version you are using ? (compiler -v)
For me, it builds with 7.1.1 with no error indication.


Best regards
Elemer



Re: The type of the expression must be union or anytype [message #1833572 is a reply to message #1833553] Mon, 19 October 2020 05:34 Go to previous messageGo to next message
Gajula Lalithaditya is currently offline Gajula LalithadityaFriend
Messages: 12
Registered: October 2020
Junior Member
Hi Elemer,
The compiler version that i am using is GCC 7.4.0

Best regards
Lalithaditya Naidu
Re: The type of the expression must be union or anytype [message #1833575 is a reply to message #1833572] Mon, 19 October 2020 06:07 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Gajula,

No, I was referring to the Titan compiler version,
that is displayed when you enter "compiler -v".


Re: The type of the expression must be union or anytype [message #1833579 is a reply to message #1833575] Mon, 19 October 2020 06:25 Go to previous messageGo to next message
Gajula Lalithaditya is currently offline Gajula LalithadityaFriend
Messages: 12
Registered: October 2020
Junior Member
Hi Elemer,
I have done the same to check the complier version using compiler -v.
The screen shot is attached below.

Best regards
Lalithaditya Naidu
Re: The type of the expression must be union or anytype [message #1833581 is a reply to message #1833579] Mon, 19 October 2020 06:32 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Gajula,

Yes, you have version /6 R3B,
That is 6.3.1;

Please download and try a newer version;
Binaries are available for 7.1.0 on the Eclipse download
site.

BR

Elemer

Re: The type of the expression must be union or anytype [message #1833591 is a reply to message #1833581] Mon, 19 October 2020 09:23 Go to previous messageGo to next message
Gajula Lalithaditya is currently offline Gajula LalithadityaFriend
Messages: 12
Registered: October 2020
Junior Member
Hi Elemer
I Downloaded and added the 7. 1 version in the titan preferences, Then the version of compiler is CRL 113 200/7 R1A.
But, when i checked the complier -v in the terminal it still shows the same in 6.3.1.

Best Regards
Lalithaditya Naidu

[Updated on: Mon, 19 October 2020 09:42]

Report message to a moderator

Re: The type of the expression must be union or anytype [message #1833596 is a reply to message #1833591] Mon, 19 October 2020 13:22 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Gajula,

Please set the environment variables (TTCN3_DIR, PATH, LD_LIBRARY_PATH)
according to your new installation.

BR
Elemer
Re: The type of the expression must be union or anytype [message #1833674 is a reply to message #1833596] Wed, 21 October 2020 05:58 Go to previous messageGo to next message
Gajula Lalithaditya is currently offline Gajula LalithadityaFriend
Messages: 12
Registered: October 2020
Junior Member
Hi Elemer,

I already added the environment variables in the bashrc file.

export TTCN3_DIR='/home/lalith/Downloads/ttcn3-7.1.pl0-linux64-gcc7-ubuntu_18.04.3_lts_foss'

export PATH=$PATH:$TTCN3_DIR/bin

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TTCN3_DIR/lib

But still showing compiler version 6.3.1 .

Best Regards
Lalithaditya

[Updated on: Wed, 21 October 2020 06:00]

Report message to a moderator

Re: The type of the expression must be union or anytype [message #1833679 is a reply to message #1833674] Wed, 21 October 2020 09:12 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Gajula,

What does printenv say?
Re: The type of the expression must be union or anytype [message #1833681 is a reply to message #1833679] Wed, 21 October 2020 11:29 Go to previous messageGo to next message
Gajula Lalithaditya is currently offline Gajula LalithadityaFriend
Messages: 12
Registered: October 2020
Junior Member
Hi Elemer,
I found this from printenv

LD_LIBRARY_PATH=:/home/lalith/Downloads/ttcn3-7.1.pl0-linux64-gcc7-ubuntu_18.04.3_lts_foss/lib
TTCN3_DIR=/home/lalith/Downloads/ttcn3-7.1.pl0-linux64-gcc7-ubuntu_18.04.3_lts_foss
PATH=/home/lalith/bin:/home/lalith/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/lalith/Downloads/ttcn3-7.1.pl0-linux64-gcc7-ubuntu_18.04.3_lts_foss/bin

Best regards
Lalithaditya
Re: The type of the expression must be union or anytype [message #1833687 is a reply to message #1833681] Wed, 21 October 2020 14:15 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Gajula,

try adding the paths at the head, not the tail:

export TTCN3_DIR=/home/lalith/Downloads/ttcn3-7.1.pl0-linux64-gcc7-ubuntu_18.04.3_lts_foss
export PATH=$TTCN3_DIR/bin:$PATH
export LD_LIBRARY_PATH=$TTCN3_DIR/lib:$LD_LIBRARY_PATH

so they are found before any other path;

do these settings in a shell first, and see if they work;

"which compiler" should point to
/home/lalith/Downloads/ttcn3-7.1.pl0-linux64-gcc7-ubuntu_18.04.3_lts_foss/bin/compiler

and the command "compiler" should be answered accordingly.

If it works in a shell, you can add it to .bashrc


BR

Elemer
Re: The type of the expression must be union or anytype [message #1833754 is a reply to message #1833687] Fri, 23 October 2020 10:15 Go to previous messageGo to next message
Gajula Lalithaditya is currently offline Gajula LalithadityaFriend
Messages: 12
Registered: October 2020
Junior Member
Hi Elemer

I Exported the TTCN3_DIR,PATH ,and LD_LIBRARY_PATH in the shell the compiler version changed and the compiler -v says
TTCN-3 and ASN.1 Compiler for the TTCN-3 Test Executor Product number: CRL 113 200/7 R1A Version: 7.1.pl0 .

and also the compiler in "ttcn3-7.1.pl0-linux64-gcc7-ubuntu_18.04.3_lts_foss/bin/compiler " answers the same.

So, i added the paths to .bashrc file.

But still the error of "The type of the expression must be union or anytype" is not solved.

Thanks and Regards
Lalithaditya

[Updated on: Fri, 23 October 2020 10:15]

Report message to a moderator

Re: The type of the expression must be union or anytype [message #1833767 is a reply to message #1833754] Fri, 23 October 2020 14:57 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Gajula,


I have attached a project archive, that you have to unpack and compile with the
attached Makefile.


Please compile it and let me know the result.


BR
Elemer
Re: The type of the expression must be union or anytype [message #1833772 is a reply to message #1833767] Fri, 23 October 2020 15:35 Go to previous messageGo to next message
Gajula Lalithaditya is currently offline Gajula LalithadityaFriend
Messages: 12
Registered: October 2020
Junior Member
Hi Elemer

I built the project you shared, and found the same issue "The type of the expression must be union or anytype" and also the error "the version of gcc doesnot match the expected version (GCC 7.4.0)".

Thanks and Regards
Lalithaditya
Re: The type of the expression must be union or anytype [message #1833774 is a reply to message #1833772] Fri, 23 October 2020 15:52 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Gajula,

OK,

in this case please clone the source code for 7.1.1 form github (https://github.com/eclipse/titan.core)
and compile from source according to the instructions in README.linux.
After that, please build again the project I have uploaded.

BR
Elemer
Re: The type of the expression must be union or anytype [message #1833863 is a reply to message #1833774] Mon, 26 October 2020 15:05 Go to previous messageGo to next message
Gajula Lalithaditya is currently offline Gajula LalithadityaFriend
Messages: 12
Registered: October 2020
Junior Member
Hi Elemer
I have downloaded 7.1.1 from github and installed it as per the instructions.
The GCC is upgraded to 7.5.0 and the compiler -v also changed to 7.1.1 ( CRL 113 200/7 R1B, 7.1.pl1 ).
But the problem ,The type of the expression must be union or anytype is still present.

Thanks and regards
Lalithaditya
Re: The type of the expression must be union or anytype [message #1833867 is a reply to message #1833863] Mon, 26 October 2020 16:08 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Gajula,

please try to compile the minimalistic example I have uploaded earlier and let me know the result.

If you have compiled it earlier with a different compiler, don't forget to run "make clean"

BR

Elemer

[Updated on: Mon, 26 October 2020 16:09]

Report message to a moderator

Re: The type of the expression must be union or anytype [message #1833873 is a reply to message #1833867] Mon, 26 October 2020 16:52 Go to previous messageGo to next message
Gajula Lalithaditya is currently offline Gajula LalithadityaFriend
Messages: 12
Registered: October 2020
Junior Member
Hi Elemer
I already tried to compile the example you shared and also cleaned the example before building it, but the error is not solved.

Best Regards
Lalithaditya
Re: The type of the expression must be union or anytype [message #1833877 is a reply to message #1833873] Mon, 26 October 2020 18:04 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Gajula,

I'm sorry , but I can't figure out what you are doing wrong and you are not exactly forthcoming.

So I'm not sure how to proceed.

BR

Elemer

Re: The type of the expression must be union or anytype [message #1833880 is a reply to message #1833877] Mon, 26 October 2020 19:27 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
HI Gajula,

here's my console log for 7.1.1:

 ll
total 372
drwxrwxrwx 1 userid userid   4096 Oct 26 19:42 ./
drwxr-xr-x 1 userid userid   4096 Oct 19 17:59 ../
-rw-rw-rw- 1 userid userid   5005 Oct 16 15:52 Makefile
-rw-rw-rw- 1 userid userid    479 Oct 16 15:52 NR.ttcn
-rw-rw-rw- 1 userid userid 371804 Jun 29 12:53 NR_RRC_ASN1_Definitions.asn
drwxrwxrwx 1 userid userid   4096 Oct 16 17:46 backup/


 which compiler
/home/userid/titan.core/Install/bin/compiler
userid@HU-00001378:~/Union$ compiler -v
TTCN-3 and ASN.1 Compiler for the TTCN-3 Test Executor
Product number: CRL 113 200/7 R1B
Version: 7.1.pl1
Build date: Sep 25 2020 10:05:41
Compiled with: GCC 9.3.0
Using OpenSSL 1.1.1f  31 Mar 2020

Copyright (c) 2000-2020 Ericsson Telecom AB


 make
/home/userid/titan.core/Install/bin/compiler -L  \
NR.ttcn NR_RRC_ASN1_Definitions.asn - NR.ttcn NR_RRC_ASN1_Definitions.asn
Notify: Parsing TTCN-3 module `NR.ttcn'...
Notify: Parsing ASN.1 module `NR_RRC_ASN1_Definitions.asn'...
NR_RRC_ASN1_Definitions.asn:9: warning: Missing IMPORTS clause is interpreted as `IMPORTS ;' (import nothing) instead of importing all symbols from all modules.
Notify: Checking modules...
Notify: Generating code...
Notify: File `NR.hh' was generated.
Notify: File `NR.cc' was generated.
Notify: File `NR_RRC_ASN1_Definitions.hh' was generated.
Notify: File `NR_RRC_ASN1_Definitions.cc' was generated.
Notify: 4 files were updated.
touch compile
g++  -c -DLINUX -I/home/userid/titan.core/Install/include -Wall   -o NR.o NR.cc
g++  -c -DLINUX -I/home/userid/titan.core/Install/include -Wall   -o NR_RRC_ASN1_Definitions.o NR_RRC_ASN1_Definitions.cc
NR_RRC_ASN1_Definitions.cc: In copy constructor 'NR__RRC__ASN1__Definitions::MeasObjectNR_blackCellsToAddModList::MeasObjectNR_blackCellsToAddModList(const NR__RRC__ASN1__Definitions::MeasObjectNR_blackCellsToAddModList&)':
NR_RRC_ASN1_Definitions.cc:395121: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers
395121 | val_ptr = other_value.val_ptr;
       |

if g++   -o NR NR.o NR_RRC_ASN1_Definitions.o  \
-L/home/userid/titan.core/Install/lib -lttcn3-parallel \
-L/lib -lcrypto \
-L/home/userid/titan.core/Install/lib -lxml2; \
then : ; else /home/userid/titan.core/Install/bin/titanver NR.o NR_RRC_ASN1_Definitions.o ; exit 1; fi

ll
total 521776
drwxrwxrwx 1 userid userid      4096 Oct 26 19:50 ./
drwxr-xr-x 1 userid userid      4096 Oct 19 17:59 ../
-rw-rw-rw- 1 userid userid      5005 Oct 16 15:52 Makefile
-rwxrwxrwx 1 userid userid  93052600 Oct 26 19:50 NR*
-rw-rw-rw- 1 userid userid      2927 Oct 26 19:43 NR.cc
-rw-rw-rw- 1 userid userid      1135 Oct 26 19:43 NR.hh
-rw-rw-rw- 1 userid userid      8328 Oct 26 19:43 NR.o
-rw-rw-rw- 1 userid userid       479 Oct 16 15:52 NR.ttcn
-rw-rw-rw- 1 userid userid    371804 Jun 29 12:53 NR_RRC_ASN1_Definitions.asn
-rw-rw-rw- 1 userid userid  90739980 Oct 26 19:43 NR_RRC_ASN1_Definitions.cc
-rw-rw-rw- 1 userid userid  13247831 Oct 26 19:43 NR_RRC_ASN1_Definitions.hh
-rw-rw-rw- 1 userid userid 143673064 Oct 26 19:50 NR_RRC_ASN1_Definitions.o
drwxrwxrwx 1 userid userid      4096 Oct 16 17:46 backup/
-rw-rw-rw- 1 userid userid         0 Oct 26 19:43 compile



I have also tried 7.1.0 and 6.6.0 and those work as well.


So I suggest you remove every Titan install form your machine and start from scratch with 7.1.1.
I suspect you are somehow still engaging 6.3.1 which gives you the same error again and again.


BR

Elemer

Re: The type of the expression must be union or anytype [message #1834027 is a reply to message #1833880] Fri, 30 October 2020 13:27 Go to previous messageGo to next message
Gajula Lalithaditya is currently offline Gajula LalithadityaFriend
Messages: 12
Registered: October 2020
Junior Member
Hi Elemer

I completely removed the compiler version 6.3.1 ,The results of the compiler and make for the sample code you shared is attached below.
I still find the error in the eclipse when i open the project.

Best Regards
Lalithaditya
Re: The type of the expression must be union or anytype [message #1834039 is a reply to message #1834027] Fri, 30 October 2020 16:44 Go to previous message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Gajula,

OK, it's the first time I hear about the Eclipse plug-ins being involved; so far you led me believe that you are working with the compiler on command line only.

So here's the situation: the Eclipse plug-ins can be used in a number of modes, but let's focus on one mode only,
namely them playing the role of an IDE as a front-end to the TTCN-3 compiler and executor (a.k.a. "compiler").

Now the compiler and the Eclipse part have independent syntactical/semantical analyses; so even of the Eclipse plug-in indicates
an error, that has no influence over the compiler. Which means you should simply disregard the error indication; it will have no effect
on the build performed by the compiler.

Of course , the compiler can be used in complete stand-alone mode, without the IDE (possibly paired with an editor that supports TTCN-3),
and many users prefer this mode.

(BTW, the error has been fixed in the latest version of the plug-ins that will be available soon; but this should not influence what you are doing).

However, there are other things that should be considered:
it appears that you are trying to compile and probably execute a test suite from 3gpp.
These test suites are only complete from TTCN-3 point of view, meaning that they are missing the parts which are non-standard and implementation specific;
As I have discussed this in several earlier posts, these parts are: codecs, test ports and external functions.
If you want to have an executable , you will have to add these yourself to your project.
Again, details have been discussed in afore-mentioned earlier posts.

Now, adding these will require an in-depth knowledge of several areas, including C/C++ programming.
So if you want to continue, please evaluate if you have sufficient resources to drive your project to conclusion.

Best regards

Elemer









Previous Topic:Changes in shipping of Editline library with Titan
Next Topic:DNS Example from book
Goto Forum:
  


Current Time: Sat Dec 21 16:50:26 GMT 2024

Powered by FUDForum. Page generated in 0.06542 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top