admin管理员组

文章数量:1122846

I am trying to set up access to use WebRTC lib binding or to use JExtract, but whenever I run the tool on the webrtc/src/api/ files folder, I get an error. Yes, I have done all the points to cle.exe file globally, and other tools are there globally.

PowerShell 7.4.6
PS C:\Users\Kinsl> jextract `
-I "C:\Users\Kinsl\webrtc\src\api" -I "C:\Users\Kinsl\webrtc\src"
-I "C:\Users\Kinsl\webrtc\src\third_party" -I "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.39.33519\include"
-t africa.jopen.webrtc --output "C:\Users\Kinsl\IdeaProjects\webrtc-for-java-apps\src\main\java"
-l webrtc `
"C:\Users\Kinsl\webrtc\src\api\peer_connection_interface.h"
ERROR: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.39.33519\include\yvals_core.h:28:2: error: Error in C++ Standard Library usage"

Please can you help

Also here is the version info

PS C:\Users\Kinsl>  jextract --version
jextract 22
JDK version 22+35-2369
LibClang version clang version 13.0.0

I am trying to set up access to use WebRTC lib binding or to use JExtract, but whenever I run the tool on the webrtc/src/api/ files folder, I get an error. Yes, I have done all the points to cle.exe file globally, and other tools are there globally.

PowerShell 7.4.6
PS C:\Users\Kinsl> jextract `
-I "C:\Users\Kinsl\webrtc\src\api" -I "C:\Users\Kinsl\webrtc\src"
-I "C:\Users\Kinsl\webrtc\src\third_party" -I "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.39.33519\include"
-t africa.jopen.webrtc --output "C:\Users\Kinsl\IdeaProjects\webrtc-for-java-apps\src\main\java"
-l webrtc `
"C:\Users\Kinsl\webrtc\src\api\peer_connection_interface.h"
ERROR: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.39.33519\include\yvals_core.h:28:2: error: Error in C++ Standard Library usage"

Please can you help

Also here is the version info

PS C:\Users\Kinsl>  jextract --version
jextract 22
JDK version 22+35-2369
LibClang version clang version 13.0.0
Share Improve this question asked yesterday kinsley kajivakinsley kajiva 1,8601 gold badge22 silver badges26 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 3

I assume you use the header file from https://webrtc.googlesource.com/src/+/refs/heads/main/api/peer_connection_interface.h. If that is the case, that peer_connection_interface.h file includes vector.h (https://webrtc.googlesource.com/src/+/refs/heads/main/api/peer_connection_interface.h#78), and probably your local vector.h is similar to https://github.com/microsoft/STL/blob/main/stl/inc/vector#L8 and needs yvals_core.h, an internal header file in Microsoft's Standard Library implementation for C++.

Below is where the error message is coming from.

// This does not use `_EMIT_STL_ERROR`, as it needs to be checked before we include anything else.
// However, `_EMIT_STL_ERROR` has a dependency on `_CRT_STRINGIZE`, defined in `<vcruntime.h>`.
// Here, we employ the same technique as `_CRT_STRINGIZE` in order to avoid needing to update the line number.
#ifndef __cplusplus
#define _STL_STRINGIZE_(S) #S
#define _STL_STRINGIZE(S)  _STL_STRINGIZE_(S)
#pragma message(__FILE__ "(" _STL_STRINGIZE(__LINE__) "): STL1003: Unexpected compiler, expected C++ compiler.")
#error Error in C++ Standard Library usage
#endif // !defined(__cplusplus)

jextract uses clang C API to parse the header file and when you try to run jextract over the peer_connection_interface.h, the indirect reference to yvals_core.h signals that processing does not occur according to C++ standards. Moreover, https://webrtc.googlesource.com/src/+/refs/heads/main/api/peer_connection_interface.h is a C++ header file that does not have a C interface that jextract can further process (please look at https://github.com/openjdk/jextract/blob/master/doc/GUIDE.md#other-languages).

If you would like to generate Java bindings for the webrtc lib, my colleague Jorn Vernee found another standalone implementation of some of the WebRTC features that has a C interface: https://github.com/paullouisageneau/libdatachannel. He gave it a try on a Windows machine and works with jextract.

本文标签: bindingJava jextract for webrtc header filesStack Overflow