[yast-devel] Re: own server component in YaST, symbol not found
(full quote for the list) On Sun, Nov 07, 2010 at 12:09:22AM +0100, Pavel Nemec wrote:
Hi Martin, today I finaly find sime time to dig into Yast again.
I realize that I will need my own starter. It is because I need to set communication handler and doing that when UI start is overhead. (and I also need to start it from linked program and not as external app)
So I am trying to create my own genericsfrontend.cc Which at the and wasn`t so hard.
Problem is that for some reason I cant load client from "ycp". Y2Component *client = Y2ComponentBroker::createClient(client_name);
will print into logs that it only look in pathsearch.cc(findy2exe) and pathsearch.cc(findy2plugin)
For some reason Y2CCWFM.cc do not kick in and client is always null.
I looked into genericsfrontend.cc how path is created, but I only fond
YCPPathSearch::initialize();
Which I am using too.
Hi Pavel, the problem is that, contrary to expectations, the WFM plugin needs to be linked explicitly to the executable. I am attaching a modified version of your source which I have successfully compiled and run. See the inlined compilation command there. Also compare how we link the actual y2base program: http://svn.opensuse.org/svn/yast/trunk/core/base/src/Makefile.am Good luck with your work. I've connected to you on GTalk and I'll try to hang out on IRC in the evenings too so that we can connect faster. Martin
This is log I get with my program: ... /home/pavel/.yast2/clients_non_y2/nfs 2010-11-06 23:26:54 <0> deepblue(26442) [libycp] pathsearch.cc(findy2exe):210 Trying file /home/pavel/.yast2/clients/nfs 2010-11-06 23:26:54 <0> deepblue(26442) [libycp] pathsearch.cc(findy2plugin):233 Testing existence of plugin /usr/lib/YaST2/plugin/libpy2nfs.so.2 2010-11-06 23:26:54 <0> deepblue(26442) [libycp] pathsearch.cc(findy2exe):210 Trying file /usr/lib/YaST2/clients_non_y2/nfs 2010-11-06 23:26:54 <0> deepblue(26442) [libycp] pathsearch.cc(findy2exe):210 Trying file /usr/lib/YaST2/clients/nfs 2010-11-06 23:26:54 <3> deepblue(26442) [CustomLoader] loader/CustomLoader.cpp(main):39 client is null, exiting
This is how it should look like: ...2010-11-06 23:26:21 <0> deepblue(26415) [wfm] Y2CCWFM.cc(createInLevel):67 Trying to create nfs 2010-11-06 23:26:21 <0> deepblue(26415) [libycp] pathsearch.cc(findy2exe):210 Trying file /y2update/clients_non_y2/nfs 2010-11-06 23:26:21 <0> deepblue(26415) [libycp] pathsearch.cc(findy2exe):210 Trying file /y2update/clients/nfs 2010-11-06 23:26:21 <0> deepblue(26415) [libycp] pathsearch.cc(findy2plugin):233 Testing existence of plugin /home/pavel/.yast2/plugin/libpy2nfs.so.2 2010-11-06 23:26:21 <0> deepblue(26415) [wfm] Y2CCWFM.cc(createInLevel):67 Trying to create nfs 2010-11-06 23:26:21 <0> deepblue(26415) [libycp] pathsearch.cc(findy2exe):210 Trying file /home/pavel/.yast2/clients_non_y2/nfs 2010-11-06 23:26:21 <0> deepblue(26415) [libycp] pathsearch.cc(findy2exe):210 Trying file /home/pavel/.yast2/clients/nfs 2010-11-06 23:26:21 <0> deepblue(26415) [libycp] pathsearch.cc(findy2plugin):233 Testing existence of plugin
Please use you magic insight and tell me what I am missing to call/set.
Thanks, Pavel
/* * CustomLoader.cpp * * Created on: Nov 6, 2010 * Author: pavel */
#include "CustomLoader.h"
CustomLoader::CustomLoader() { // TODO Auto-generated constructor stub
}
CustomLoader::~CustomLoader() { // TODO Auto-generated destructor stub }
int main(int argc, char **argv) { char *progname = "CustomLoader"; char *client_name="nfs"; char *server_name = "jast"; char **server_argv = new char *[0];
YCPPathSearch::initialize(); string module = YCPPathSearch::findModule("nfs",true); y2milestone("Launched YaST2 component '%s' jast", progname); Y2ComponentBroker::getNamespaceComponent("UI"); Y2Component *server = Y2ComponentBroker::createServer(server_name); server->setServerOptions(0, server_argv); Y2Component *client = Y2ComponentBroker::createClient(client_name);
if(!server){ y2error("server is null, exiting"); exit(1); } if(!client){ y2error("client is null, exiting"); exit(1); }
setenv("YAST_IS_RUNNING", "instsys", 1); y2milestone("YAST_IS_RUNNING is %s", getenv("YAST_IS_RUNNING"));
YCPList arglist; YCPValue result = client->doActualWork(arglist, server); server->result(result);
// Cleanup delete server; delete[] server_argv; delete client;
// might be useful in tracking segmentation faults y2milestone("Finished YaST2 component '%s'", progname);
if (result.isNull()) exit(0);
y2milestone("Exiting with client return value '%s'", result->toString().c_str()); }
-- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
participants (1)
-
Martin Vidner