LinuxCNC/hostmot2-firmware

build problem on amd64

sirop opened this issue · 6 comments

sirop commented

To reproduce on SMP Debian 3.8.13-12~1wheezy~1da x86_64 GNU/Linux:


slave@debian-slave:~/hostmot2-firmware$ . /opt/Xilinx/13.3/ISE_DS/settings64.sh
. /opt/Xilinx/13.3/ISE_DS/EDK/.settings64.sh /opt/Xilinx/13.3/ISE_DS/EDK
. /opt/Xilinx/13.3/ISE_DS/ISE/.settings64.sh /opt/Xilinx/13.3/ISE_DS/ISE
. /opt/Xilinx/13.3/ISE_DS/PlanAhead/.settings64.sh /opt/Xilinx/13.3/ISE_DS/PlanAhead
. /opt/Xilinx/13.3/ISE_DS/common/.settings64.sh /opt/Xilinx/13.3/ISE_DS/common
slave@debian-slave:~/hostmot2-firmware$ make -j2
./build.py i90epp SVST8_4_72 fw/7i90epp/SVST8_4.BIT
./build.py i90spi SVST8_4_72 fw/7i90spi/SVST8_4.BIT
XILINX environment variable already set, not overriding
XILINX environment variable already set, not overriding
# workdir /home/slave/hostmot2-firmware/fw/7i90spi/SVST8_4_work
# workdir /home/slave/hostmot2-firmware/fw/7i90epp/SVST8_4_work
Traceback (most recent call last):
  File "./build.py", line 322, in <module>
    report_timing()
  File "./build.py", line 297, in report_timing
    print "%d:%04.1f-total" % (m, s)
UnboundLocalError: local variable 'm' referenced before assignment
Traceback (most recent call last):
  File "./build.py", line 322, in <module>
    report_timing()
  File "./build.py", line 297, in report_timing
    print "%d:%04.1f-total" % (m, s)
UnboundLocalError: local variable 'm' referenced before assignment
make: *** [fw/7i90spi/SVST8_4.BIT] Error 1
make: *** Waiting for unfinished jobs....
make: *** [fw/7i90epp/SVST8_4.BIT] Error 1

I wanted to commit my pin out file for PktUART.
Its bit file can be built with Xilinx iSE 14.7.
And it would be probably possible to build the bit file with 13.3.

sirop commented
def report_timing():
    t = 0
    m, s = 0, 0
    for k, v in timing:
        t += v
        m, s = divmod(v, 60)
        print "%d:%04.1f-%-11s" % (m, s, k),
    print "%d:%04.1f-total" % (m, s)
    print

That's how report_timimg now looks like, but then I get further errors:

~/hostmot2-firmware$ make
./build.py i90epp SVST8_4_72 fw/7i90epp/SVST8_4.BIT
XILINX environment variable already set, not overriding
# workdir /home/slave/hostmot2-firmware/fw/7i90epp/SVST8_4_work
0:00.0-total

Traceback (most recent call last):
  File "./build.py", line 303, in <module>
    run("xst", '-intstyle', 'ise', "-ifn", "scr")
  File "./build.py", line 167, in run
    if settings_sh: cmd = "bash -c '. %s; %s'" % (settings_sh, cmd)
NameError: global name 'settings_sh' is not defined
make: *** [fw/7i90epp/SVST8_4.BIT] Error 1
sirop commented

For NameError: global name 'settings_sh' is not defined
I could do something like:

if 'settings_sh' in globals() : cmd = "bash -c '. %s; %s'" % (settings_sh, cmd)
else: cmd = "bash -c ' %s'" % (cmd)

But did report_timing() work before if m, s did not have a correct scope?

sirop commented

So I just tested these lines:

if 'settings_sh' in globals() : cmd = "bash -c '. %s; %s'" % (settings_sh, cmd)
else: cmd = "bash -c ' %s'" % (cmd)

they work both when Xilings settings are dotted before make and without dotting before make.

However, as XIlinx path is prepended to shell PATH, one has to

$ cd  /opt/Xilinx/13.3/ISE_DS/common/lib/lin64/
$ sudo mv libstdc++.so.6 libstdc++.so.6.orig
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6

as in my case.

So what would be the proper PR?
Just remove the option of sourcing the Xilinx settings before make
and produce an error if Xilinx settings nevertheless have been sourced before make?

I wasn't aware of this libstdc++ problem either. That looks like one more reason not to allow pre-sourced settings.sh.

Basically, it seems you can't run generic host software after sourcing settings.sh (without taking additional steps like those illustrated above) which is yet another reason not to try supporting this configuration. Here's a simple example of the problem:

// (example.cc does nothing but requires a C++11 library feature)
#include <algorithm>
std::random_device random_device;
int main(){}
$ g++ -std=c++11 example.cc
$ ./a.out
$ . /opt/Xilinx/13.4/ISE_DS/settings64.sh 
$ ./a.out
./a.out: /opt/Xilinx/13.4/ISE_DS/common/lib/lin64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by ./a.out)

So, yes, let's make it an error if we an detect that the Xilinx environment is already set up. It looks like I previously checked that XILINX was set in the environment as my test, and I verified this test is proper with both ISE 9 and 13, the two versions I have installed.

I think these issues are solved now. Please reopen this issue of they aren't, or open a fresh issue if you run into other problems.