You are not logged in.

#1 2012-01-17 18:29:47

gururise
Member
Registered: 2011-11-03
Posts: 33

EMC2 Simulator (CNC) PKGBUILD

Hi,

I've been trying to build emc (as simulator), so I can view my g-code files, for the past several days without any luck.  There exists an outdated emc2 package (v2.4.5) in AUR; however, it depends on the rtai-kernel because it is not a simulator build.  Building for simulator should be easier, because there are no kernel dependencies needed.

At first I tried with the latest emc2 v2.4.7 tarball, but I didn't get very far, as I had lots of build errors. I even tried the patches in the outdated emc2 AUR pkgbuild, but they didn't help. Then I moved back to the 2.4.6 tarball, and almost got things working, with only a single linking error.

This is the pkgbuild I have so far:

pkgname=emc2-sim
pkgver=2.4.6
pkgrel=1
pkgdesc="EMC2 Simulator is software that runs on Linux, on most standard PCs, that can interpret G-code and simulate a CNC machine."
arch=('i686' 'x86_64')
license=('GPL2')
url="http://linuxcnc.org/"
depends=('bwidget' 'tcl' 'tk' 'xorg-server' 'python2')
install=$pkgname.install
source=('http://linuxcnc.org/emc2/dists/lucid/emc2.4-sim/source/emc2_2.4.6.tar.gz')
md5sums=('0e4688b8f063847cc75946803db6a5a0')

build () {
  cd $srcdir/build/src

  ./configure --prefix=/usr --with-python=/usr/bin/python2.7 --enable-simulator|| return 1
  make || return 1
  make install DESTDIR=${pkgdir} || return 1
}

However, there is one linking error that I just can't resolve:

> makepkg

Linking xemc
/usr/bin/ld: objects/emc/usr_intf/xemc.o: undefined reference to symbol 'XtAddCallback'
/usr/bin/ld: note: 'XtAddCallback' is defined in DSO /usr/lib/libXt.so.6 so try adding it to the linker command line
/usr/lib/libXt.so.6: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [../bin/xemc] Error 1
make: Leaving directory `/home/gene/Downloads/emc2/src/build/src'
==> ERROR: A failure occurred in build().
    Aborting...

Any help would greatly be appreciated.

Last edited by gururise (2012-01-17 18:39:57)

Offline

#2 2012-01-27 06:15:29

smudge
Member
Registered: 2011-03-20
Posts: 158

Re: EMC2 Simulator (CNC) PKGBUILD

Does changing the configure line to:

./configure --prefix=/usr --with-python=/usr/bin/python2.7 --enable-simulator LIBS='/usr/lib/libXt.so.6' || return 1

help at all? I haven't tested it but adding the LIBS= helped with a similar problem in a different package.

Offline

#3 2012-01-29 22:01:43

louipc
Member
Registered: 2006-10-09
Posts: 85

Re: EMC2 Simulator (CNC) PKGBUILD

If you remove the --as-needed flag from LDFLAGS in makepkg.conf that might solve the linking problem.
Some of these flags can cause problems for compiling some programs.

Offline

#4 2012-01-29 22:03:50

louipc
Member
Registered: 2006-10-09
Posts: 85

Re: EMC2 Simulator (CNC) PKGBUILD

Also you can remove all the "|| return 1" statements from the PKGBUILD. They're obsolete with the current makepkg.

Offline

#5 2012-01-29 23:42:53

louipc
Member
Registered: 2006-10-09
Posts: 85

Re: EMC2 Simulator (CNC) PKGBUILD

Nice article about the issue, but with some gentoo specific bits:
http://www.gentoo.org/proj/en/qa/asneeded.xml

Offline

#6 2012-01-29 23:56:08

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: EMC2 Simulator (CNC) PKGBUILD

--as-needed isn't the problem here, it's transitive linking. See the first item in the ld changelog for binutils 2.22. There's two options:

- add "-Wl,--copy-dt-needed-entries" to LDFLAGS
- add "-lXt" to LDFLAGS

Either way, this should be fixed upstream. You should explicitly link against any library you depend on.

Offline

Board footer

Powered by FluxBB