You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu下Agda标准库配置缺失standard-library.agda-lib的问题咨询

Fixing Agda Standard Library Configuration on Ubuntu

Hey there, let's get your Agda standard library up and running properly. The issue you're facing is pretty common with the Ubuntu package version of agda-stdlib—it often doesn't include the required standard-library.agda-lib file out of the box. Here's how to fix it step by step:

Step 1: Locate the exact installation path of your stdlib

First, let's confirm where Ubuntu installed the standard library files. Run this command in your terminal:

dpkg -L agda-stdlib

This will list all files installed by the package. Look for the directory that contains folders like Algebra, Data, and Relation—that's the root directory of your stdlib (it's usually something like /usr/share/agda-stdlib/ or /usr/lib/agda/std-lib/).

Step 2: Create the missing standard-library.agda-lib file

Navigate to that stdlib root directory (you'll need sudo permissions to write here):

cd /path/to/your/stdlib/root
sudo nano standard-library.agda-lib

Paste the following content into the file:

name: standard-library
include: .

Save and exit the editor (in nano, that's Ctrl+O, then Enter, then Ctrl+X).

Step 3: Tell Agda where to find the library

Now we need to configure Agda to recognize this library. First, make sure the ~/.agda directory exists (create it if not):

mkdir -p ~/.agda

Option A: Add the library to your global config

Edit the libraries file in ~/.agda (create it if it doesn't exist):

nano ~/.agda/libraries

Add a line with the full path to the standard-library.agda-lib file you just created, like:

/usr/share/agda-stdlib/standard-library.agda-lib

Option B: Set the stdlib as a default library (optional)

If you want to use the standard library in all your Agda files without adding a header option every time, edit the defaults file in ~/.agda:

nano ~/.agda/defaults

Add a line that says:

standard-library

Step 4: Verify the configuration works

Create a simple test file called Test.agda with this content:

{-# OPTIONS --library standard-library #-}
open import Data.Nat
open import IO

main : IO Unit
main = print 42

Compile it with:

agda Test.agda

If everything works, you won't get any import errors—success!

Why this happens

The Ubuntu agda-stdlib package is often a bit outdated compared to the latest Agda documentation, and sometimes the packagers forget to include the .agda-lib file that Agda's package system needs to recognize the library. Manually creating this file and pointing Agda to it fixes the gap.

内容的提问来源于stack exchange,提问作者J.Lili

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.07 13:22:36