Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 649700

Summary: sci-electronics/freehdl-0.0.8 - segmentation fault in freehdl-v2cc at ?
Product: Gentoo Linux Reporter: Vladimir <v_2e>
Component: Current packagesAssignee: The Soldering-Iron Brotherhood <sci-electronics>
Status: RESOLVED OBSOLETE    
Severity: normal CC: treecleaner
Priority: Normal Keywords: PATCH, PMASKED
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugzilla.redhat.com/show_bug.cgi?id=1207310
https://launchpad.net/bugs/1781054
https://bugs.archlinux.org/task/66387
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 722006    
Bug Blocks:    
Attachments: freehdl-0.0.8-declerative_region.patch
freehdl-0.0.8-la.patch
freehdl-0.0.8-r1.ebuild
freehdl-0.0.8-r2.ebuild
freehdl-0.0.8-cpp-modern.patch
freehdl-0.0.8-acl-NULL-check.patch
freehdl-0.0.8-declarative_region.patch
freehdl-0.0.8-gvhdl_tag_command.patch

Description Vladimir 2018-03-05 22:36:23 UTC
Created attachment 522474 [details, diff]
freehdl-0.0.8-declerative_region.patch

With sci-electronics/freehdl-0.0.8 the freehdl-v2cc command returns Segmentation fault even for the simplest VHDL demo (https://ghdl.readthedocs.io/en/latest/using/QuickStartGuide.html). It also does for any schematic I tried in Qucs.

I did some backtrace and suggest a patch which seems to fix this issue.

As the source file 'v2cc/v2cc-chunk.t' states,

    ;; respect to the entity). Note that the value is set to NULL if
    ;; the object/declaration/expression is not static at all!
    (IIR_DeclarativeRegion static_declarative_region (= "NULL"))

so my patch provides a simple check of the NULL pointer. I am not sure my solution is correct, but at least, it allows me to use freehdl-v2cc.
Comment 1 Vladimir 2018-03-05 22:40:59 UTC
Created attachment 522476 [details, diff]
freehdl-0.0.8-la.patch

sci-electronics/freehdl-0.0.8 installs the .la files.
This patch is to remove the references to these files, and substitute them by the correct values.

The fix is taken from these posts:
https://bugzilla.redhat.com/show_bug.cgi?id=1207310#c3
https://bugzilla.redhat.com/show_bug.cgi?id=1207310#c6
Comment 2 Vladimir 2018-03-05 22:50:12 UTC
Created attachment 522478 [details]
freehdl-0.0.8-r1.ebuild

This ebuild incorporates the two patches suggested above, and also fixes these problems:

1. undefined reference to L4ieee_Q14std_logic_1164_Y0y0_i51 and several other symbols in libieee.so

This issue is fixed by removing all the .cc files in 'ieee' subdirectory prior to build. These .cc files are generated during the build process, but they are shipped in the package archive for some reason. Probably, it was the developer's mistake. So I simply delete them, and everything builds correctly.

2. Since the .la files are deleted, in order for the later use of the libieee.so library, the '/etc/ld.so.conf.d/freehdl.conf' file is created. This was also grabbed from here: https://bugzilla.redhat.com/show_bug.cgi?id=1207310#c3
Comment 3 Vladimir 2020-04-25 13:50:00 UTC
Created attachment 634540 [details]
freehdl-0.0.8-r2.ebuild

An updated ebuild incorporating all the newly added patches. I am not sure about setting the CXXFLAGS variable inside the ebuild, but I had to add this flag in order to build FreeHDL on relatively modern system.
Comment 4 Vladimir 2020-04-25 13:51:48 UTC
Created attachment 634542 [details, diff]
freehdl-0.0.8-cpp-modern.patch

An updated patch for modern GCC versions in place of the previously used "fix-c++14.patch".
Comment 5 Vladimir 2020-04-25 13:53:19 UTC
Created attachment 634544 [details, diff]
freehdl-0.0.8-acl-NULL-check.patch

This new patch finally fixes a long-lasting problem with segfault because of the NULL pointer.
Comment 6 Vladimir 2020-04-25 13:54:16 UTC
Created attachment 634546 [details, diff]
freehdl-0.0.8-declarative_region.patch

Just fixed the file name (here and in new ebuild too).
Comment 7 Vladimir 2020-04-25 13:55:46 UTC
Created attachment 634548 [details, diff]
freehdl-0.0.8-gvhdl_tag_command.patch

I have no idea what this patch actually fixes, but I found in in Ubuntu package. So I suggest it for the developers' review.