Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tao_idl mangles #include's by inserting absolute paths after relative prefixes #2049

Open
alexchandel opened this issue Feb 10, 2023 · 3 comments

Comments

@alexchandel
Copy link

Version

ACE 7.0.11

Host machine and operating system

macOS 12.6.3

Compiler name and version (including patch level)

Apple clang version 14.0.0 (clang-1400.0.29.202)

The $ACE_ROOT/ace/config.h file

Basically just "ace/config-macosx-mojave.h"
#ifndef ACE_CONFIG_CUSTOM_H
#define ACE_CONFIG_CUSTOM_H

#ifndef GNUC
#define GNUC 4
#endif
#ifndef GNUC_MINOR
#define GNUC_MINOR 2
#endif

#define ACE_HAS_STANDARD_CPP_LIBRARY 1

#include "ace/config-macosx-mojave.h"

#endif // ACE_CONFIG_CUSTOM_H

The $ACE_ROOT/include/makeinclude/platform_macros.GNU file

Basically just include $(ACE_ROOT)/include/makeinclude/platform_macosx_mojave.GNU
debug		= 0
inline		= 1
optimize	= 1
static_libs	= 1
shared_libs	= 1
ssl			= 0
buildbits	= 64

OCFLAGS += -Oz -Wno-deprecated-declarations
OCCFLAGS += -Oz -Wno-deprecated-declarations
CFLAGS += -Wno-deprecated-declarations
CCFLAGS += -Wno-deprecated-declarations
LDFLAGS +=

include $(ACE_ROOT)/include/makeinclude/platform_macosx_monterey.GNU

Contents of $ACE_ROOT/bin/MakeProjectCreator/config/default.features

Unmodified.

AREA/CLASS/EXAMPLE AFFECTED:

TAO_Core_idl generates bad anyop header files, meaning projects like AnyTypeCode and Portable Server fail to build.

The problem effects:

TAO cannot be built.

Synopsis / Description

Invoking tao_idl with absolute paths like below causes the generated anyop header files to include mangled/illegal paths when accessing the stub header.

cd /Users/dev/Downloads/Test/ACE_wrappers/TAO/tao && /usr/local/Cellar/cmake/3.25.2/bin/cmake -E env TAO_ROOT=/Users/dev/Downloads/Test/ACE_wrappers/TAO "LD_LIBRARY_PATH=/Users/dev/Downloads/Test/ACE_wrappers/lib" /Users/dev/Downloads/Test/ACE_wrappers/bin/tao_idl -g /Users/dev/Downloads/Test/ACE_wrappers/bin/ace_gperf -Sp -Sd -Sp -Sd -Sg -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h --idl-version 4 -as --unknown-annotations ignore -I/Users/dev/Downloads/Test/ACE_wrappers/TAO -I/Users/dev/Downloads/Test/ACE_wrappers/TAO/tao -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h -I .. -Wb,versioning_begin=TAO_BEGIN_VERSIONED_NAMESPACE_DECL -Wb,versioning_end=TAO_END_VERSIONED_NAMESPACE_DECL -SS -Sorb -GA -Gp -Gd -oA AnyTypeCode -Wb,export_macro=TAO_Export -Wb,export_include=tao/TAO_Export.h -Wb,anyop_export_macro=TAO_AnyTypeCode_Export -Wb,anyop_export_include=tao/AnyTypeCode/TAO_AnyTypeCode_Export.h -Sci -Gse -Gata -o /Users/dev/Downloads/Test/ACE_wrappers/TAO/tao -oS /Users/dev/Downloads/Test/ACE_wrappers/TAO/tao /Users/dev/Downloads/Test/ACE_wrappers/TAO/tao/BooleanSeq.pidl

BooleanSeqA.h is generated with these lines:

#include /**/ "ace/pre.h"

#include /**/ "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
#include "tao/AnyTypeCode/Any.h"

#include "tao//Users/dev/Downloads/Test/ACE_wrappers/TAO/tao/BooleanSeqC.h"

Notice the absolute path to BooleanSeqC.h (constructed from the -o opt) is illegally appended to tao/. Notice that only the reference to the stub header is affected.

The problem does not affect BooleanSeqC.cpp or BooleanSeqA.cpp, which only include their neighbors (e.g. #include "BooleanSeqC.h" and #include "BooleanSeqA.h"). However I suspect tao_idl's code will produce this error whenever any generated file includes a generated header for which tao_idl was passed an absolute path.

Repeat by

See above. This happens to BooleanSeqA.h whenever anything is passed to -o, even -o ..

Sample fix/ workaround

Only not passing -o causes tao_idl to emit a normal include #include "tao/BooleanSeqC.h".

Instead of mangled paths, if both files lie in TAO_ROOT or something, tao_idl should resolve the absolute path into a relative path, and just emit #include "tao/BooleanSeqC.h". Or just always emit that, and rely on the consumer to set up include directories properly.

@jwillemsen
Copy link
Member

As far as I remember we intended to support relative parts only, else you can’t move a tree to a different location easily. Also make install to a different location will not work with full paths in the generated code

@alexchandel
Copy link
Author

Could you note this restriction in tao_idl's documentation then? It currently makes no mention of relative or absolute paths.

Also, what about for generating IDL files outside of the source tree? Modern build systems prefer to generate files (including IDL sources) in a separate tree. How can tao_idl be called to generate files for $ROOT/ACE_wrappers/TAO/tao/BooleanSeq.pidl in $ROOT/build/.../ (including subdirectories for anyop files) without emitting these mangled include paths?

@jwillemsen
Copy link
Member

Feel free to add support for an absolute path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants