zenustech / zeno

ZEn NOde system - a simulation & rendering engine in nodes
http://zenustech.com
Mozilla Public License 2.0
1.24k stars 150 forks source link

error: 'class ZenoApplication' has no member named 'getServer' #1908

Closed Martinfx closed 5 months ago

Martinfx commented 5 months ago

Describe the bug (both Chinese and English are OK) I build source code with patches and i have problem with declares

CMAKE_ON= ZENO_BUILD_EDITOR ZENO_BUILD_PLAYER ZENO_MULTIPROCESS \ ZENO_IPC_USE_TCP ZENO_BUILD_SHARED ZENO_USE_CCACHE ZENO_NO_WARNING CMAKE_OFF= ZENO_BUILD_DESIGNER ZENO_INSTALL_TARGET ZENO_WITH_CUDA ZENO_MARCH_NATIVE ZENO_USE_FAST_MATH \ ZENO_OPTIX_PROC ZENO_WIN32_RC

How To Reproduce git clone this repo https://github.com/Martinfx/FreeBSD-Ports/pull/127/files sudo make

Screenshots


In file included from /wrkdirs/usr/ports/graphics/zeno/work/zeno-2023.11.16/ui/zenoedit/./viewportinteraction/transform.h:7,
                 from /wrkdirs/usr/ports/graphics/zeno/work/zeno-2023.11.16/ui/zenoedit/./viewport/viewportwidget.h:10,
                 from /wrkdirs/usr/ports/graphics/zeno/work/zeno-2023.11.16/ui/zenoedit/./util/apphelper.h:12:
/wrkdirs/usr/ports/graphics/zeno/work/zeno-2023.11.16/ui/zenoedit/./viewportinteraction/nodesync.h: In member function 'bool zeno::NodeSyncMgr::getNewValue(const QVariant&, const QVector<T>&, QVariant&)':
/wrkdirs/usr/ports/graphics/zeno/work/zeno-2023.11.16/ui/zenoedit/./viewportinteraction/nodesync.h:75:46: warning: invalid use of incomplete type 'class ZenoMainWindow'
   75 |                     auto pTimeline = pMainWin->timeline();
      |                                              ^~
In file included from /wrkdirs/usr/ports/graphics/zeno/work/zeno-2023.11.16/ui/zenoedit/launch/viewdecode.cpp:3:
/wrkdirs/usr/ports/graphics/zeno/work/zeno-2023.11.16/ui/zenoedit/./zenoapplication.h:11:7: note: forward declaration of 'class ZenoMainWindow'
   11 | class ZenoMainWindow;
      |       ^~~~~~~~~~~~~~
/wrkdirs/usr/ports/graphics/zeno/work/zeno-2023.11.16/ui/zenoedit/launch/viewdecode.cpp: In member function 'bool {anonymous}::PacketProc::processPacket(const std::string&, const std::string&, const char*, size_t)':
/wrkdirs/usr/ports/graphics/zeno/work/zeno-2023.11.16/ui/zenoedit/launch/viewdecode.cpp:99:39: error: 'class ZenoApplication' has no member named 'getServer'
   99 |             auto tcpServer = zenoApp->getServer();
      |                                       ^~~~~~~~~
/wrkdirs/usr/ports/graphics/zeno/work/zeno-2023.11.16/ui/zenoedit/launch/viewdecode.cpp:111:39: error: 'class ZenoApplication' has no member named 'getServer'
  111 |             auto tcpServer = zenoApp->getServer();
      |                                       ^~~~~~~~~
/wrkdirs/usr/ports/graphics/zeno/work/zeno-2023.11.16/ui/zenoedit/launch/viewdecode.cpp:140:17: error: 'ZTcpServer' was not declared in this scope; did you mean 'LiveTcpServer'?
  140 |                 ZTcpServer* pServer = zenoApp->getServer();
      |                 ^~~~~~~~~~
      |                 LiveTcpServer
/wrkdirs/usr/ports/graphics/zeno/work/zeno-2023.11.16/ui/zenoedit/launch/viewdecode.cpp:140:29: error: 'pServer' was not declared in this scope
  140 |                 ZTcpServer* pServer = zenoApp->getServer();
      |                             ^~~~~~~
/wrkdirs/usr/ports/graphics/zeno/work/zeno-2023.11.16/ui/zenoedit/launch/viewdecode.cpp:140:48: error: 'class ZenoApplication' has no member named 'getServer'
  140 |                 ZTcpServer* pServer = zenoApp->getServer();
      |        
```                                        ^~~~~~~~~

**Environment**

   *  System: FreeBSD 13.2
   * Zeno Version: 2023.11.16
   * GCC gcc version 13.2.0 (FreeBSD Ports Collection)
teachmain commented 5 months ago

The visibility of setServer() is control by the macro, in file ui/zenoedit/zenoapplication.cpp. near lines 178.

#if defined(ZENO_MULTIPROCESS) && defined(ZENO_IPC_USE_TCP)
ZTcpServer* ZenoApplication::getServer()
{
    if (!m_server) {
        m_server = new ZTcpServer(this);
        m_server->init(QHostAddress::LocalHost);
    }
    return m_server;
}
#endif

These def should be exist if you enable ZENO_MULTIPROCESS and ZENO_IPC_USE_TCP at the same time. And these def is control by cmake, as far as I know, no one ever manually change it. So I suggest you manually add these def, and see if it's the problem of cmake stuff. We never met this in linux/win, and none of us know about the freeBSD or have environment to quickly reproduce, sorry for no more info. Personally, I mainly focus on rendering system, So I cannot help you in this way. But I can @ someone for you.

teachmain commented 5 months ago

@legobadman @archibate

Martinfx commented 5 months ago

The visibility of setServer() is control by the macro, in file ui/zenoedit/zenoapplication.cpp. near lines 178.

#if defined(ZENO_MULTIPROCESS) && defined(ZENO_IPC_USE_TCP)
ZTcpServer* ZenoApplication::getServer()
{
    if (!m_server) {
        m_server = new ZTcpServer(this);
        m_server->init(QHostAddress::LocalHost);
    }
    return m_server;
}
#endif

These def should be exist if you enable ZENO_MULTIPROCESS and ZENO_IPC_USE_TCP at the same time. And these def is control by cmake, as far as I know, no one ever manually change it. So I suggest you manually add these def, and see if it's the problem of cmake stuff. We never met this in linux/win, and none of us know about the freeBSD or have environment to quickly reproduce, sorry for no more info. Personally, I mainly focus on rendering system, So I cannot help you in this way. But I can @ someone for you.

I see now. I am sorry I will enable both macro

Martinfx commented 5 months ago

I enable both macros but still there is problem

/wrkdirs/usr/ports/graphics/zeno/work/zeno-2023.11.16/ui/zenoedit/launch/offlinemain.cpp: In function 'int offline_main(const QCoreApplication&)':
/wrkdirs/usr/ports/graphics/zeno/work/zeno-2023.11.16/ui/zenoedit/launch/offlinemain.cpp:71:5: error: 'ZTcpServer' was not declared in this scope; did you mean 'LiveTcpServer'?
   71 |     ZTcpServer* server = zenoApp->getServer();
      |     ^~~~~~~~~~
      |     LiveTcpServer
/wrkdirs/usr/ports/graphics/zeno/work/zeno-2023.11.16/ui/zenoedit/launch/offlinemain.cpp:71:17: error: 'server' was not declared in this scope
   71 |     ZTcpServer* server = zenoApp->getServer();
      |                 ^~~~~~
/wrkdirs/usr/ports/graphics/zeno/work/zeno-2023.11.16/ui/zenoedit/launch/offlinemain.cpp:71:35: error: 'class ZenoApplication' has no member named 'getServer'
   71 |     ZTcpServer* server = zenoApp->getServer();
      |                                   ^~~~~~~~~
/wrkdirs/usr/ports/graphics/zeno/work/zeno-2023.11.16/ui/zenoedit/launch/offlinemain.cpp:73:35: error: 'ZTcpServer' is not a class, namespace, or enumeration
   73 |         QObject::connect(server, &ZTcpServer::runFinished, [=]() {
teachmain commented 5 months ago

well, I try to reproduce it in linux by download the old code and set -DZENO_MULTIPROCESS=OFF, I get the same errors,

图片

but once I add these two lines directly into cmake file: ui/zenoedit/CMakeLists.txt like this:

图片

It will pass even I set -DZENO_MULTIPROCESS=OFF, So I still think it's something wrong inside cmake. Cause this small part is simple enough.

teachmain commented 5 months ago

But It is a bug in this case, we will see how to fix it without enable these options by force

teachmain commented 5 months ago

Also, you can try to set -DCMAKE_VERBOSE_MAKEFILE=ON to get more details of compile commands, it will help to check if cmake pass the right parameters to gcc

Martinfx commented 5 months ago

I build with clang with this patches temporary https://github.com/Martinfx/FreeBSD-Ports/pull/127/commits/1de3b84cbc10e13020d741412871329a9704d623