LinuxCNC / linuxcnc

LinuxCNC controls CNC machines. It can drive milling machines, lathes, 3d printers, laser cutters, plasma cutters, robot arms, hexapods, and more.
http://linuxcnc.org/
GNU General Public License v2.0
1.76k stars 1.14k forks source link

Compile Error #1749

Open jack9603301 opened 2 years ago

jack9603301 commented 2 years ago

Here are the steps I follow to reproduce the issue:

Compile using Gentoo ebuild as follows:

# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="7"

PYTHON_COMPAT=( python3_10 )

inherit autotools eutils flag-o-matic multilib python-single-r1

DESCRIPTION="LinuxCNC "
HOMEPAGE="http://linuxcnc.org/"
#SRC_URI="mirror://sourceforge/gentoocnc/distfiles/${P}.tar.gz"
#SRC_URI="https://github.com/LinuxCNC/linuxcnc/archive/2.7.zip"
SRC_URI="https://github.com/LinuxCNC/linuxcnc/archive/refs/tags/v2.8.2.tar.gz"

S="${WORKDIR}"/linuxcnc-2.8.2/src

LICENSE="LGPL-3"
SLOT="linuxcnc-2.8"
KEYWORDS="~amd64 ~x86"
IUSE="+python +uspace +X +gtk -rt gstreamer modbus simulator usb"
# TODO: add shmdrv use flag

# --disable-python uses python anyways and fails so python is a required use flag
REQUIRED_USE="
    python
    python? ( ${PYTHON_REQUIRED_USE} )
    rt? ( !simulator )
    "

DEPEND="dev-lang/tcl
    dev-lang/tk
    dev-tcltk/tkimg
    dev-tcltk/tclx
    dev-libs/boost[python]
    modbus? ( <dev-libs/libmodbus-3.1 )
    dev-tcltk/bwidget
    gtk? ( x11-libs/gtk+ )
    gstreamer? (
        dev-python/gst-python:0.10
        media-libs/gst-plugins-base:0.10
    )
    || (
        net-analyzer/netcat
        net-analyzer/netcat6
    )
    x11-libs/libXinerama
    usb? ( virtual/libusb )
    dev-lang/python:3.10[tk]
    $(python_gen_cond_dep 'dev-python/lxml[${PYTHON_USEDEP}]')
    $(python_gen_cond_dep 'dev-python/numpy[${PYTHON_USEDEP}]')
    $(python_gen_cond_dep 'dev-python/configobj[${PYTHON_USEDEP}]')
    $(python_gen_cond_dep 'dev-python/pillow[tk,${PYTHON_USEDEP}]')
    media-libs/mesa
    x11-apps/mesa-progs
    X? (
        x11-libs/libXaw
        $(python_gen_cond_dep 'dev-python/python-xlib[${PYTHON_USEDEP}]')
    )
    rt? ( sys-kernel/rt-sources )
    virtual/opengl
    virtual/glu
    ${PYTHON_DEPS}
    sys-devel/gettext
    sys-process/procps
    sys-process/psmisc
    net-firewall/iptables
    media-gfx/graphviz
"
RDEPEND="${DEPEND}
    python? ( dev-python/yapps )"

src_prepare() {
    default
    eautoreconf
}

src_configure() {
    #myconf="--prefix=${EPREFIX}/usr --with-kernel-headers=/usr/src/linux/ $(use_with modbus libmodbus)"
    myconf="--prefix=${EPREFIX}/usr --enable-non-distributable=yes --with-boost-python=boost_python310 $(use_with modbus libmodbus)"

    use !gtk && myconf="${myconf} --disable-gtk"
    use rt && myconf="${myconf} --with-realtime=uspace"
    use simulator && myconf="${myconf} --with-realtime=uspace"
    use !usb && myconf="${myconf} --without-libusb-1.0"
#   use rtai && myconf="${myconf} --with-realtime=${EPREFIX}/usr/realtime --with-module-dir=${EPREFIX}/usr/lib/linuxcnc/rtai/"
    use X && myconf="${myconf} --with-x"

    # TODO: fix that - get python version
    #use python && myconf="${myconf} --with-python=/usr/bin/python3.10"
    use !python && myconf="${myconf} --disable-python"

    econf ${myconf}
}

src_install() {
    PORTAGE_COMPRESS=""
    emake DESTDIR="${D}" install

    local envd="${T}/51linuxcnc"
    cat > "${envd}" <<-EOF
        LDPATH="${EPREFIX}/usr/$(get_libdir)/linuxcnc"
    EOF
    doenvd "${envd}"

    insinto "/usr/share/linuxcnc/"
    doins Makefile.inc

    insinto "/etc/linuxcnc/"
    doins "../scripts/rtapi.conf"

    doicon "../linuxcncicon.png"
    make_desktop_entry linuxcnc LinuxCNC linuxcnc 'Science;Robotics'
}

pkg_postinst() {
    elog "The compiled software may not be redistributed due to use of packages with incompatible licenses."
    elog "Opening machine configuration files from older Versions can crash the application as it cannot load old named modules, e.g. probe_parport.so not found"
    elog "This is not a Gentoo- or build related error. It looks like linuxcnc 2.8 will have some kind of converter for them."
    elog "If you created them with stepconf. You can just open the stepconf file and create them new. Don't forget to backup any manual changes (e.g. backlash!) from the .hal and .ini files and make them again."
}

Actually. This is an automated implementation of manual compilation. Therefore, irrelevant parts can be ignored to a certain extent

This is what I expected to happen:

At least compile normally

This is what happened instead:

The following compilation errors occurred:

    inlined from ‘int Interp::arc_data_ijk(int, int, double, double, double, double, int, double, double, int, double*, double*, int*, double, double, double)’ at emc/rs274ngc/interp_arc.cc:294:3:
/usr/include/bits/string_fortified.h:95:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ output truncated copying 80 bytes from a string of length 140 [-Wstringop-truncation]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   96 |                                   __glibc_objsize (__dest));
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘char* strncpy(char*, const char*, size_t)’,
    inlined from ‘int Interp::arc_data_ijk(int, int, double, double, double, double, int, double, double, int, double*, double*, int*, double, double, double)’ at emc/rs274ngc/interp_arc.cc:309:5:
/usr/include/bits/string_fortified.h:95:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ output truncated copying 80 bytes from a string of length 140 [-Wstringop-truncation]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   96 |                                   __glibc_objsize (__dest));
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘char* strncpy(char*, const char*, size_t)’,
    inlined from ‘int Interp::arc_data_r(int, int, double, double, double, double, double, int, double*, double*, int*, double)’ at emc/rs274ngc/interp_arc.cc:370:3:
/usr/include/bits/string_fortified.h:95:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ output truncated copying 80 bytes from a string of length 109 [-Wstringop-truncation]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   96 |                                   __glibc_objsize (__dest));
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘char* strncpy(char*, const char*, size_t)’,
    inlined from ‘int Interp::arc_data_r(int, int, double, double, double, double, double, int, double*, double*, int*, double)’ at emc/rs274ngc/interp_arc.cc:376:3:
/usr/include/bits/string_fortified.h:95:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ output truncated copying 80 bytes from a string of length 109 [-Wstringop-truncation]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   96 |                                   __glibc_objsize (__dest));
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘char* strncpy(char*, const char*, size_t)’,
    inlined from ‘int Interp::arc_data_comp_r(int, int, int, double, double, double, double, double, double, int, double*, double*, int*, double)’ at emc/rs274ngc/interp_arc.cc:219:3:
/usr/include/bits/string_fortified.h:95:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ output truncated copying 80 bytes from a string of length 127 [-Wstringop-truncation]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   96 |                                   __glibc_objsize (__dest));
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
Compiling emc/rs274ngc/interp_base.cc
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-function-declaration’ is not valid for C++
Compiling emc/rs274ngc/interp_check.cc
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-function-declaration’ is not valid for C++
Compiling emc/rs274ngc/interp_convert.cc
cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-function-declaration’ is not valid for C++
emc/task/taskclass.cc: In function ‘int return_int(const char*, PyObject*)’:
emc/task/taskclass.cc:404:10: error: ‘PyInt_Check’ was not declared in this scope; did you mean ‘PySet_Check’?
  404 |         (PyInt_Check(retval))) {
      |          ^~~~~~~~~~~
      |          PySet_Check
emc/task/taskclass.cc:405:16: error: ‘PyInt_AS_LONG’ was not declared in this scope; did you mean ‘PyLong_AS_LONG’?
  405 |         return PyInt_AS_LONG(retval);
      |                ^~~~~~~~~~~~~
      |                PyLong_AS_LONG
emc/task/taskclass.cc:409:26: error: ‘PyString_AsString’ was not declared in this scope
  409 |                          PyString_AsString(retval),
      |                          ^~~~~~~~~~~~~~~~~
emc/task/taskclass.cc: At global scope:
emc/task/taskclass.cc:444:31: error: invalid conversion from ‘void (*)()’ to ‘PyObject* (*)()’ {aka ‘_object* (*)()’} [-fpermissive]
  444 |     { (char *) "interpreter", initinterpreter },
      |                               ^~~~~~~~~~~~~~~
      |                               |
      |                               void (*)()
emc/task/taskclass.cc:445:28: error: invalid conversion from ‘void (*)()’ to ‘PyObject* (*)()’ {aka ‘_object* (*)()’} [-fpermissive]
  445 |     { (char *) "emccanon", initemccanon },
      |                            ^~~~~~~~~~~~
      |                            |
      |                            void (*)()
emc/task/taskclass.cc:446:27: error: invalid conversion from ‘void (*)()’ to ‘PyObject* (*)()’ {aka ‘_object* (*)()’} [-fpermissive]
  446 |     { (char *) "emctask", initemctask },
      |                           ^~~~~~~~~~~
      |                           |
      |                           void (*)()
make: *** [Makefile:222: objects/emc/task/taskclass.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from /usr/include/string.h:519,
                 from emc/rs274ngc/interp_convert.cc:20:
In function ‘char* strncpy(char*, const char*, size_t)’,
    inlined from ‘int Interp::convert_threading_cycle(block_pointer, setup_pointer, double, double, double)’ at emc/rs274ngc/interp_convert.cc:4717:5:
/usr/include/bits/string_fortified.h:95:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ output truncated copying 80 bytes from a string of length 89 [-Wstringop-truncation]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   96 |                                   __glibc_objsize (__dest));
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘char* strncpy(char*, const char*, size_t)’,
    inlined from ‘int Interp::convert_threading_cycle(block_pointer, setup_pointer, double, double, double)’ at emc/rs274ngc/interp_convert.cc:4720:5:
/usr/include/bits/string_fortified.h:95:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ output truncated copying 80 bytes from a string of length 89 [-Wstringop-truncation]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   96 |                                   __glibc_objsize (__dest));
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~

It worked properly before this:

(If the behavior changed after making a particular change in hardware or software, describe the change you think is responsible. E.g., "after upgrading from LinuxCNC 2.7.3 to 2.7.4")

Information about my hardware and software:

jack9603301 commented 2 years ago

It seems that only master can be built under py3

rene-dev commented 2 years ago

yes, only master supports py3, and py3 only.

jack9603301 commented 2 years ago

@rene-dev However, I found the following problems. I don't know if I need to install any additional modules:

┌─(/var/db/repos/gentoo_overlay_local)─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────(jack@jack-B250-HD3:pts/4)─┐
└─(19:24:02 on main)──> linuxcnc                                                                                                                                                                                             ──(日,5月29)─┘
LINUXCNC - 2.9.0~pre0
Machine configuration directory is '/home/jack/linuxcnc/configs/sim.axis'
Machine configuration file is 'axis.ini'
can't find package Linuxcnc
    while executing
"package require Linuxcnc "
    (file "/usr/share/linuxcnc/hallib/check_config.tcl" line 187)
check_config validation failed
LinuxCNC terminated with an error.  You can find more information in the log:
    /home/jack/linuxcnc_debug.txt
and
    /home/jack/linuxcnc_print.txt
as well as in the output of the shell command 'dmesg' and in the terminal
┌─(/var/db/repos/gentoo_overlay_local)──────────────────────────────────────
rene-dev commented 2 years ago

can't find package Linuxcnc means python doesnt find the linuxcnc module. either a path problem, or a python version mismatch.

jack9603301 commented 2 years ago

It seems that the problem is caused by the fact that the TCL package path of linuxcnc is not set to the environment variable