代码之家  ›  专栏  ›  技术社区  ›  Greg Nisbet

鸡肉方案-csc无法定位“chicken.foreign.import.so”

  •  0
  • Greg Nisbet  · 技术社区  · 7 年前

    ;; add1.ss
    
    (import foreign)
    
    (define add-1
      (foreign-lambda* long ((unsigned-long x))
                       "
                       long n = 1
                       C_return(n + x);))
    
    (print (add-1 (read)))
    

    这个 foreign 我感兴趣的图书馆肯定存在。

    find /usr/local | grep chicken | grep foreign | grep lib
    /usr/local//Cellar/chicken/5.0.0/lib/chicken/9/chicken.foreign.import.so
    

    但是,通过 csc add1.ss 没有旗帜 CSC_OPTIONS 环境变量产生:

    $ csc add1.ss
    Syntax error (import): cannot import from undefined module
    
            foreign
    
            Expansion history:
    
            <syntax>          (##core#begin (import foreign))
            <syntax>          (import foreign)      <--
    
    Error:shell command terminated with non-zero exit status 17920:
    '/usr/local/Cellar/chicken/bin/5.0.0/bin/chicken' 'add1.ss' -output-file 'add1.c'
    

    $ chicken add1.ss -output-file add1.c
    

    产生同样的故障。在chicken手册页中,似乎与路径管理相关的唯一命令行选项是 -include-path . 我试过下面的咒语,它们都产生了同样的错误

    $ chicken add1.ss -output-file add1.c -include-path /usr/local/Cellar/chicken/5.0.0/lib/chicken/9/chicken.foreign.import.so
    $ chicken add1.ss -output-file add1.c -include-path /usr/local/Cellar/chicken/5.0.0/lib/chicken/9
    $ chicken add1.ss -output-file add1.c -include-path /usr/local/Cellar/chicken/5.0.0/lib/chicken
    $ chicken add1.ss -output-file add1.c -include-path /usr/local/Cellar/chicken/5.0.0/lib
    $ chicken add1.ss -output-file add1.c -include-path /usr/local/Cellar/chicken/5.0.0
    

    我还试着通过考试 chicken.foreign.import.so

    $ chicken add1.ss -output-file add1.c /usr/local/Cellar/chicken/5.0.0/lib/chicken/9/chicken.foreign.import.so 
    

    正确的指挥方式是什么 chicken 或者编译器驱动程序 csc 在下的目录中查找Chicken的内部库 /usr/local/Cellar/chicken/... ?

    1 回复  |  直到 7 年前
        1
  •  1
  •   sjamaan    7 年前

    foreign 是该模块的旧名称,来自CHICKEN 4。您已经安装了CHICKEN 5,我们已经完全重构了所有模块。为了与其他版本保持一致,此版本已被重命名。在CHICKEN 5中,此模块称为 (chicken foreign)

    所以你需要这样做

    (import (chicken foreign))