Scnaything - failed to build server

Les,
I’m attempting to get Scanything working on a linux butser machine running linuxcnc 2.9.1 and am having some issues. I commented out line 46 of main.cpp and am now getting this:

11:37:13: Checking for LinuxCNC server...
11:37:13: LinuxCNC version is 2.9.1
11:37:13: Building src/main.cpp
11:37:13: Building src/timer.cpp
11:37:15: linking cncremote-linuxcnc
11:37:15: /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib/liblinuxcnc.a(iniaxis.o): in function `iniAxis(int, char const*)':
11:37:15: (.text+0x5bf): undefined reference to `emcAxisSetMinPositionLimit(int, double)'
11:37:15: /usr/bin/ld: (.text+0x613): undefined reference to `old_inihal_data'
11:37:15: /usr/bin/ld: (.text+0xa77): undefined reference to `emcAxisSetMaxPositionLimit(int, double)'
11:37:15: /usr/bin/ld: (.text+0xacb): undefined reference to `old_inihal_data'
11:37:15: /usr/bin/ld: (.text+0x1432): undefined reference to `emcAxisSetMaxVelocity(int, double, double)'
11:37:15: /usr/bin/ld: (.text+0x1473): undefined reference to `old_inihal_data'
11:37:15: /usr/bin/ld: (.text+0x1aed): undefined reference to `emcAxisSetMaxAcceleration(int, double, double)'
11:37:15: /usr/bin/ld: (.text+0x1b33): undefined reference to `old_inihal_data'
11:37:15: /usr/bin/ld: (.text+0x1f2d): undefined reference to `emcAxisSetLockingJoint(int, int)'
11:37:15: collect2: error: ld returned 1 exit status
11:37:15: make: *** [makefile:26: cncremote-linuxcnc] Error 1
11:37:15: Failed to build the server
11:37:15: ./cncremote-linuxcnc_2.9.1_4.19.0-25-rt-amd64
11:37:15: Pre-built server not found

Why did you need to comment out line 46?

Do you have a run-in-place LinuxCNC installation? At a guess you have more than one LinuxCNC installation and the CNCRemote make file is getting confused as to which version is being used. Try running Scanything from within a RIP environment.

I commented line 46 because I get the error below and that’s what you suggested to do on another post.

10:25:32: Building src/main.cpp
10:25:34: src/main.cpp:46:12: error: ‘PACKAGE_VERSION’ was not declared in this scope
10:25:34:  string a = PACKAGE_VERSION;
10:25:34:             ^~~~~~~~~~~~~~~
10:25:34: src/main.cpp:46:12: note: suggested alternative: ‘MSGPACK_VERSION
10:25:34:  string a = PACKAGE_VERSION;
10:25:34:             ^~~~~~~~~~~~~~~
10:25:34:             MSGPACK_VERSION
10:25:35: make: *** [makefile:34: obj/main.o] Error 1
10:25:35: Failed to build the server

I tried again, changing line 46 to the suggested alternative ‘MSGPACK_VERSION’ and got the same other errors:

10:36:37: /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib/liblinuxcnc.a(iniaxis.o): in function `iniAxis(int, char const*)':
10:36:37: (.text+0x5bf): undefined reference to `emcAxisSetMinPositionLimit(int, double)'
10:36:37: /usr/bin/ld: (.text+0x613): undefined reference to `old_inihal_data'
10:36:37: /usr/bin/ld: (.text+0xa77): undefined reference to `emcAxisSetMaxPositionLimit(int, double)'
10:36:37: /usr/bin/ld: (.text+0xacb): undefined reference to `old_inihal_data'
10:36:37: /usr/bin/ld: (.text+0x1432): undefined reference to `emcAxisSetMaxVelocity(int, double, double)'
10:36:37: /usr/bin/ld: (.text+0x1473): undefined reference to `old_inihal_data'
10:36:37: /usr/bin/ld: (.text+0x1aed): undefined reference to `emcAxisSetMaxAcceleration(int, double, double)'
10:36:37: /usr/bin/ld: (.text+0x1b33): undefined reference to `old_inihal_data'
10:36:37: /usr/bin/ld: (.text+0x1f2d): undefined reference to `emcAxisSetLockingJoint(int, int)'
10:36:37: collect2: error: ld returned 1 exit status
10:36:37: make: *** [makefile:26: cncremote-linuxcnc] Error 1
10:36:37: Failed to build the server

Why do you think I have multiple linuxcnc versions installed? I have only upgraded from 2.9.0Pre to 2.9.1. That was done by removing the 2.9.0Pre install first, then, installing 2.9.0. Do you think there are residual files left from the original 2.9.0 install causing my issue? I would like to get this running on my current installation without having to port everything to a RIP install environment. There’s only 1 liblinuxcnc.a file. It looks like references are compiled into milltask. There is only 1 of them.

I also tried a fresh install of linuxcnc master 2.10 and got these errors:

11:59:20: Started
11:59:20: Loading plugins
11:59:20: Timed out calling function
11:59:20: Checking for LinuxCNC server...
11:59:20: LinuxCNC version is 2.10.0
11:59:20: Building src/main.cpp
11:59:20: Building src/linuxcnc.cpp
11:59:20: Building src/timer.cpp
11:59:22: In file included from src/linuxcnc.cpp:20:
11:59:22: include/linuxcnc.h:68:24: error: ‘EMC_TASK_MODE_ENUM’ does not name a type; did you mean ‘EMC_TASK_MODE’?
11:59:22:      bool SetMode(const EMC_TASK_MODE_ENUM mode);
11:59:22:                         ^~~~~~~~~~~~~~~~~~
11:59:22:                         EMC_TASK_MODE
11:59:22: src/linuxcnc.cpp: In member function ‘virtual void LinuxCnc::UpdateState(CncRemote::State&)’:
11:59:22: src/linuxcnc.cpp:411:35: error: ‘EMC_TASK_STATE_ON’ was not declared in this scope
11:59:22:      if(m_emcStatus->task.state == EMC_TASK_STATE_ON)
11:59:22:                                    ^~~~~~~~~~~~~~~~~
11:59:22: src/linuxcnc.cpp:411:35: note: suggested alternative: ‘EMC_TASK_STATE
11:59:22:      if(m_emcStatus->task.state == EMC_TASK_STATE_ON)
11:59:22:                                    ^~~~~~~~~~~~~~~~~
11:59:22:                                    EMC_TASK_STATE
11:59:22: src/linuxcnc.cpp:422:44: error: ‘EMC_TASK_INTERP_IDLE’ was not declared in this scope
11:59:22:          if(m_emcStatus->task.interpState > EMC_TASK_INTERP_IDLE)
11:59:22:                                             ^~~~~~~~~~~~~~~~~~~~
11:59:22: src/linuxcnc.cpp:422:44: note: suggested alternative: ‘EMC_TASK_INTERP
11:59:22:          if(m_emcStatus->task.interpState > EMC_TASK_INTERP_IDLE)
11:59:22:                                             ^~~~~~~~~~~~~~~~~~~~
11:59:22:                                             EMC_TASK_INTERP
11:59:22: src/linuxcnc.cpp:424:42: error: ‘EMC_TASK_MODE_MDI’ was not declared in this scope
11:59:22:              if(m_emcStatus->task.mode == EMC_TASK_MODE_MDI)
11:59:22:                                           ^~~~~~~~~~~~~~~~~
11:59:22: src/linuxcnc.cpp:424:42: note: suggested alternative: ‘EMC_TASK_MODE
11:59:22:              if(m_emcStatus->task.mode == EMC_TASK_MODE_MDI)
11:59:22:                                           ^~~~~~~~~~~~~~~~~
11:59:22:                                           EMC_TASK_MODE
11:59:22: In file included from src/main.cpp:31:
11:59:22: include/linuxcnc.h:68:24: error: ‘EMC_TASK_MODE_ENUM’ does not name a type; did you mean ‘EMC_TASK_MODE’?
11:59:22:      bool SetMode(const EMC_TASK_MODE_ENUM mode);
11:59:22:                         ^~~~~~~~~~~~~~~~~~
11:59:22:                         EMC_TASK_MODE
11:59:22: src/main.cpp:46:12: error: ‘PACKAGE_VERSION’ was not declared in this scope
11:59:22:  string a = PACKAGE_VERSION;
11:59:22:             ^~~~~~~~~~~~~~~
11:59:22: src/linuxcnc.cpp: At global scope:
11:59:22: src/linuxcnc.cpp:568:30: error: ‘EMC_TASK_MODE_ENUM’ does not name a type; did you mean ‘EMC_TASK_MODE’?
11:59:22:  bool LinuxCnc::SetMode(const EMC_TASK_MODE_ENUM mode)
11:59:22:                               ^~~~~~~~~~~~~~~~~~
11:59:22:                               EMC_TASK_MODE
11:59:22: src/linuxcnc.cpp: In member function ‘bool LinuxCnc::SetMode(int)’:
11:59:22: src/linuxcnc.cpp:571:31: error: no match for ‘operator==’ (operand types are ‘EMC_TASK_MODE’ and ‘const int’)
11:59:22:      if(m_emcStatus->task.mode == mode) return true;
11:59:22:         ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
11:59:22: src/linuxcnc.cpp:574:21: error: cannot convert ‘const int’ to ‘EMC_TASK_MODE’ in assignment
11:59:22:      mode_msg.mode = mode;
11:59:22:                      ^~~~
11:59:22: src/linuxcnc.cpp: In member function ‘void LinuxCnc::SendJog(int, double)’:
11:59:22: src/linuxcnc.cpp:593:45: error: ‘EMC_TRAJ_MODE_FREE’ was not declared in this scope
11:59:22:          if(m_emcStatus->motion.traj.mode == EMC_TRAJ_MODE_FREE) emc_jog_cont_msg.jjogmode = JOGJOINT;
11:59:22:                                              ^~~~~~~~~~~~~~~~~~
11:59:22: src/main.cpp:46:12: note: suggested alternative: ‘MSGPACK_VERSION
11:59:22:  string a = PACKAGE_VERSION;
11:59:22:             ^~~~~~~~~~~~~~~
11:59:22:             MSGPACK_VERSION
11:59:22: src/linuxcnc.cpp:593:45: note: suggested alternative: ‘EMC_TRAJ_MODE
11:59:22:          if(m_emcStatus->motion.traj.mode == EMC_TRAJ_MODE_FREE) emc_jog_cont_msg.jjogmode = JOGJOINT;
11:59:22:                                              ^~~~~~~~~~~~~~~~~~
11:59:22:                                              EMC_TRAJ_MODE
11:59:22: src/linuxcnc.cpp:610:45: error: ‘EMC_TRAJ_MODE_FREE’ was not declared in this scope
11:59:22:          if(m_emcStatus->motion.traj.mode == EMC_TRAJ_MODE_FREE) emc_jog_stop_msg.jjogmode = JOGJOINT;
11:59:22:                                              ^~~~~~~~~~~~~~~~~~
11:59:22: src/linuxcnc.cpp:610:45: note: suggested alternative: ‘EMC_TRAJ_MODE
11:59:22:          if(m_emcStatus->motion.traj.mode == EMC_TRAJ_MODE_FREE) emc_jog_stop_msg.jjogmode = JOGJOINT;
11:59:22:                                              ^~~~~~~~~~~~~~~~~~
11:59:22:                                              EMC_TRAJ_MODE
11:59:22: src/linuxcnc.cpp: In member function ‘virtual void LinuxCnc::DrivesOn(bool)’:
11:59:22: src/linuxcnc.cpp:668:27: error: ‘EMC_TASK_STATE_ESTOP_RESET’ was not declared in this scope
11:59:22:          state_msg.state = EMC_TASK_STATE_ESTOP_RESET;
11:59:22:                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
11:59:22: src/linuxcnc.cpp:668:27: note: suggested alternative: ‘EMC_ABORT_TASK_STATE_ESTOP_RESET
11:59:22:          state_msg.state = EMC_TASK_STATE_ESTOP_RESET;
11:59:22:                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
11:59:22:                            EMC_ABORT_TASK_STATE_ESTOP_RESET
11:59:22: src/linuxcnc.cpp:670:27: error: ‘EMC_TASK_STATE_ON’ was not declared in this scope
11:59:22:          state_msg.state = EMC_TASK_STATE_ON;
11:59:22:                            ^~~~~~~~~~~~~~~~~
11:59:22: src/linuxcnc.cpp:670:27: note: suggested alternative: ‘EMC_TASK_STATE
11:59:22:          state_msg.state = EMC_TASK_STATE_ON;
11:59:22:                            ^~~~~~~~~~~~~~~~~
11:59:22:                            EMC_TASK_STATE
11:59:22: src/linuxcnc.cpp:675:27: error: ‘EMC_TASK_STATE_OFF’ was not declared in this scope
11:59:22:          state_msg.state = EMC_TASK_STATE_OFF;
11:59:22:                            ^~~~~~~~~~~~~~~~~~
11:59:22: src/linuxcnc.cpp:675:27: note: suggested alternative: ‘EMC_TASK_STAT_MSG
11:59:22:          state_msg.state = EMC_TASK_STATE_OFF;
11:59:22:                            ^~~~~~~~~~~~~~~~~~
11:59:22:                            EMC_TASK_STAT_MSG
11:59:22: src/linuxcnc.cpp: In member function ‘virtual void LinuxCnc::JogVel(CncRemote::Axes)’:
11:59:22: src/linuxcnc.cpp:684:13: error: ‘EMC_TASK_MODE_MANUAL’ was not declared in this scope
11:59:22:      SetMode(EMC_TASK_MODE_MANUAL);
11:59:22:              ^~~~~~~~~~~~~~~~~~~~
11:59:22: src/linuxcnc.cpp:684:13: note: suggested alternative: ‘EMC_TASK_MODE
11:59:22:      SetMode(EMC_TASK_MODE_MANUAL);
11:59:22:              ^~~~~~~~~~~~~~~~~~~~
11:59:22:              EMC_TASK_MODE
11:59:22: src/linuxcnc.cpp: In member function ‘virtual void LinuxCnc::JogStep(CncRemote::Axes, double)’:
11:59:22: src/linuxcnc.cpp:692:13: error: ‘EMC_TASK_MODE_MANUAL’ was not declared in this scope
11:59:22:      SetMode(EMC_TASK_MODE_MANUAL);
11:59:22:              ^~~~~~~~~~~~~~~~~~~~
11:59:22: src/linuxcnc.cpp:692:13: note: suggested alternative: ‘EMC_TASK_MODE
11:59:22:      SetMode(EMC_TASK_MODE_MANUAL);
11:59:22:              ^~~~~~~~~~~~~~~~~~~~
11:59:22:              EMC_TASK_MODE
11:59:22: src/linuxcnc.cpp: In member function ‘virtual bool LinuxCnc::Mdi(std::__cxx11::string)’:
11:59:22: src/linuxcnc.cpp:709:13: error: ‘EMC_TASK_MODE_MDI’ was not declared in this scope
11:59:22:      SetMode(EMC_TASK_MODE_MDI);
11:59:22:              ^~~~~~~~~~~~~~~~~
11:59:22: src/linuxcnc.cpp:709:13: note: suggested alternative: ‘EMC_TASK_MODE
11:59:22:      SetMode(EMC_TASK_MODE_MDI);
11:59:22:              ^~~~~~~~~~~~~~~~~
11:59:22:              EMC_TASK_MODE
11:59:22: src/linuxcnc.cpp: In member function ‘virtual void LinuxCnc::CycleStart()’:
11:59:22: src/linuxcnc.cpp:795:13: error: ‘EMC_TASK_MODE_AUTO’ was not declared in this scope
11:59:22:      SetMode(EMC_TASK_MODE_AUTO);
11:59:22:              ^~~~~~~~~~~~~~~~~~
11:59:22: src/linuxcnc.cpp:795:13: note: suggested alternative: ‘EMC_TASK_MODE
11:59:22:      SetMode(EMC_TASK_MODE_AUTO);
11:59:22:              ^~~~~~~~~~~~~~~~~~
11:59:22:              EMC_TASK_MODE
11:59:22: src/linuxcnc.cpp: In member function ‘virtual void LinuxCnc::Home(CncRemote::BoolAxes)’:
11:59:22: src/linuxcnc.cpp:856:13: error: ‘EMC_TASK_MODE_MANUAL’ was not declared in this scope
11:59:22:      SetMode(EMC_TASK_MODE_MANUAL);
11:59:22:              ^~~~~~~~~~~~~~~~~~~~
11:59:22: src/linuxcnc.cpp:856:13: note: suggested alternative: ‘EMC_TASK_MODE
11:59:22:      SetMode(EMC_TASK_MODE_MANUAL);
11:59:22:              ^~~~~~~~~~~~~~~~~~~~
11:59:22:              EMC_TASK_MODE
11:59:23: make: *** [makefile:33: obj/main.o] Error 1
11:59:23: make: *** Waiting for unfinished jobs....
11:59:23: make: *** [makefile:33: obj/linuxcnc.o] Error 1
11:59:23: Failed to build the server
11:59:23: ./cncremote-linuxcnc_2.10.0_4.19.0-24-rt-amd64
11:59:23: Pre-built server not found

Hello,

wanted to chime in here, had the same build error with Scanything V2.0.24-64 under the current stable LinuxCNC 2.9.3 as well as latest master branch (2.10), both on Bookworm:

21:00:46: Started
21:00:46: Loading plugins
21:00:46: Timed out calling function
21:00:46: Checking for LinuxCNC server...
21:00:46: LinuxCNC version is 2.9.3
21:00:46: Building src/linuxcnc.cpp
21:00:46: Building src/main.cpp
21:00:48: In file included from src/linuxcnc.cpp:20:
21:00:48: include/linuxcnc.h:68:24: error: ‘EMC_TASK_MODE_ENUM’ does not name a type; did you mean ‘EMC_TASK_MODE’?
21:00:48:    68 |     bool SetMode(const EMC_TASK_MODE_ENUM mode);
21:00:48:       |                        ^~~~~~~~~~~~~~~~~~
21:00:48:       |                        EMC_TASK_MODE
21:00:49: src/linuxcnc.cpp: In member function ‘int LinuxCnc::IniLoad(const char*)’:
21:00:49: src/linuxcnc.cpp:136:42: error: cannot convert ‘std::optional<const char*>’ to ‘const char*’ in assignment
21:00:49:   136 |     if (NULL != (inistring = inifile.Find("DEBUG", "EMC")))
21:00:49:       |                              ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
21:00:49:       |                                          |
21:00:49:       |                                          std::optional<const char*>
21:00:49: src/linuxcnc.cpp:150:42: error: cannot convert ‘std::optional<const char*>’ to ‘const char*’ in assignment
21:00:49:   150 |     if (NULL != (inistring = inifile.Find("NML_FILE", "EMC")))
21:00:49:       |                              ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
21:00:49:       |                                          |
21:00:49:       |                                          std::optional<const char*>
21:00:49: src/linuxcnc.cpp:171:42: error: cannot convert ‘std::optional<const char*>’ to ‘const char*’ in assignment
21:00:49:   171 |     if (NULL != (inistring = inifile.Find("LINEAR_UNITS", "DISPLAY")))
21:00:49:       |                              ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
21:00:49:       |                                          |
21:00:49:       |                                          std::optional<const char*>
21:00:49: In file included from src/main.cpp:31:
21:00:49: include/linuxcnc.h:68:24: error: ‘EMC_TASK_MODE_ENUM’ does not name a type; did you mean ‘EMC_TASK_MODE’?
21:00:49:    68 |     bool SetMode(const EMC_TASK_MODE_ENUM mode);
21:00:49:       |                        ^~~~~~~~~~~~~~~~~~
21:00:49:       |                        EMC_TASK_MODE
21:00:49: src/linuxcnc.cpp: In member function ‘virtual void LinuxCnc::UpdateState(CncRemote::State&)’:
21:00:49: src/linuxcnc.cpp:411:35: error: ‘EMC_TASK_STATE_ON’ was not declared in this scope; did you mean ‘EMC_TASK_STATE’?
21:00:49:   411 |     if(m_emcStatus->task.state == EMC_TASK_STATE_ON)
21:00:49:       |                                   ^~~~~~~~~~~~~~~~~
21:00:49:       |                                   EMC_TASK_STATE
21:00:49: src/linuxcnc.cpp:422:44: error: ‘EMC_TASK_INTERP_IDLE’ was not declared in this scope; did you mean ‘EMC_TASK_INTERP’?
21:00:49:   422 |         if(m_emcStatus->task.interpState > EMC_TASK_INTERP_IDLE)
21:00:49:       |                                            ^~~~~~~~~~~~~~~~~~~~
21:00:49:       |                                            EMC_TASK_INTERP
21:00:49: src/linuxcnc.cpp:424:42: error: ‘EMC_TASK_MODE_MDI’ was not declared in this scope; did you mean ‘EMC_TASK_MODE’?
21:00:49:   424 |             if(m_emcStatus->task.mode == EMC_TASK_MODE_MDI)
21:00:49:       |                                          ^~~~~~~~~~~~~~~~~
21:00:49:       |                                          EMC_TASK_MODE
21:00:49: src/linuxcnc.cpp: At global scope:
21:00:49: src/linuxcnc.cpp:568:30: error: ‘EMC_TASK_MODE_ENUM’ does not name a type; did you mean ‘EMC_TASK_MODE’?
21:00:49:   568 | bool LinuxCnc::SetMode(const EMC_TASK_MODE_ENUM mode)
21:00:49:       |                              ^~~~~~~~~~~~~~~~~~
21:00:49:       |                              EMC_TASK_MODE
21:00:49: src/linuxcnc.cpp: In member function ‘bool LinuxCnc::SetMode(int)’:
21:00:49: src/linuxcnc.cpp:571:31: error: no match for ‘operator==’ (operand types are ‘EMC_TASK_MODE’ and ‘const int’)
21:00:49:   571 |     if(m_emcStatus->task.mode == mode) return true;
21:00:49:       |        ~~~~~~~~~~~~~~~~~~~~~~ ^~ ~~~~
21:00:49:       |                          |       |
21:00:49:       |                          |       const int
21:00:49:       |                          EMC_TASK_MODE
21:00:49: src/linuxcnc.cpp:574:21: error: cannot convert ‘const int’ to ‘EMC_TASK_MODE’ in assignment
21:00:49:   574 |     mode_msg.mode = mode;
21:00:49:       |                     ^~~~
21:00:49:       |                     |
21:00:49:       |                     const int
21:00:49: src/linuxcnc.cpp: In member function ‘void LinuxCnc::SendJog(int, double)’:
21:00:49: src/linuxcnc.cpp:593:45: error: ‘EMC_TRAJ_MODE_FREE’ was not declared in this scope; did you mean ‘EMC_TRAJ_MODE’?
21:00:49:   593 |         if(m_emcStatus->motion.traj.mode == EMC_TRAJ_MODE_FREE) emc_jog_cont_msg.jjogmode = JOGJOINT;
21:00:49:       |                                             ^~~~~~21:03:15: Started
21:03:15: Loading plugins
21:03:15: Timed out calling function
21:03:15: Checking for LinuxCNC server...
21:03:15: LinuxCNC version is 2.9.3
21:03:15: Creating include/version.h
21:03:15: Building src/linuxcnc.cpp
21:03:15: Building src/main.cpp
21:03:15: Building src/cnccomms.cpp
21:03:16: src/linuxcnc.cpp: In member function ‘int LinuxCnc::IniLoad(const char*)’:
21:03:16: src/linuxcnc.cpp:136:42: error: cannot convert ‘std::optional<const char*>’ to ‘const char*’ in assignment
21:03:16:   136 |     if (NULL != (inistring = inifile.Find("DEBUG", "EMC")))
21:03:16:       |                              ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
21:03:16:       |                                          |
21:03:16:       |                                          std::optional<const char*>
21:03:16: src/linuxcnc.cpp:150:42: error: cannot convert ‘std::optional<const char*>’ to ‘const char*’ in assignment
21:03:16:   150 |     if (NULL != (inistring = inifile.Find("NML_FILE", "EMC")))
21:03:16:       |                              ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
21:03:16:       |                                          |
21:03:16:       |                                          std::optional<const char*>
21:03:16: src/linuxcnc.cpp:171:42: error: cannot convert ‘std::optional<const char*>’ to ‘const char*’ in assignment
21:03:16:   171 |     if (NULL != (inistring = inifile.Find("LINEAR_UNITS", "DISPLAY")))
21:03:16:       |                              ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
21:03:16:       |                                          |
21:03:16:       |                                          std::optional<const char*>
21:03:16: src/linuxcnc.cpp: In member function ‘virtual void LinuxCnc::UpdateState(CncRemote::State&)’:
21:03:16: src/linuxcnc.cpp:411:35: error: ‘EMC_TASK_STATE_ON’ was not declared in this scope; did you mean ‘EMC_TASK_STATE’?
21:03:16:   411 |     if(m_emcStatus->task.state == EMC_TASK_STATE_ON)
21:03:16:       |                                   ^~~~~~~~~~~~~~~~~
21:03:16:       |                                   EMC_TASK_STATE
21:03:16: src/linuxcnc.cpp:422:44: error: ‘EMC_TASK_INTERP_IDLE’ was not declared in this scope; did you mean ‘EMC_TASK_INTERP’?
21:03:16:   422 |         if(m_emcStatus->task.interpState > EMC_TASK_INTERP_IDLE)
21:03:16:       |                                            ^~~~~~~~~~~~~~~~~~~~
21:03:16:       |                                            EMC_TASK_INTERP
21:03:16: src/linuxcnc.cpp:424:42: error: ‘EMC_TASK_MODE_MDI’ was not declared in this scope; did you mean ‘EMC_TASK_MODE’?
21:03:16:   424 |             if(m_emcStatus->task.mode == EMC_TASK_MODE_MDI)
21:03:16:       |                                          ^~~~~~~~~~~~~~~~~
21:03:16:       |                                          EMC_TASK_MODE
21:03:17: src/linuxcnc.cpp: At global scope:
21:03:17: src/linuxcnc.cpp:568:30: error: ‘EMC_TASK_MODE_ENUM’ does not name a type; did you mean ‘EMC_TASK_MODE’?
21:03:17:   568 | bool LinuxCnc::SetMode(const EMC_TASK_MODE_ENUM mode)
21:03:17:       |                              ^~~~~~~~~~~~~~~~~~
21:03:17:       |                              EMC_TASK_MODE
21:03:17: src/linuxcnc.cpp:568:6: error: no declaration matches ‘bool LinuxCnc::SetMode(int)
21:03:17:   568 | bool LinuxCnc::SetMode(const EMC_TASK_MODE_ENUM mode)
21:03:17:       |      ^~~~~~~~
21:03:17: In file included from src/linuxcnc.cpp:20:
21:03:17: include/linuxcnc.h:68:10: note: candidate is: ‘bool LinuxCnc::SetMode(EMC_TASK_MODE)
21:03:17:    68 |     bool SetMode(const EMC_TASK_MODE mode);
21:03:17:       |          ^~~~~~~
21:03:17: include/linuxcnc.h:56:7: note: ‘class LinuxCnc’ defined here
21:03:17:    56 | class LinuxCnc : public CncRemote::Server
21:03:17:       |       ^~~~~~~~
21:03:17: src/linuxcnc.cpp: In member function ‘void LinuxCnc::SendJog(int, double)’:
21:03:17: src/linuxcnc.cpp:593:45: error: ‘EMC_TRAJ_MODE_FREE’ was not declared in this scope; did you mean ‘EMC_TRAJ_MODE’?
21:03:17:   593 |         if(m_emcStatus->motion.traj.mode == EMC_TRAJ_MODE_FREE) emc_jog_cont_msg.jjogmode = JOGJOINT;
21:03:17:       |                                             ^~~~~~~~~~~~~~~~~~
21:03:17:       |                                             EMC_TRAJ_MODE
21:03:17: src/linuxcnc.cpp:610:45: error: ‘EMC_TRAJ_MODE_FREE’ was not declared in this scope; did you mean ‘EMC_TRAJ_MODE’?
21:03:17:   610 |         if(m_emcStatus->motion.traj.mode == EMC_TRAJ_MODE_FREE) emc_jog_stop_msg.jjogmode = JOGJOINT;
21:03:17:       |                                             ^~~~~~~~~~~~~~~~~~
21:03:17:       |                                             EMC_TRAJ_MODE
21:03:17: src/linuxcnc.cpp: In member function ‘virtual void LinuxCnc::DrivesOn(bool)’:
21:03:17: src/linuxcnc.cpp:668:27: error: ‘EMC_TASK_STATE_ESTOP_RESET’ was not declared in this scope; did you mean ‘EMC_TASK_STAT_TYPE’?
21:03:17:   668 |         state_msg.state = EMC_TASK_STATE_ESTOP_RESET;
21:03:17:       |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
21:03:17:       |                           EMC_TASK_STAT_TYPE
21:03:17: src/linuxcnc.cpp:670:27: error: ‘EMC_TASK_STATE_ON’ was not declared in this scope; did you mean ‘EMC_TASK_STATE’?
21:03:17:   670 |         state_msg.state = EMC_TASK_STATE_ON;
21:03:17:       |                           ^~~~~~~~~~~~~~~~~
21:03:17:       |                           EMC_TASK_STATE
21:03:17: src/linuxcnc.cpp:675:27: error: ‘EMC_TASK_STATE_OFF’ was not declared in this scope; did you mean ‘EMC_TASK_STAT_MSG’?
21:03:17:   675 |         state_msg.state = EMC_TASK_STATE_OFF;
21:03:17:       |                           ^~~~~~~~~~~~~~~~~~
21:03:17:       |                           EMC_TASK_STAT_MSG
21:03:17: src/linuxcnc.cpp: In member function ‘virtual void LinuxCnc::JogVel(CncRemote::Axes)’:
21:03:17: src/linuxcnc.cpp:684:13: error: ‘EMC_TASK_MODE_MANUAL’ was not declared in this scope; did you mean ‘EMC_TASK_MODE’?
21:03:17:   684 |     SetMode(EMC_TASK_MODE_MANUAL);
21:03:17:       |             ^~~~~~~~~~~~~~~~~~~~
21:03:17:       |             EMC_TASK_MODE
21:03:17: src/linuxcnc.cpp: In member function ‘virtual void LinuxCnc::JogStep(CncRemote::Axes, double)’:
21:03:17: src/linuxcnc.cpp:692:13: error: ‘EMC_TASK_MODE_MANUAL’ was not declared in this scope; did you mean ‘EMC_TASK_MODE’?
21:03:17:   692 |     SetMode(EMC_TASK_MODE_MANUAL);
21:03:17:       |             ^~~~~~~~~~~~~~~~~~~~
21:03:17:       |             EMC_TASK_MODE
21:03:17: src/linuxcnc.cpp: In member function ‘virtual bool LinuxCnc::Mdi(std::string)’:
21:03:17: src/linuxcnc.cpp:709:13: error: ‘EMC_TASK_MODE_MDI’ was not declared in this scope; did you mean ‘EMC_TASK_MODE’?
21:03:17:   709 |     SetMode(EMC_TASK_MODE_MDI);
21:03:17:       |             ^~~~~~~~~~~~~~~~~
21:03:17:       |             EMC_TASK_MODE
21:03:17: src/linuxcnc.cpp: In member function ‘virtual void LinuxCnc::CycleStart()’:
21:03:17: src/linuxcnc.cpp:795:13: error: ‘EMC_TASK_MODE_AUTO’ was not declared in this scope; did you mean ‘EMC_TASK_MODE’?
21:03:17:   795 |     SetMode(EMC_TASK_MODE_AUTO);
21:03:17:       |             ^~~~~~~~~~~~~~~~~~
21:03:17:       |             EMC_TASK_MODE
21:03:17: src/linuxcnc.cpp: In member function ‘virtual void LinuxCnc::Home(CncRemote::BoolAxes)’:
21:03:17: src/linuxcnc.cpp:856:13: error: ‘EMC_TASK_MODE_MANUAL’ was not declared in this scope; did you mean ‘EMC_TASK_MODE’?
21:03:17:   856 |     SetMode(EMC_TASK_MODE_MANUAL);
21:03:17:       |             ^~~~~~~~~~~~~~~~~~~~
21:03:17:       |             EMC_TASK_MODE
21:03:17: Building src/cncplugin.cpp
21:03:17: make: *** [makefile:34: obj/linuxcnc.o] Error 1
21:03:17: make: *** Waiting for unfinished jobs....
21:03:18: Failed to build the server
21:03:18: ./cncremote-linuxcnc_2.9.3_6.1.0-26-rt-amd64
21:03:18: Pre-built server not found
~~~~~~~~~~~~
21:00:49:       |                                             EMC_TRAJ_MODE
21:00:49: src/linuxcnc.cpp:610:45: error: ‘EMC_TRAJ_MODE_FREE’ was not declared in this scope; did you mean ‘EMC_TRAJ_MODE’?
21:00:49:   610 |         if(m_emcStatus->motion.traj.mode == EMC_TRAJ_MODE_FREE) emc_jog_stop_msg.jjogmode = JOGJOINT;
21:00:49:       |                                             ^~~~~~~~~~~~~~~~~~
21:00:49:       |                                             EMC_TRAJ_MODE
21:00:49: src/linuxcnc.cpp: In member function ‘virtual void LinuxCnc::DrivesOn(bool)’:
21:00:49: src/linuxcnc.cpp:668:27: error: ‘EMC_TASK_STATE_ESTOP_RESET’ was not declared in this scope; did you mean ‘EMC_TASK_STAT_TYPE’?
21:00:49:   668 |         state_msg.state = EMC_TASK_STATE_ESTOP_RESET;
21:00:49:       |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
21:00:49:       |                           EMC_TASK_STAT_TYPE
21:00:49: src/linuxcnc.cpp:670:27: error: ‘EMC_TASK_STATE_ON’ was not declared in this scope; did you mean ‘EMC_TASK_STATE’?
21:00:49:   670 |         state_msg.state = EMC_TASK_STATE_ON;
21:00:49:       |                           ^~~~~~~~~~~~~~~~~
21:00:49:       |                           EMC_TASK_STATE
21:00:49: src/linuxcnc.cpp:675:27: error: ‘EMC_TASK_STATE_OFF’ was not declared in this scope; did you mean ‘EMC_TASK_STAT_MSG’?
21:00:49:   675 |         state_msg.state = EMC_TASK_STATE_OFF;
21:00:49:       |                           ^~~~~~~~~~~~~~~~~~
21:00:49:       |                           EMC_TASK_STAT_MSG
21:00:49: src/linuxcnc.cpp: In member function ‘virtual void LinuxCnc::JogVel(CncRemote::Axes)’:
21:00:49: src/linuxcnc.cpp:684:13: error: ‘EMC_TASK_MODE_MANUAL’ was not declared in this scope; did you mean ‘EMC_TASK_MODE’?
21:00:49:   684 |     SetMode(EMC_TASK_MODE_MANUAL);
21:00:49:       |             ^~~~~~~~~~~~~~~~~~~~
21:00:49:       |             EMC_TASK_MODE
21:00:49: src/linuxcnc.cpp: In member function ‘virtual void LinuxCnc::JogStep(CncRemote::Axes, double)’:
21:00:49: src/linuxcnc.cpp:692:13: error: ‘EMC_TASK_MODE_MANUAL’ was not declared in this scope; did you mean ‘EMC_TASK_MODE’?
21:00:49:   692 |     SetMode(EMC_TASK_MODE_MANUAL);
21:00:49:       |             ^~~~~~~~~~~~~~~~~~~~
21:00:49:       |             EMC_TASK_MODE
21:00:49: src/linuxcnc.cpp: In member function ‘virtual bool LinuxCnc::Mdi(std::string)’:
21:00:49: src/linuxcnc.cpp:709:13: error: ‘EMC_TASK_MODE_MDI’ was not declared in this scope; did you mean ‘EMC_TASK_MODE’?
21:00:49:   709 |     SetMode(EMC_TASK_MODE_MDI);
21:00:49:       |             ^~~~~~~~~~~~~~~~~
21:00:49:       |             EMC_TASK_MODE
21:00:49: src/linuxcnc.cpp: In member function ‘virtual void LinuxCnc::CycleStart()’:
21:00:49: src/linuxcnc.cpp:795:13: error: ‘EMC_TASK_MODE_AUTO’ was not declared in this scope; did you mean ‘EMC_TASK_MODE’?
21:00:49:   795 |     SetMode(EMC_TASK_MODE_AUTO);
21:00:49:       |             ^~~~~~~~~~~~~~~~~~
21:00:49:       |             EMC_TASK_MODE
21:00:49: make: *** [makefile:34: obj/main.o] Error 1
21:00:49: make: *** Waiting for unfinished jobs....
21:00:49: src/linuxcnc.cpp: In member function ‘virtual void LinuxCnc::Home(CncRemote::BoolAxes)’:
21:00:49: src/linuxcnc.cpp:856:13: error: ‘EMC_TASK_MODE_MANUAL’ was not declared in this scope; did you mean ‘EMC_TASK_MODE’?
21:00:49:   856 |     SetMode(EMC_TASK_MODE_MANUAL);
21:00:49:       |             ^~~~~~~~~~~~~~~~~~~~
21:00:49:       |             EMC_TASK_MODE
21:00:50: make: *** [makefile:34: obj/linuxcnc.o] Error 1
21:00:50: Failed to build the server
21:00:50: ./cncremote-linuxcnc_2.9.3_6.1.0-26-rt-amd64
21:00:50: Pre-built server not found

I took a closer look into the affected files include/linuxcnc.h and src/linuxcnc.cpp and noticed that most of the errors should have their origin in differing naming conventions. Heading over to their github repository and having a quick glimpse over some source files revealed that instead of an underscore, in the newer versions the last attributes seem to get separated by two colons, f.e.

EMC_TASK_MODE_MDI is now EMC_TASK_MODE::MDI
EMC_TASK_STATE_ON is now EMC_TASK_STATE::ON

etc.

Well, these were quickly changed and after that only 3 error messages remained, yay:

21:38:09: Started
21:38:09: Loading plugins
21:38:09: Timed out calling function
21:38:09: Checking for LinuxCNC server...
21:38:09: LinuxCNC version is 2.9.3
21:38:09: Creating include/version.h
21:38:09: Building src/linuxcnc.cpp
21:38:09: Building src/main.cpp
21:38:09: Building src/cnccomms.cpp
21:38:11: src/linuxcnc.cpp: In member function ‘int LinuxCnc::IniLoad(const char*)’:
21:38:11: src/linuxcnc.cpp:136:42: error: cannot convert ‘std::optional<const char*>’ to ‘const char*’ in assignment
21:38:11:   136 |     if (NULL != (inistring = inifile.Find("DEBUG", "EMC")))
21:38:11:       |                              ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
21:38:11:       |                                          |
21:38:11:       |                                          std::optional<const char*>
21:38:11: src/linuxcnc.cpp:150:42: error: cannot convert ‘std::optional<const char*>’ to ‘const char*’ in assignment
21:38:11:   150 |     if (NULL != (inistring = inifile.Find("NML_FILE", "EMC")))
21:38:11:       |                              ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
21:38:11:       |                                          |
21:38:11:       |                                          std::optional<const char*>
21:38:11: src/linuxcnc.cpp:171:42: error: cannot convert ‘std::optional<const char*>’ to ‘const char*’ in assignment
21:38:11:   171 |     if (NULL != (inistring = inifile.Find("LINEAR_UNITS", "DISPLAY")))
21:38:11:       |                              ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
21:38:11:       |                                          |
21:38:11:       |                                          std::optional<const char*>
21:38:11: Building src/cncplugin.cpp
21:38:11: Building src/cncserver.cpp
21:38:12: make: *** [makefile:34: obj/linuxcnc.o] Error 1
21:38:12: make: *** Waiting for unfinished jobs....
21:38:17: Failed to build the server
21:38:17: ./cncremote-linuxcnc_2.9.3_6.1.0-26-rt-amd64
21:38:17: Pre-built server not found

I tried to find references to these messages, but quickly realized that these will need more insight… so i took the quick’n’dirty road and just commented out these lines as well as the following else-if loops. And that brought me to the known old error mentioned here before about a version mismatch in line 46 of main.cpp.

Commented that out as well…and et voila: Scanything was up and running together with LinuxCNC 2.9.3 and 2.10 :slight_smile:

I get constant messages about the client reconnecting to the server, but at least on a simulated machine this seems to work, the virtual machine in LinuxCNC moves while i manually move a camera.

If this helpful for further testing, here are the patches:

linuxcnc.h.patch.txt (535 Bytes)
main.cpp.patch.txt (277 Bytes)
linuxcnc.cpp.patch.txt (6.2 KB)


Best Regards,
-lgitano

Well, finally came to test this on a working setup with LinuXCNC 2.10 from buildbot, and with the above patches applied → works fine :slight_smile:

Note the constant “Machine running and homed” - “Machine not ready” messages in the log window, probably some stuff which needs to get fixed in the linuxserver component or in the main program. Apart from that → it works, except for the ability to save the results, of course.

Cheers,
-lgitano

Thanks for the input. I was able to get it running a while back, by the way, on Bookworm. Never on Buster.

Regards,
Butch

Hey, glad to hear You got it running, do You remember under which LinuxCNC version?

Best Regards,
-lgitano

linuxcnc version 2.9.2 with debian Bookworm
Had to comment out line 46 in main.cpp

1 Like