Compiling companion specification nodset fails

68 views
Skip to first unread message

Lars Klint

unread,
Apr 19, 2023, 3:36:45 AM4/19/23
to open62541

I am trying to compile the nodeset for the OPC 40451-1: Tightening Systems companion specification. I am guessing it is failing because of an internal type dependency issue that I do not know how to handle.

Do I need to somehow indicate that the .bsd file of the tightening-nodeset contain types that depend on types from the same file? Or am I misunderstanding the error message from the nodeset compiler? (see build output).

I will be grateful for any help or just a nod in the right direction.

/Lars


Namespaces:

CmakeLists.txt:

cmake_minimum_required(VERSION 3.2)
project(TightenSystem VERSION 0.1.0)

find_package(open62541 1.3 REQUIRED COMPONENTS FullNamespace)

set(GENERATE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/src_generated/")
file(MAKE_DIRECTORY "${GENERATE_OUTPUT_DIR}")
include_directories("${GENERATE_OUTPUT_DIR}")

# Generate types and namespace for DI
ua_generate_nodeset_and_datatypes(
NAME "di"
FILE_CSV "${PROJECT_SOURCE_DIR}/nodeset/DI/Opc.Ua.Di.NodeIds.csv"
FILE_BSD "${PROJECT_SOURCE_DIR}/nodeset/DI/Opc.Ua.Di.Types.bsd"
FILE_NS "${PROJECT_SOURCE_DIR}/nodeset/DI/Opc.Ua.Di.NodeSet2.xml"
INTERNAL
)

# Generate types and namespace for Machinery
ua_generate_nodeset_and_datatypes(
NAME "machinery"
FILE_NS "${PROJECT_SOURCE_DIR}/nodeset/Machinery/Opc.Ua.Machinery.NodeSet2.xml"
DEPENDS "di"
)

# Generate types and namespace for Tightening
ua_generate_nodeset_and_datatypes(
NAME "tightening"
FILE_CSV "${PROJECT_SOURCE_DIR}/nodeset/IJT/Tightening/NodeIds.csv"
FILE_BSD "${PROJECT_SOURCE_DIR}/nodeset/IJT/Tightening/Opc.Ua.Ijt.Tightening.NodeSet2.bsd"
FILE_NS "${PROJECT_SOURCE_DIR}/nodeset/IJT/Tightening/Opc.Ua.Ijt.Tightening.NodeSet2.xml"
DEPENDS "machinery" "di"
INTERNAL
)

add_executable(${PROJECT_NAME}
${UA_NODESET_DI_SOURCES}
${UA_TYPES_DI_SOURCES}
${UA_NODESET_MACHINERY_SOURCES}
${UA_NODESET_TIGHTENING_SOURCES}
${UA_TYPES_TIGHTENING_SOURCES}
main.c)

target_link_libraries(${PROJECT_NAME} open62541::open62541)


Build output:
[main] Building folder: tighten_system
[main] The folder containing the CMake cache is missing. The cache will be regenerated.
[main] Configuring project: tighten_system
[proc] Executing command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -S/home/lars/playground/tighten_system -B/home/lars/playground/tighten_system/build -G "Unix Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is GNU 9.4.0
[cmake] -- The CXX compiler identification is GNU 9.4.0
[cmake] -- Check for working C compiler: /usr/bin/cc
[cmake] -- Check for working C compiler: /usr/bin/cc -- works
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Check for working CXX compiler: /usr/bin/c++
[cmake] -- Check for working CXX compiler: /usr/bin/c++ -- works
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Found PythonInterp: /usr/bin/python (found version "3.9.5")
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: /home/lars/playground/tighten_system/build
[build] Starting build
[proc] Executing command: /usr/bin/cmake --build /home/lars/playground/tighten_system/build --config Debug --target all -j 10 --
[build] [ 16%] Generating src_generated/open62541/types_tightening_generated.c, src_generated/open62541/types_tightening_generated.h, src_generated/open62541/types_tightening_generated_handling.h
[build] [ 16%] Generating src_generated/open62541/namespace_machinery_generated.c, src_generated/open62541/namespace_machinery_generated.h
[build] [ 25%] Generating src_generated/open62541/namespace_tightening_generated.c, src_generated/open62541/namespace_tightening_generated.h
[build] [ 33%] Generating src_generated/open62541/namespace_di_generated.c, src_generated/open62541/namespace_di_generated.h
[build] [ 41%] Generating src_generated/open62541/types_di_generated.c, src_generated/open62541/types_di_generated.h, src_generated/open62541/types_di_generated_handling.h
[build] Traceback (most recent call last):
[build] File "/usr/local/share/open62541/tools/generate_datatypes.py", line 95, in <module>
[build] parser.create_types()
[build] File "/usr/local/share/open62541/tools/nodeset_compiler/type_parser.py", line 384, in create_types
[build] self.parse_types()
[build] File "/usr/local/share/open62541/tools/nodeset_compiler/type_parser.py", line 426, in parse_types
[build] self.parseTypeDefinitions(self.outname, f)
[build] File "/usr/local/share/open62541/tools/nodeset_compiler/type_parser.py", line 328, in parseTypeDefinitions
[build] raise RuntimeError("Infinite loop detected or type not found while processing types " +
[build] RuntimeError: Infinite loop detected or type not found while processing types TighteningTraceDataType: unknonwn subtype ['tns:StepTraceDataType']. If the unknown subtype is 'Bit', then maybe a struct with optional fields is defined wrong in the .bsd-file. If not, maybe you need to import additional types with the --import flag. E.g. '--import=UA_TYPES#/path/to/deps/ua-nodeset/Schema/Opc.Ua.Types.bsd'
[build] make[2]: *** [CMakeFiles/TightenSystem.dir/build.make:128: src_generated/open62541/types_tightening_generated.c] Error 1
[build] make[2]: *** Waiting for unfinished jobs....
[build] INFO:__main__:Preprocessing (existing) /usr/local/share/open62541/tools/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml
[build] INFO:__main__:Preprocessing (existing) /usr/local/share/open62541/tools/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml
[build] INFO:__main__:Preprocessing (existing) /usr/local/share/open62541/tools/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml
[build] INFO:__main__:Preprocessing /home/lars/playground/tighten_system/nodeset/DI/Opc.Ua.Di.NodeSet2.xml
[build] INFO:__main__:Preprocessing (existing) /home/lars/playground/tighten_system/nodeset/DI/Opc.Ua.Di.NodeSet2.xml
[build] INFO:__main__:Preprocessing (existing) /home/lars/playground/tighten_system/nodeset/DI/Opc.Ua.Di.NodeSet2.xml
[build] INFO:__main__:Preprocessing /home/lars/playground/tighten_system/nodeset/Machinery/Opc.Ua.Machinery.NodeSet2.xml
[build] INFO:__main__:Preprocessing (existing) /home/lars/playground/tighten_system/nodeset/Machinery/Opc.Ua.Machinery.NodeSet2.xml
[build] INFO:__main__:Skipping Nodeset since it is already loaded: /usr/local/share/open62541/tools/ua-nodeset/Schema/Opc.Ua.NodeSet2.xml
[build] INFO:__main__:Skipping Nodeset since it is already loaded: /home/lars/playground/tighten_system/nodeset/DI/Opc.Ua.Di.NodeSet2.xml
[build] INFO:__main__:Preprocessing /home/lars/playground/tighten_system/nodeset/IJT/Tightening/Opc.Ua.Ijt.Tightening.NodeSet2.xml
[build] INFO:__main__:Generating Code for Backend: open62541
[build] INFO:__main__:Generating Code for Backend: open62541
[build] INFO:__main__:NodeSet generation code successfully printed
[build] INFO:__main__:NodeSet generation code successfully printed
[build] INFO:__main__:Generating Code for Backend: open62541
[build] INFO:__main__:NodeSet generation code successfully printed
[build] make[1]: *** [CMakeFiles/Makefile2:112: CMakeFiles/TightenSystem.dir/all] Error 2
[build] make: *** [Makefile:84: all] Error 2
[proc] The command: /usr/bin/cmake --build /home/lars/playground/tighten_system/build --config Debug --target all -j 10 -- exited with code: 2
[build] Build finished with exit code 2



CMakeLists.txt
nodeset_files.zip

Lars Klint

unread,
Apr 21, 2023, 9:42:04 AM4/21/23
to open62541
I have managed loading the nodeset at runtime with the nodesetLoader. I am not sure what the intended use of this functionality is - it seems hard to set up callbacks for methods, or even write nodes if the server is unaware of the information model at compile time?
Has anyone managed to compile the nodeset for the OPC 40451-1: Tightening Systems companion specification with the nodeset compiler at all?

Twoshrubs

unread,
May 11, 2023, 8:52:06 AM5/11/23
to open62541
Hello Lars,

I haven't used that companion specification but I have used a different one.
I did the manual method of compiling the nodeset to c code rather than the cmake method (I couldn't quickly figure it out and was in a rush).

The way I did it..
So with the generated companion C code.. load this into your server. Now your model is in the server.
So for each objectType in your spec create a class and that class creates the nodes which reference back to the model and also has your functions for call backs.
Then create instances of the classes as required.

This method works fine for me, no issues with CTT testing apart from one object which uses custom datatypes.. since its an object that doesn't do anything I'm not worried so much, its something to look at when I'm quite.
Reply all
Reply to author
Forward
0 new messages