0

我在使用 scons 从源代码构建软件包时遇到问题。我收到以下异常。如果我将文件扩展名更改为 ll 或 lm,则会在编译时出现语法错误。

scons -j ${JOBS_COUNT:-$(grep -c processor /proc/cpuinfo || echo 1)} --without-dpdk

scons: Reading SConscript files ...
('Ubuntu', '20.04', 'focal')
('Ubuntu', '20.04', 'focal')
('Ubuntu', '20.04', 'focal')

scons: *** While building `['sandeshy.cc']' from `['/root/salim/src/contrail-common/sandesh/compiler/sandeshy.yy']': Don't know how to build from a source file with suffix `.yy'.  Expected a suffix in this list: ['.lm', '.ll'].

征兵文件

# -*- mode: python; -*-
  
#
# Created by Megh Bhatt on 07/16/12.
# Copyright (c) 2012 Contrail Systems. All rights reserved.
#

Import('SandeshEnv')

env = SandeshEnv.Clone();

rmflags = ['-Wsign-compare', '-Werror', '-fno-exceptions',
           '--coverage']

cflags = env['CCFLAGS']
for flag in rmflags:
    if flag in cflags:
        cflags.remove(flag)

env['CCFLAGS'] = cflags

env.Append(CPPPATH = ['#src/contrail-common/sandesh/compiler','#build/include'])

# Lex and Yacc
env.Append(YACCFLAGS = '-d')
env['YACCHXXFILESUFFIX'] = '.hh'
#env.Append(LEXFLAGS = '-DSANDESH')
env.CXXFile(target = 'sandeshy.cc', source = 'sandeshy.yy')
env.CXXFile(target = 'sandeshl.cc', source = 'sandeshl.ll')

sandesh = env.Program(target = 'sandesh',
                      source = ['main.cc',
                                'md5.c',
                                'sandeshy.cc',
                                'sandeshl.cc',
                                'generate/t_cpp_generator.cc',
                                'generate/t_html_generator.cc',
                                'generate/t_generator.cc',
                                'generate/t_xsd_generator.cc',
                                'generate/t_c_generator.cc',
                                'generate/t_py_generator.cc',
                                'generate/t_doc_generator.cc',
                                'parse/parse.cc',
                               ])
env.Install(env['TOP_BIN'], sandesh)

我正在尝试从从 github repo 获得的 opencontrail 源文件构建包

位于 github repo 中的sandeshy.yy文件

4

1 回答 1

-1

您需要安装 yacc 来修复此错误,scons 可能正在检查它能够处理的内容,因为它无法处理它没有添加.yy到支持的扩展列表中的yacc 文件CXXFile

于 2020-12-23T07:59:47.487 回答