freehdl - qucs - segfault fix?

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
Statik
Level 2
Level 2
Posts: 81
Joined: Sat Jan 14, 2012 9:27 pm

freehdl - qucs - segfault fix?

Post by Statik »

Hi all,
I've been playing with qucs for several years and used it seriously through my 4 year BEng but I never had any serious use for digital simulation. With the latest versions I have not been able to get even the simplest digital simulation to run and I have narrowed it down to the freehdl-v2cc component which segfaults. I have tried to compile from scratch but I run into errors that I have no idea how to tackle. Asking for help from the qucs mailing list has just resulted in a single snarky replay and stackexchange has not returned any results, nor replies to a question. So, I'm turning to the experts here to see if anyone has a solution.
Thanks in advance,
Statik
v_2e
Level 1
Level 1
Posts: 3
Joined: Mon Mar 30, 2020 3:54 pm

Re: freehdl - qucs - segfault fix?

Post by v_2e »

Hello!
I seem to have "fixed" the problem with FreeHDL recently. I applied multiple patches from different places, and some of my own, and somehow I managed to build the DEB-package for Linux Mint 19 (Tara). I attached my patches and build scripts to this bug-repot. Using the 'debian' catalog in the freehdl_0.0.8-2.2ubuntu3.debian.tar.xz file, and the FreeHDL sources from Ubuntu repository, one can build the DEB-package for any Ubuntu- or Debian-based distribution, I guess.
I hope this information is not too late for you, and it will be useful.
User avatar
hal8000
Level 4
Level 4
Posts: 399
Joined: Sun May 04, 2008 2:04 pm
Location: UK

Re: freehdl - qucs - segfault fix?

Post by hal8000 »

I'm using Mint 19.3 Tricia and have just compile Qucs 0.20
Installed in /usr/local its working fine for analalog.

freehdl is in the Mint sources, but sure enough a simple 2 input AND circuit truth table segfauts.

Can you explain where to install the patches for freehdl source code please?

If you want to try installing version 20 then after compiling admsXml
run sudio ldconfig
the final sudo make install should then install admsXml with no problems.

The only other thing with v20 is I compiled without documentation (as its online anyway).
v_2e
Level 1
Level 1
Posts: 3
Joined: Mon Mar 30, 2020 3:54 pm

Re: freehdl - qucs - segfault fix?

Post by v_2e »

hal8000 wrote:
Thu Apr 02, 2020 8:02 am
I'm using Mint 19.3 Tricia and have just compile Qucs 0.20
Installed in /usr/local its working fine for analalog.
freehdl is in the Mint sources, but sure enough a simple 2 input AND circuit truth table segfauts.
Can you explain where to install the patches for freehdl source code please?
I would not recommend installing via make install. It would be better to build a DEB-package instead.
In order to build the DEB-package it is necessary to perform the following steps:
  1. First of all we need to install some tools and dependencies:

    Code: Select all

    sudo apt-get install libtool-bin guile-2.0 pkg-config devscripts debhelper dh-autoreconf 
  2. Go to Ubuntu repository and download the FreeHDL sources for version 0.0.8. (As an option, the source file may also be downloaded from QUCS project). Then unpack this file into some folder.

    Code: Select all

    mkdir freehdl-build
    cd freehdl-build
    wget -c http://archive.ubuntu.com/ubuntu/pool/universe/f/freehdl/freehdl_0.0.8.orig.tar.gz
    tar -xvf freehdl_0.0.8.orig.tar.gz
    
  3. Go to the mentioned Launchpad bugreport and download the archive with patches and build scripts. Unpack the archive into the same folder.

    Code: Select all

    wget -c https://bugs.launchpad.net/ubuntu/+source/freehdl/+bug/1781054/+attachment/5358031/+files/freehdl_0.0.8-2.2ubuntu4.debian.tar.xz
    tar -xvf freehdl_0.0.8-2.2ubuntu4.debian.tar.xz
    
  4. Copy the extracted debian folder into the earlier unpacked freehdl-0.0.8 folder:

    Code: Select all

    cp -r debian/ freehdl-0.0.8/ 
  5. Go to the freehdl-0.0.8 folder and run debuild in it:

    Code: Select all

    cd freehdl-0.0.8
    debuild -uc -us 
  6. If everything goes well, you will obtain the freehdl_0.0.8-2.2ubuntu4_amd64.deb, libfreehdl0_0.0.8-2.2ubuntu4_amd64.deb and libfreehdl0-dev_0.0.8-2.2ubuntu4_amd64.deb files in the freehdl-build folder. So you can just go there and install those files:

    Code: Select all

    cd ../
    sudo dpkg -i freehdl_0.0.8-2.2ubuntu4_amd64.deb libfreehdl0_0.0.8-2.2ubuntu4_amd64.deb libfreehdl0-dev_0.0.8-2.2ubuntu4_amd64.deb
This way the packages are installed safely and you can always remove them completely using your package manager, which is not always the case with doing make install by hand.
I hope I have not forgotten any missing dependencies or steps, and I hope it will work for you. Please let me know if there are some errors during this procedure, I will try to help resolving them.
Last edited by v_2e on Wed Apr 22, 2020 2:38 pm, edited 2 times in total.
User avatar
hal8000
Level 4
Level 4
Posts: 399
Joined: Sun May 04, 2008 2:04 pm
Location: UK

Re: freehdl - qucs - segfault fix?

Post by hal8000 »

Hi v_2e
Excellent Work, freehdl now working.

Screebshot on Imgmur:

https://imgur.com/a/zelq3Wf

At one stage running debuild, I encountered another unsatisfied dependency:
***Error****
dpkg-checkbuilddeps: error: Unmet build dependencies: debhelper (>= 5.0.0) dh-autoreconf
dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting
dpkg-buildpackage: warning: (Use -d flag to override.)
debuild: fatal error at line 1152:

However after installing dh-autoreconf debuild then compiled without further errors.
Thanks again for solving this and a comprehensive reply.
v_2e
Level 1
Level 1
Posts: 3
Joined: Mon Mar 30, 2020 3:54 pm

Re: freehdl - qucs - segfault fix?

Post by v_2e »

hal8000 wrote:
Mon Apr 20, 2020 1:14 pm
Excellent Work, freehdl now working.
I'm glad to hear it works!
hal8000 wrote:
Mon Apr 20, 2020 1:14 pm
At one stage running debuild, I encountered another unsatisfied dependency:
***Error****
dpkg-checkbuilddeps: error: Unmet build dependencies: debhelper (>= 5.0.0) dh-autoreconf
dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting
dpkg-buildpackage: warning: (Use -d flag to override.)
debuild: fatal error at line 1152:

However after installing dh-autoreconf debuild then compiled without further errors.
Thanks again for solving this and a comprehensive reply.
I updated my original post accordingly, for the people searching this solution in the future.
Statik
Level 2
Level 2
Posts: 81
Joined: Sat Jan 14, 2012 9:27 pm

Re: freehdl - qucs - segfault fix?

Post by Statik »

Thank you for this! I can finally do digital simulation in Qucs!
Omnomnom
Level 1
Level 1
Posts: 1
Joined: Sat May 09, 2020 8:26 am

Re: freehdl - qucs - segfault fix?

Post by Omnomnom »

I made an account to thank you.
Solution works under Ubuntu 18, if you have problems with the

debuild -uc -us

Command enforce it by adding -d
It worked for me.
Statik
Level 2
Level 2
Posts: 81
Joined: Sat Jan 14, 2012 9:27 pm

Re: freehdl - qucs - segfault fix?

Post by Statik »

Well, I have a new system running Linux Mint 20 Ulyana Mate and I cannot get Qucs 0.0.20 to make (no installation candidates for libqt5-dev, etc. And I get the following error trying your instructions for freehdl:

Code: Select all

vital_timing.vhdl:1929: +++ - type of MsgOn is BOOLEAN
free(): double free detected in tcache 2
free(): double free detected in tcache 2
/bin/bash: line 1: 76719 Aborted                 (core dumped) ../v2cc/freehdl-v2cc -lieee -L .. math_real.vhdl > math_real.cc.tmp
make[2]: *** [Makefile:736: math_real.cc] Error 134
make[2]: *** Waiting for unfinished jobs....
Any ideas? Or maybe a deb? :)

Statik
Post Reply

Return to “Software & Applications”