Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » ttcn3_makefilegen with TPD files for hello world project
ttcn3_makefilegen with TPD files for hello world project [message #1848046] Thu, 18 November 2021 12:19 Go to next message
David Rupprecht is currently offline David RupprechtFriend
Messages: 5
Registered: November 2020
Junior Member
Dear community,

I was able to compile and run the hello_world project (https://gitlab.eclipse.org/eclipse/titan/titan.core/-/tree/master/hello) with installed version of titan. For that I used the following command:

 ttcn3_makefilegen -l -f *.ttcn *.c* -e myExample  && make 


For the reasons of not having all compiled cc and binary files in the same folder as the source, I thought about using a tpd file for generating the makefile which allows to push all generated files go to bin/. The current folder structure looks like that:

├── hello_world.tpd
├── MyExample2.cfg
├── MyExample.cfg
├── README.md
└── src
    ├── hello_world.ttcn
    ├── MyExample.ttcn
    ├── PCOType.cc
    └── PCOType.hh 


The current tpd file looks like the following:

<?xml version="1.0" encoding="UTF-8"?>
<TITAN_Project_File_Information version="1.0">
  <ProjectName>Hello_world</ProjectName>
  <Folders>
    <FolderResource projectRelativePath="src" relativeURI="src"/>
  </Folders>
  <Files>
    <FileResource projectRelativePath="src/PCOType.cc" relativeURI="src/PCOType.cc"/>
    <FileResource projectRelativePath="src/PCOType.hh" relativeURI="src/PCOType.hh"/>
    <FileResource projectRelativePath="src/hello_world.ttcn" relativeURI="src/hello_world.ttcn"/>
    <FileResource projectRelativePath="src/MyExample.ttcn" relativeURI="src/MyExample.ttcn"/>
  </Files>
  <ActiveConfiguration>Default</ActiveConfiguration>
  <Configurations>
    <Configuration name="Default">
      <ProjectProperties>
        <MakefileSettings>
          <generateInternalMakefile>true</generateInternalMakefile>
          <GNUMake>true</GNUMake>
          <incrementalDependencyRefresh>true</incrementalDependencyRefresh>
          <targetExecutable>bin/MyExample</targetExecutable>
        </MakefileSettings>
        <LocalBuildSettings>
          <workingDirectory>bin</workingDirectory>
        </LocalBuildSettings>
      </ProjectProperties>
    </Configuration>
  </Configurations>
</TITAN_Project_File_Information>


However, when I generate the makefile with
ttcn3_makefilegen -f -l -d -t hello_world.tpd 
I'm not successful as ttcn3_makefilegen does not find the ttcn models in the tpd files. See the following output:

ttcn3_makefilegen -f -l -d -t hello_world.tpd 
TPD file `hello_world.tpd' validated successfully with schema file `/usr/local/TTCNv3/etc/xsd/TPD.xsd'
Working directory `bin' in project `/home/dr/ttcn3_projects/hello' does not exist, trying to create it...
Working directory created
ttcn3_makefilegen: warning: No source files were given for the Makefile
Data used for Makefile generation:
  TTCN-3 project name: Hello_world
  TTCN-3 modules: (0 pcs.)
  TTCN-3 preprocessing: no
  All local TTCN-3 modules follow the naming convention: yes
  ASN.1 modules: (0 pcs.)
  All local ASN.1 modules follow the naming convention: yes
  User C/C++ modules: (0 pcs.)
  All local C/C++ header files follow the naming convention: yes
  All local C/C++ source files follow the naming convention: yes
  Other files: (1 pcs.)
    File name: Makefile
  Use pre-compiled files from central storage: no
  Working directory: /home/dr/ttcn3_projects/hello/bin
  GNU make: yes
  Execution mode: parallel
  Name of executable: MyExample
  Output file: Makefile
  Force overwrite: yes
  Use function test runtime: no
  Use dynamic linking: yes
  Code splitting mode: <unknown>
  Code coverage file: <unknown>
Generating Makefile skeleton...
Makefile skeleton was generated.


Question/ Issue: How do I flag the ttcn modules correctly in the tpd file? Is there any other good way to avoid generating cc and binaries to the same folder than the source, particularity when projects grow?

Thanks for your help,
David
Re: ttcn3_makefilegen with TPD files for hello world project [message #1848088 is a reply to message #1848046] Fri, 19 November 2021 12:11 Go to previous messageGo to next message
Gábor Szalai is currently offline Gábor SzalaiFriend
Messages: 133
Registered: December 2015
Senior Member
Your folder structure and tpd files looks OK and should work.

I tried to reproduce the issue, but it works for me:

ttcn3_makefilegen -f -l -d -t hello_world.tpd
TPD file `hello_world.tpd' validated successfully with schema file `/home/ethgasz/TTCNv3/etc/xsd/TPD.xsd'
Working directory `bin' in project `/mnt/c/Users/ethgasz/Downloads/tpd' does not exist, trying to create it...
Working directory created
Data used for Makefile generation:
  TTCN-3 project name: Hello_world
  TTCN-3 modules: (2 pcs.)
    Module name: MyExample
      File name: MyExample.ttcn
      Follows the naming convention: yes
    Module name: hello_world
      File name: hello_world.ttcn
      Follows the naming convention: yes
  TTCN-3 preprocessing: no
  All local TTCN-3 modules follow the naming convention: yes
  ASN.1 modules: (0 pcs.)
  All local ASN.1 modules follow the naming convention: yes
  User C/C++ modules: (1 pcs.)
    File prefix: PCOType
      Header file: PCOType.hh
      Header file has .hh or .hpp suffix: yes
      Source file: PCOType.cc
      Source file has .cc or .cpp suffix: yes
      Object file: PCOType.o
  All local C/C++ header files follow the naming convention: yes
  All local C/C++ source files follow the naming convention: yes
  Other files: (1 pcs.)
    File name: Makefile
  Use pre-compiled files from central storage: no
  Working directory: /mnt/c/Users/ethgasz/Downloads/tpd/bin
  GNU make: yes
  Execution mode: parallel
  Name of executable: MyExample
  Output file: Makefile
  Force overwrite: yes
  Use function test runtime: no
  Use dynamic linking: yes
  Code splitting mode: <unknown>
  Code coverage file: <unknown>
Generating Makefile skeleton...
Makefile skeleton was generated.


The bin folder:
 ls -l
total 8
lrwxrwxrwx 1 ethgasz ethgasz   55 Nov 19 13:03 hello_world.ttcn -> /mnt/c/Users/ethgasz/Downloads/tpd/src/hello_world.ttcn
-rwxrwxrwx 1 ethgasz ethgasz 5900 Nov 19 13:03 Makefile
lrwxrwxrwx 1 ethgasz ethgasz   53 Nov 19 13:03 MyExample.ttcn -> /mnt/c/Users/ethgasz/Downloads/tpd/src/MyExample.ttcn
lrwxrwxrwx 1 ethgasz ethgasz   49 Nov 19 13:03 PCOType.cc -> /mnt/c/Users/ethgasz/Downloads/tpd/src/PCOType.cc
lrwxrwxrwx 1 ethgasz ethgasz   49 Nov 19 13:03 PCOType.hh -> /mnt/c/Users/ethgasz/Downloads/tpd/src/PCOType.hh


I attached the complete project. Please compare it with yours.
Re: ttcn3_makefilegen with TPD files for hello world project [message #1848090 is a reply to message #1848088] Fri, 19 November 2021 12:31 Go to previous messageGo to next message
David Rupprecht is currently offline David RupprechtFriend
Messages: 5
Registered: November 2020
Junior Member
Dear Gábor Szalai,

thank you for your reply. After checking your project which did also not work out, I have updated my titan version. Arg. Now everything works as expected.

Thank you,
David
Re: ttcn3_makefilegen with TPD files for hello world project [message #1848092 is a reply to message #1848088] Fri, 19 November 2021 12:43 Go to previous messageGo to next message
Adam Knapp is currently offline Adam KnappFriend
Messages: 50
Registered: November 2020
Member
Hi David,

Additionally, you can use relative paths to your sources in the ttcn3_makefilegen command, so you can separate your src and working (bin) directories. Just execute it in your bin dir.

Besides, if you would like to develop TTCN-3 code and you are able to work on GUI, I encourage you to use the Eclipse plugins of Titan, as it provides full syntax and semantic checks, as well as a transparent build flow that could simplify working with the compiler.

Install guide
User guide

[Updated on: Fri, 19 November 2021 12:43]

Report message to a moderator

Re: ttcn3_makefilegen with TPD files for hello world project [message #1848102 is a reply to message #1848092] Fri, 19 November 2021 17:03 Go to previous message
David Rupprecht is currently offline David RupprechtFriend
Messages: 5
Registered: November 2020
Junior Member
Hi Adam,

thanks for the hint, I will give it a try. Thanks for the hint :)

Best regards,
David
Previous Topic:Segmentation fault occured
Next Topic:CROSSTAG conditioned on several fields
Goto Forum:
  


Current Time: Fri Apr 26 10:23:05 GMT 2024

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

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

Back to the top