COVESA / capicxx-someip-tools

Common API C++ SOMEIP tooling
Mozilla Public License 2.0
78 stars 54 forks source link

HelloWorld running issue #22

Open catalinolteanu opened 3 years ago

catalinolteanu commented 3 years ago

Hi,

I've built the HelloWorld(described in the wiki), for vsomeip3. After a small change in CMakeLists(for linking with vsomeip3 and some generated cpp file name), I managed to have two binaries(HelloWorldClient and HelloWorldService).

I've configured the /etc/commonapi.ini to something like: [default] binding=someip

[logging] console = true file = ./mylog.log dlt = false level = verbose

Now, I have this output, that shows missing the test library and configuration module: @catalin-virt:/sources/genivi/project/build$ [CAPI][INFO] Loading configuration file '/etc/commonapi.ini' [CAPI][INFO] Using default binding 'someip' [CAPI][INFO] Using default shared library folder '/usr/local/lib/commonapi' [CAPI][DEBUG] Added address mapping: local:commonapi.HelloWorld:v1_0:test <--> [1234.5678(1.0)] [CAPI][INFO] Registering function for creating "commonapi.HelloWorld:v1_0" stub adapter. [CAPI][DEBUG] Loading library for local:commonapi.HelloWorld:v1_0:test stub. [CAPI][DEBUG] Loading interface library "liblocalcommonapi_HelloWorld:v1_0test.so" failed (liblocalcommonapi_HelloWorld:v1_0test.so: cannot open shared object file: No such file or directory) [CAPI][INFO] Registering stub for "local:commonapi.HelloWorld:v1_0:test" Configuration module could not be loaded!

What should I do now to make the sample to communicate between client and service ?

Thank you !

catalinolteanu commented 3 years ago

export LD_LIBRARY_PATH to build folder fixed the issue.

Because there is nobody to install the samples in there linux systems, I think should be specified somewhere in the wiki that LD_LIBRARY_PATH setting.

Pixelfahnder commented 3 years ago

@catalinolteanu I experience the same issue but for me the "export hack" doesn't work. Any other more detailed remarks on this? I went to the build folder and exported the path but this doesn't change anything. If I spare out the commonapi.ini file the whole server will be run on dbus (which is the default as far as I understand) and therefore doesn't cause the error. So it seems to be something within the someip-tools stack that causes this which can't be solved by the "hack".

Pixelfahnder commented 3 years ago

The weird thing though is, that the code still works, but the message is irritating and maybe there may be a way of getting rid of it?

nonalcogolic commented 2 years ago

You probably had to add next lines into your ini files:

[stub]

local:commonapi.HelloWorld:v1_0:test=/path/to/your/library/v1_0__test.so

local:commonapi.HelloWorld:v1_0:test v1_0__test.so is the library which is being build from generated code.

memoryleake commented 2 years ago

I meet the issue too, I don't know the correct path where v1_0__test.so is located , I searched all files but not found v_1__test.so anywhere. Could you help it ?

stefanoltean1 commented 1 year ago

Same issue from my side. Is there a more comprehensive guide to solve this?

goncaloalmeida commented 1 year ago

hello, @stefanoltean1 / @memoryleake please use the last release of all projects. this issue is still occurring with the last release?

wangzhangjun commented 1 year ago

I know how to fix , we need config commonapi.ini file's [stub] and [proxy]. for example:

local:commonapi.HelloWorld:v1_0:test=xxx-someip.so

and this path is from your generate code xxxSomeIPproxy.cpp: for example:

void initializeHelloWorldSomeIPProxy() {
    CommonAPI::SomeIP::AddressTranslator::get()->insert(
        "local:commonapi.HelloWorld:v1_0:test",   // this is we need
        0x1234, 0x5678, 1, 0);
    CommonAPI::SomeIP::Factory::get()->registerProxyCreateMethod(
        "commonapi.HelloWorld:v1_0",
        &createHelloWorldSomeIPProxy);
}
wzc81614 commented 1 year ago

@goncaloalmeida Newest version also has this issue, I have this issue as well.

wzc81614 commented 1 year ago

I know how to fix , we need config commonapi.ini file's [stub] and [proxy]. for example:

local:commonapi.HelloWorld:v1_0:test=xxx-someip.so

and this path is from your generate code xxxSomeIPproxy.cpp: for example:

void initializeHelloWorldSomeIPProxy() {
    CommonAPI::SomeIP::AddressTranslator::get()->insert(
        "local:commonapi.HelloWorld:v1_0:test",   // this is we need
        0x1234, 0x5678, 1, 0);
    CommonAPI::SomeIP::Factory::get()->registerProxyCreateMethod(
        "commonapi.HelloWorld:v1_0",
        &createHelloWorldSomeIPProxy);
}

How do you fix this issue? As your comment, I add one line in commonapi.ini local:commonapi.HelloWorld:v1_0:test=HelloWorld-someip.so it seems the issue still there, do you have any suggestion, thanks. @wangzhangjun

tenta4 commented 11 months ago

According to CommonAPI's source code, name of binding library to be searched is configurable. By default it's liblocal__<namespace>_<service>:<version>.so

But you can change it by setting the property for your service (directly in cpp code)

CommonAPI::Runtime::setProperty("LibraryBase", "<service>");

Then it will be <service>-someip.so (or DBus; it depends on used binding)

Here is responsible snippet

    library = getProperty("LibraryBase");
    if (library != "") {
#ifdef _WIN32
        library = library + "-" + defaultBinding_;
#else
        library = "lib" + library + "-" + defaultBinding_;
#endif
    } else {
        library = "lib" + _domain + "__" + _interface + "__" + _instance;
        std::replace(library.begin(), library.end(), '.', '_');
    }
dibpinto commented 9 months ago

The CMakeLists.txt file was updated and a new line was added: "set(PRJ_NAME HelloWorld)". Please verify if it's now working as expected. Otherwise please indicate all the changes you have done in CMakeLists.txt.

@Gustavo1515 @goncaloalmeida