{"data":{"slug":"discovered-df14f229d84f27532a815329487f8ba00171060db6fe51d4","title":"Ocrypto library build (rm_ocrypto_port)","summary":"Build the Oberon Ocrypto library (`libocrypto.a`) and link it with the `rm_ocrypto_port` target for the RA2L1_EK board using SCons. The library must be built first, then the target, to avoid link errors.","url":"https:\/\/skillshunter.net\/skills\/discovered-df14f229d84f27532a815329487f8ba00171060db6fe51d4","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-df14f229d84f27532a815329487f8ba00171060db6fe51d4","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-df14f229d84f27532a815329487f8ba00171060db6fe51d4.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-df14f229d84f27532a815329487f8ba00171060db6fe51d4\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Ensure the `ocrypto` project is built for the correct board (`ra2e1_ek`) before building `rm_ocrypto_port` for `ra2l1_ek`. The library must be rebuilt if the source changes, the build directory is deleted, or the compiler is switched. Each compiler has its own output folder.","instructions":"---\nname: ocrypto\ndescription: Build order and link errors for the Oberon Ocrypto library in the peaks repo (rm_ocrypto_port, libocrypto.a, ra2e1_ek and ra2l1_ek). Use when a build fails with \"cannot find -locrypto\", when building rm_ocrypto_port, or when changing the ocrypto library build.\nmetadata:\n  type: reference\n  recorded: 2026-10-27\n---\n\n# Ocrypto library build (rm_ocrypto_port)\n\n## Build order\n\n`rm_ocrypto_port` links `libocrypto.a`, which is built by a separate `ocrypto` project. Build the library first, then the target.\n\n```bash\ncd \/home\/coder\/workspace\/peaks\nscons -k --build=ocrypto --board=ra2e1_ek --compiler=gcc          # 1. library (CM23)\nscons -k --build=rm_ocrypto_port --board=ra2l1_ek --compiler=gcc # 2. target\n```\n\n- The library output is `build\/ocrypto\/ra2e1_ek\/<compiler>\/build_ocrypto_lib_typical_debug\/libocrypto.a`, plus a `hw_accel` variant. RA2L1 uses the same CM23 library as RA2E1.\n- Rebuild step 1 only when the ocrypto sources change, when `build\/ocrypto\/` is deleted, or when you switch compilers. Each compiler has its own output folder, so build the library for that compiler too.\n\n## Why step 1 is needed\n\n- The `ocrypto` dependency is listed in `projects\/rm_ocrypto_port.xml` (the `<dependencies>` blocks).\n- `projects\/ocrypto.xml` targets only `ra2e1_ek`.\n- `SConstruct` `_filter_boards()` (around line 225, called at line 393) keeps only projects whose boards match `--board`. With `--board=ra2l1_ek`, the `ocrypto` dependency is filtered out, so it is never built. The link then fails with `ld: cannot find -locrypto`.\n- The error is not a path problem in the target. The library was never built.\n\n## Verified\n\n- Fresh machine, no `build\/ocrypto\/`: step 1 built both `libocrypto.a` variants, and step 2 reported SUCCEEDED for `rm_ocrypto_port` typical and hw_accel on `ra2l1_ek` with gcc.\n- Not verified: a single run with `--board=\"ra2l1_ek ra2e1_ek\"`. Check the output before using it.\n\n## Related\n\n- The RA2L1 BSP provides `interface.mcu.ocrypto_licensed` (`ra\/fsp\/src\/bsp\/mcu\/ra2l1\/.module_descriptions\/`). The Oberon module requires it (`ra\/oberon\/.module_descriptions\/Oberon##Ocrypto##all##Lib####x.xx.xx.xml`).\n- The module packaging copies the library to `ra\/oberon\/ocrypto\/Library\/cm23_*\/` (`ra\/oberon\/!dsn\/module.xml`). That folder is absent in this clone, and the target links from `build\/ocrypto\/` instead.\n- `ra\/oberon\/ocrypto` is a submodule (`3.9.4+renesas.0` at the time of this note).\n","use_cases":["Build the Ocrypto library for RA2E1_EK before linking with rm_ocrypto_port for RA2L1_EK","Resolve 'ld: cannot find -locrypto' errors during the build process","Rebuild the Ocrypto library when sources change or compiler is switched"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/minhnguyenyf\/skills\/blob\/7213d81500a27f3a96028144f5342ccfe4efbe4a\/ocrypto\/SKILL.md","source_commit":"7213d81500a27f3a96028144f5342ccfe4efbe4a","license":null,"version":null,"listing_approved_at":"2026-11-30","created_at":"2026-11-29T11:12:15.000000Z","updated_at":"2026-11-30T06:52:26.000000Z","seo_title":"Build Ocrypto library for RA2L1_EK with SCons","seo_description":"Build the Oberon Ocrypto library and link it with the rm_ocrypto_port target for the RA2L1_EK board using SCons. Follow the correct build order to avoid link errors.","seo_keywords":["ocrypto library build","scons build order","ra2l1_ek build","ocrypto link error","oberon library build"]}}