AI Skill Report Card

Compiling Projects to Executables

A-85·Nov 19, 2026·Source: Web
14 / 15
Bash
# 1. Identify toolchain by project type # - C/C++ -> gcc/g++/clang/MSVC # - CMake project -> cmake + native generator # - JVM/Android(APK) -> extract code of interest, bridge via JNI, compile native parts with NDK; # full AOT only via GraalVM native-image (Java only, not Kotlin/Android APKs) # - OpenVINO C++ app -> link against openvino.lib/.so, validate IR (.xml/.bin) + plugins.xml # 2. Build once to surface real errors g++ -std=c++17 main.cpp -I./include -L./lib -lopenvino -o app.exe # 3. On failure, read the actual compiler/linker error and fix the specific cause # (missing header, undefined reference, ABI mismatch) — never guess blindly # 4. Re-run build + smoke test ./app.exe --test-input sample.json # 5. Three failed build+run cycles on the same project -> discard and regenerate from the spec
Recommendation▾
Add a brief example of the optimization pass (Step 7) in action with before/after binary size or flags used

This skill handles C/C++ projects, CMake-based builds, and native-code integration layers around OpenVINO inference engines or JNI bridges from JVM/Android code. It does not claim to transpile arbitrary Java/Kotlin bytecode into C — that's not a real pipeline. For JVM code needing a native binary, use GraalVM native-image (plain Java only) or keep JVM logic in the JVM and expose only a thin native interface via JNI/JNA to the C/C++ layer this skill actually compiles.

14 / 15

Progress:

  • Step 1: Classify project (pure C/C++, CMake, OpenVINO integration, JNI bridge)
  • Step 2: Validate configs (CMakeLists.txt, plugins.xml, JSON model configs, .vcxproj/Makefile)
  • Step 3: Attempt build; capture exact compiler/linker errors
  • Step 4: Fix root cause per error class (see table below)
  • Step 5: Rebuild and run smoke test via terminal
  • Step 6: Repeat Steps 3-5; hard stop at 3 failed cycles -> rebuild from scratch
  • Step 7: Run optimization pass (strip, LTO, dead code elimination, unused lib removal)
  • Step 8: Final cross-platform check if target includes Windows + Linux

Error-class fix table

Error signatureRoot causeFix
undefined reference to 'ov::Core::Core()'Missing OpenVINO lib linkAdd -lopenvino and correct -L path; verify find_package(OpenVINO REQUIRED) in CMakeLists.txt
fatal error: openvino/openvino.hpp: No such fileMissing include pathAdd -I$OpenVINO_DIR/runtime/include
error: 'plugins.xml' not found at runtimePlugin registry path wrongSet OPENVINO_LIB_PATH env var or pass explicit path to Core(plugins_xml_path)
LNK2019: unresolved external symbol (MSVC)Missing .lib in linker inputAdd to Linker > Input > Additional Dependencies in .vcxproj, or target_link_libraries() in CMake
UnsatisfiedLinkError (JNI)Native lib not on java.library.path or wrong name manglingVerify System.loadLibrary("name") matches lib<name>.so/<name>.dll; check javah/javac -h generated signatures match C function names exactly
cannot find -lstdc++ cross-compiling to Windows from LinuxMissing MinGW toolchainInstall mingw-w64, build with x86_64-w64-mingw32-g++
Model loads but tensor shape mismatchJSON/IR input shape doesn't match code's expected shapeRead .xml IR <dim> values, align ov::Shape in code, or reshape via model->reshape(...)
Recommendation▾
Include an example of a failure that is NOT solved by three-strike rebuild but by a different category (e.g., missing toolchain) to show branching logic
17 / 20

Example 1 — Missing OpenVINO link: Input:

g++ -std=c++17 infer.cpp -o infer.exe
/usr/bin/ld: /tmp/ccXYZ.o: in function `main':
infer.cpp:(.text+0x45): undefined reference to `ov::Core::Core()'
collect2: error: ld returned 1 exit status

Output:

g++ -std=c++17 infer.cpp -I/opt/intel/openvino/runtime/include \
    -L/opt/intel/openvino/runtime/lib/intel64 -lopenvino -o infer.exe
# Build succeeds. Run smoke test:
LD_LIBRARY_PATH=/opt/intel/openvino/runtime/lib/intel64 ./infer.exe model.xml input.json
# Exit code 0, output tensor shape [1,1000] as expected.

Example 2 — JNI bridge for an Android/JVM project needing native inference: Input: Kotlin app calls NativeBridge.runInference(byteArray); native side missing.

java.lang.UnsatisfiedLinkError: No implementation found for float[] com.app.NativeBridge.runInference(byte[])

Output:

C
// native_bridge.cpp #include <jni.h> #include <openvino/openvino.hpp> extern "C" JNIEXPORT jfloatArray JNICALL Java_com_app_NativeBridge_runInference(JNIEnv* env, jobject, jbyteArray input) { ov::Core core; auto model = core.read_model("model.xml"); auto compiled = core.compile_model(model, "CPU"); // ... fill input tensor from jbyteArray, run infer_request.infer() ... jfloatArray result = env->NewFloatArray(output_size); env->SetFloatArrayRegion(result, 0, output_size, output_data); return result; }

Build as part of the Android NDK CMakeLists.txt:

CMAKE
add_library(native_bridge SHARED native_bridge.cpp) target_link_libraries(native_bridge openvino::runtime log android)

Function name must exactly match Java_<package>_<Class>_<method> mangling or the UnsatisfiedLinkError persists.

Example 3 — Three-strike rebuild: Input: Legacy CMake project, inconsistent dependency versions.

  • Attempt 1: CMake Error: Could not find OpenCV → added find_package(OpenCV REQUIRED) + hint path → still fails (version mismatch: project needs 4.5, system has 3.2).
  • Attempt 2: Pinned OpenCV 4.5 via vcpkg → new error: ABI mismatch with existing .o files from mixed compiler versions.
  • Attempt 3: Clean rebuild of all objects with consistent compiler → new linker error in unrelated legacy module with no documentation.

Output: After 3 failed cycles, discard incremental repair. Rebuild from scratch means concretely:

1. Extract the actual functional spec from existing source (inputs, outputs, model files used)
2. Create fresh CMakeLists.txt pinning exact dependency versions (vcpkg.json or conan.txt)
3. Re-implement only the call sites needed to wire input -> model -> output
4. Build clean in an isolated directory (new build/ dir, no stale .o/.obj)
5. Run smoke test before adding back any legacy extras
Recommendation▾
Consider trimming the Cross-Platform Notes and Best Practices sections slightly, as some overlap with the error-class table and pitfalls, to tighten length
  • Windows EXE: link against .lib import libraries; runtime needs matching .dlls on PATH or alongside the EXE. Use /MD vs /MT consistently across all linked objects to avoid CRT mismatch errors.
  • Linux ELF: shared libs (.so) resolved via LD_LIBRARY_PATH or rpath; prefer -Wl,-rpath,'$ORIGIN/lib' for portable binaries.
  • Cross-compiling Linux→Windows: use mingw-w64; note OpenVINO prebuilt binaries differ per platform — don't mix Linux .so with Windows build.
  • Missing toolchain: if cmake, g++, or NDK isn't installed, state this explicitly as a blocking dependency rather than attempting workarounds — install/report before proceeding.
  • Build first, read the real error, then fix — never pre-guess a fix before seeing the actual compiler/linker message.
  • Treat CMakeLists.txt, plugins.xml, and model IR .xml/.bin as code: diff them against what the C++ actually references.
  • For JVM/Android integration, keep the JVM layer in the JVM; only compile the native bridge, don't attempt whole-program JVM→C conversion.
  • Pin dependency versions explicitly (vcpkg.json, conan.txt, or CMake find_package(X 4.5 EXACT)) to avoid silent ABI mismatches.
  • Always smoke-test the produced binary by running it, not just confirming it compiled.
  • Run an optimization pass at the end: strip symbols, enable -flto, remove unused target_link_libraries entries.
  • Don't claim or attempt "transpile Java/Kotlin to C" — it's not a real pipeline; use GraalVM native-image (Java-only, with its own closed-world limitations) or JNI bridges instead.
  • Don't exceed 3 fix attempts on the same broken state — past that, rebuild clean per the concrete steps above.
  • Don't mix Windows /MD and /MT runtime linkage across objects, and don't mix Linux/Windows prebuilt OpenVINO binaries.
  • Don't modify OpenVINO's internal model/runtime code when the actual bug is in your integration/bridge layer.
  • Don't skip the smoke-test run — a clean compile is not proof of a working executable.
  • Don't leave unused linked libraries in the final binary; that's incomplete optimization work.
0
Grade A-AI Skill Framework
Scorecard
Criteria Breakdown
Quick Start
14/15
Workflow
14/15
Examples
17/20
Completeness
18/20
Format
14/15
Conciseness
13/15