Closed BrianCechmanek closed 3 years ago
Similar error on Debian Linux for the Alchitry Cu rst2led tutorial.
Starting iceCube2...
/opt/lscc/iCEcube2//synpbase/bin/synplify_pro: 137: [: unexpected operator
/opt/lscc/iCEcube2//synpbase/bin/synplify_pro: 151: [: !=: argument expected
/opt/lscc/iCEcube2//synpbase/bin/synplify_pro: 321: /opt/lscc/iCEcube2/synpbase/bin/config/execute: Syntax error: "(" unexpected (expecting ";;")
Error : can not print out log file stdout.log
Copyright (C) 1992-2014 Lattice Semiconductor Corporation. All rights reserved.
Child process exit with 2.
Error of dumping file alchitry/workspace/button2led/work/icelog.log, 'stdout.log' is instead.
Synthesis exit by 2.
Run edifparser ...
{/opt/lscc/iCEcube2//sbt_backend/bin/linux/opt/edifparser} {/opt/lscc/iCEcube2//sbt_backend/devices/ICE40P08.dev} {alchitry/workspace/button2led/work/alchitry_imp/cu_top_0.edf} {alchitry/workspace/button2led/work/alchitry_imp/sbt/netlist} -p"CB132" {-y} {"alchitry/workspace/button2led/work/constraint/merged_constraint.pcf "} --devicename iCE40HX8K
Lattice Semiconductor Corporation Edif Parser
Release: 2020.12.27943
Build Date: Dec 10 2020 17:23:29
Parsing edif file: alchitry/workspace/button2led/work/alchitry_imp/cu_top_0.edf...
Error: ParseEDIF alchitry/workspace/button2led/work/alchitry_imp/cu_top_0.edf failed
Kparser Unable to open alchitry/workspace/button2led/work/alchitry_imp/cu_top_0.edf
child process exited abnormally
edifparser failed:CHILDSTATUS 4554 1
Bin file (alchitry/workspace/button2led/work/alchitry_imp/sbt/outputs/bitmap/cu_top_0_bitmap.bin) could not be found! The build probably failed.
After installing the deprecated arachne-pnr tool, the example builds, uploads to the Cu, and runs correctly.
The original problem was caused by the new iCEcube2 version not including the tcl script interpreter. This is fixed in 1.2.6.
The second problem is the build tools haven't been updated for the open source toolchain in a while and is unrelated to this bug as Brian is using iCEcube2. I'll open a new bug for updating the open source tools.
I am using Alchitry Labs 1.2.7, iCEcube2 2020.12.27943, on a Ubuntu 20.04 machine, trying to upload the "first FPGA project" to the Cu and I am getting
Starting iceCube2...
Copyright (C) 1992-2014 Lattice Semiconductor Corporation. All rights reserved.
/home/alf/lscc/iCEcube2.2020.12/synpbase/bin/synplify_pro: 137: [: unexpected operator
Child process exit with 2.
/home/alf/lscc/iCEcube2.2020.12/synpbase/bin/synplify_pro: 151: [: !=: argument expected
/home/alf/lscc/iCEcube2.2020.12/synpbase/bin/synplify_pro: 321: /home/alf/lscc/iCEcube2.2020.12/synpbase/bin/config/execute: Syntax error: "(" unexpected (expecting ";;")
Synthesis exit by 2.
Found a fix to this, see here and/or here. Basically the problem is that all the scripts in the iCEcube2 directory start with #!/bin/sh
instead of #!/bin/bash
. The solution is just to replace it in each file it appears within the iCEcube2.2020.12 installation directory. You can do it by hand, however they are a lot of files, or with a recursive script that searches for the string and replaces it. I have made a Python script for this:
from pathlib import Path
import fileinput
def is_binary_file(file_path):
# https://stackoverflow.com/a/7392391/8849755
textchars = bytearray({7,8,9,10,12,13,27} | set(range(0x20, 0x100)) - {0x7f})
is_binary_string = lambda bytes: bool(bytes.translate(None, textchars))
return is_binary_string(open(file_path, 'rb').read(1024))
def replace_in_file(file_path, search_text, new_text):
# https://stackoverflow.com/a/58217364/8849755
with fileinput.input(file_path, inplace=True) as file:
for line in file:
new_line = line.replace(search_text, new_text)
print(new_line, end='')
def recursive_walk_fixing(path):
for p in path.iterdir():
if p.is_dir():
recursive_walk_fixing(p)
else: # It is a file, we do what we want.
if is_binary_file(p):
continue
try:
replace_in_file(p, '#!/bin/sh', '#!/bin/bash')
except UnicodeDecodeError as e:
pass
if __name__=='__main__':
iCEcube_path = Path(input('Path to "iCEcube2" directory? (e.g. "/home/my_name/lscc/iCEcube2.2020.12") '))
if input(f'This script will replace "#!/bin/sh" with "#!/bin/bash" in all the scripts within the directory you provided. Write "yes" and press enter to continue, or just press enter to quit. ').lower() != 'yes':
exit()
recursive_walk_fixing(Path(iCEcube_path))
Thanks for the information. In Debian I recursively replaced #!/bin/sh with #!/bin/shell with this one liner:
find -type f -print0 | xargs -0 sed -i -e 's/^#!\/bin\/sh/#!\/bin\/bash/g'
May be related to #21 .
Using the base files for both Lucid and Verilog projects,
Build Project
fails:iCEcube2 version:
2020.12.27943
, Edit: this is for the Cu+ base project template.