Giter VIP home page Giter VIP logo

Comments (9)

doudou avatar doudou commented on July 30, 2024

Definitely a bug.

However, source_file_line is not what is needed. What is needed at build and generation times are the name of the pkg-config project that provides the file as well as the include that should be used. The metadata that could be thrown away happily is actually source_file_line

from orogen.

marvin2k avatar marvin2k commented on July 30, 2024

Ok, pkg-config -- fine.

But the file to be included to use the type in question -- is the file where the type itself is declared. Which is the where source_file_line points to?

from orogen.

doudou avatar doudou commented on July 30, 2024

Yes, but not really. First, it is made relative based on the CFLAGS of the pkg-config in orogen_include. Moreover, it is resolved to the toplevel include (the file priovided to #import_types_from), not the exact include, as for instance the header defining Eigen::Matrix cannot be included directly while Eigen/Core can.

from orogen.

marvin2k avatar marvin2k commented on July 30, 2024

Hm. Have to think about this. Rationale: gccxml is called to "preprocess" the headers into one big file. There, some logic does the mapping which include-file should be used... And gccxml is bound to go.

from orogen.

marvin2k avatar marvin2k commented on July 30, 2024
  • what do you mean with relative based on the CFLAGS of the pkg-config in orogen_include?
  • jeah, its converted from an absolute path to some relative path -- So that the compiler can look it up again during parsing of the template-derived code?
  • Example-Time: Eigen::Vector3d has an opaque and is used in a header. The generated tlb contains source_file_line = /usr/include/eigen3/Eigen/src/Core/Matrix.h:373. A manually created main.cpp like
#include "/usr/include/eigen3/Eigen/src/Core/Matrix.h"

int main(int argc, char *argv[])
{
    Eigen::Vector3d test;
    return 0;
}

compiles just fine... Where is my misunderstanding?

The clang-derived importer could provide everything which can be extracted from the cpp -- and orogen can only do worse.

from orogen.

doudou avatar doudou commented on July 30, 2024

Because you do not KNOW whether it can be or not. The typical case is C++ standard headers, they are split in tons of small headers that are NOT meant to be included. Only the standard headers (like ) are. And there's really nothing clang can help you with there.

The only headers you KNOW can be included directly are the ones that have been explicitly given to orogen. Matrix.h ? Not part of eigen's documentation ... This is not a header you are meant to include directly. That it works is just by chance, not by design.

As for the CFLAGS: the problem is to generate code that can be relocated / generated on one machine and compiled on another. The resolution basically takes the absolute path and uses the package's pkg-config -I options to find out what is the most likely #include<> line and the corresponding CMake code.

from orogen.

marvin2k avatar marvin2k commented on July 30, 2024

Ok, got the point. But clang can help us here, like so for example. For me this feels more sane than orogen calling gcc(xml) again just to resolve this include-chain.

As for the CFLAGS: the problem is to generate code that can be relocated / generated on one machine and compiled on another. The resolution basically takes the absolute path and uses the package's pkg-config -I options to find out what is the most likely #include<> line and the corresponding CMake code

chuckle Did someone ever try to move the generated code from one machine to another? I very much doubt that this will reliably (read: reliably) work. So much interpreted magic eating and spitting options and files here and there... Installing stuff and not installing stuff, environment here and there... Using the just the full path in the generated code would prevent the later compiler from accidentally looking up the wrong header.


So what about the importer setting a metadata "full_include_path", and orogen then churning on this full path to create the "orogen_include" with a hopefully correct relative path given some pkg-config flags?

from orogen.

doudou avatar doudou commented on July 30, 2024

Ok, got the point. But clang can help us here, like so for example. For me this feels more sane than orogen calling gcc(xml) again just to resolve this include-chain

Streamlining the process is of course a good thing. Now, it does not change the fact that it needs to be done one way or another...

You don't need to sell clang to me ... I am in love with it already (and will happily sign the death sentence to the gccxml importer).

So what about the importer setting a metadata "full_include_path", and orogen then churning on this full path to create the "orogen_include" with a hopefully correct relative path given some pkg-config flags?

This is exactly what currently happens, with the importer setting source_file_line and orogen "massaging" it to the orogen_include

As to the portability: if the code was written manually, this is exactly the approach one would take: add the dependency on the pkg-config file, include the header from the pkg-config-resolved library. Might not be perfect, but - in general - following the way everyone does it in practice sounds like a pretty good idea to me.

from orogen.

marvin2k avatar marvin2k commented on July 30, 2024

You don't need to sell clang to me ... I am in love with it already (and will happily sign the death sentence to the gccxml importer).

Yes. Sometimes I need more control over my moment of inertia... ;-)

from orogen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.