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

Add include/macro parsing support for c89/c99 compilers, similar to #117 #119

Closed
1 of 2 tasks
manschwetusCF opened this issue Aug 30, 2019 · 8 comments
Closed
1 of 2 tasks

Comments

@manschwetusCF
Copy link

If you have any question, please consult the mailing list first before you raise issues here

This is a...

  • Bug Report
  • Enhancement Request

Brief Description

We use CrossCompilers for NonStop on Windows, see

What is the expected behavior?

At least include directories are provided to CDT

What behavior are you observing?

Include directories are missing.

Useful Information

  • cmake4eclipse version: 1.15.1.201906281951
  • Which OS do you use: Win10
  • Cmake version: 3.15.2

What is in Eclipse's Error Log?

CompileCommandsJsonParser#expandShortFileName()

Sanitized stack traces:

java.io.IOException: Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch
	at java.io.WinNTFileSystem.canonicalize0(Native Method)
	at java.io.WinNTFileSystem.canonicalize(WinNTFileSystem.java:428)
	at java.io.File.getCanonicalPath(File.java:618)
	at de.marw.cmake.cdt.language.settings.providers.ParserDetection.expandShortFileName(ParserDetection.java:269)
	at de.marw.cmake.cdt.language.settings.providers.ParserDetection.determineDetector(ParserDetection.java:179)
	at de.marw.cmake.cdt.language.settings.providers.CompileCommandsJsonParser.fastDetermineDetector(CompileCommandsJsonParser.java:478)
	at de.marw.cmake.cdt.language.settings.providers.CompileCommandsJsonParser.processJsonEntry(CompileCommandsJsonParser.java:309)
	at de.marw.cmake.cdt.language.settings.providers.CompileCommandsJsonParser.tryParseJson(CompileCommandsJsonParser.java:240)
	at de.marw.cmake.cdt.language.settings.providers.CompileCommandsJsonParser.shutdown(CompileCommandsJsonParser.java:594)
	at org.eclipse.cdt.internal.core.ConsoleOutputSniffer.closeConsoleOutputStream(ConsoleOutputSniffer.java:160)
	at org.eclipse.cdt.internal.core.ConsoleOutputSniffer$ConsoleOutputStream.close(ConsoleOutputSniffer.java:68)
	at org.eclipse.cdt.internal.core.ProcessClosure$ReaderThread.close(ProcessClosure.java:98)
	at org.eclipse.cdt.internal.core.ProcessClosure.isAlive(ProcessClosure.java:191)
	at org.eclipse.cdt.core.CommandLauncher.waitAndRead(CommandLauncher.java:273)
	at org.eclipse.cdt.core.CommandLauncherManager$CommandLauncherWrapper.waitAndRead(CommandLauncherManager.java:156)
	at org.eclipse.cdt.internal.core.BuildRunnerHelper.build(BuildRunnerHelper.java:324)
	at org.eclipse.cdt.managedbuilder.core.ExternalBuildRunner.invokeExternalBuild(ExternalBuildRunner.java:132)
	at org.eclipse.cdt.managedbuilder.core.ExternalBuildRunner.invokeBuild(ExternalBuildRunner.java:72)
	at org.eclipse.cdt.managedbuilder.internal.core.CommonBuilder.build(CommonBuilder.java:753)
	at org.eclipse.cdt.managedbuilder.internal.core.CommonBuilder.build(CommonBuilder.java:513)
	at org.eclipse.cdt.managedbuilder.internal.core.CommonBuilder.build(CommonBuilder.java:459)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:735)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:301)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:304)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:360)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:383)
	at org.eclipse.core.internal.resources.Workspace.buildInternal(Workspace.java:487)
	at org.eclipse.core.internal.resources.Workspace.build(Workspace.java:406)
	at org.eclipse.ui.actions.BuildAction$1.runInWorkspace(BuildAction.java:285)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)

(If Enhancement Request) Describe it.

As cmake4eclipse seems to integrate reasonable ok with NSDEE (HPE Eclipse Plugin), it quite preferable to get information integrated from cmake.

@15knots
Copy link
Owner

15knots commented Aug 30, 2019

java.io.IOException: Die Syntax für den Dateinamen, Verzeichnisnamen oder die Datenträgerbezeichnung ist falsch
at java.io.WinNTFileSystem.canonicalize0(Native Method)
at java.io.WinNTFileSystem.canonicalize(WinNTFileSystem.java:428)
at java.io.File.getCanonicalPath(File.java:618)
at de.marw.cmake.cdt.language.settings.providers.ParserDetection.expandShortFileName(ParserDetection.java:269)

This should not happen. Looks like a unix path is fed to getCanonicalPath().
Are you using a version of cmake that is bundled with MinGW, MSYS or cygwin? These versions tend to generate Unix paths. The cmake developers recommend to use the native windows version of cmake from their MSI installer instead.

To implement this enhancement, documentation for the compiler command-line options is needed. I could not find (aka &tl;dr) it in the links you provided.
Needed docs comprises:
1 base-name of the compiler executable(s)
2 options to specify include dirs, #define and #undefine (ususally -I/-D/-U)
3 options to specify system-include dirs; e.g., gcc has -isystem (not mandatory)
4 options that let the compiler print its built-in include dirs, #define and #undefine to stdout (not mandatory)

@manschwetusCF
Copy link
Author

No I use normal Windows version of cmake, installed via msi.

1 base-name of the compiler executable(s)
c89, c99, c11, xcobol, ecobol, xptal, eptal

2 options to specify include dirs, #define and #undefine (ususally -I/-D/-U)
exactly, at least for c*.

3 options to specify system-include dirs; e.g., gcc has -isystem (not mandatory)
not that I'm aware of, the compiler toolchain include dir is implicitly always included.
=> https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_IMPLICIT_INCLUDE_DIRECTORIES.html

4 options that let the compiler print its built-in include dirs, #define and #undefine to stdout (not mandatory)

  • IA64 Target (NSI)
    ${COMMAND} ${FLAGS} -Wccombe="--list_macros" "${INPUTS}"
    
  • x86_64Target (NSX)
    ${COMMAND} ${FLAGS} -Wccomfe="--list_macros" "${INPUTS}"
    

@15knots
Copy link
Owner

15knots commented Sep 5, 2019

No I use normal Windows version of cmake, installed via msi.

Can you post the first "command" entry from the compile_commands.json file here?

  1. base-name of the compiler executable(s)
    c89, c99, c11, xcobol, ecobol, xptal, eptal

So c89, c99, c11 are the compileres of interest here?

  1. options to specify system-include dirs; e.g., gcc has -isystem (not mandatory)
    not that I'm aware of, the compiler toolchain include dir is implicitly always included.
    => https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_IMPLICIT_INCLUDE_DIRECTORIES.html

CMAKE_LANG_IMPLICIT_INCLUDE_DIRECTORIES won't help since it lives inside the cmake process and cannot be accessed.

4 options that let the compiler print its built-in include dirs, #define and #undefine to stdout (not mandatory)

* IA64 Target (NSI)
  ```
  ${COMMAND} ${FLAGS} -Wccombe="--list_macros" "${INPUTS}"
  ```

* x86_64Target (NSX)
  ```
  ${COMMAND} ${FLAGS} -Wccomfe="--list_macros" "${INPUTS}"
  ```

Looks complicated to get the built-ins for that. Isn't there a Target-neutral option variant, e.g. just --list_macros?
I guess, the target is selected by a command-line option. Unfortunately, the cmake4eclipse plugin is not designed to pass different options for the same compiler.

@manschwetusCF
Copy link
Author

{
  "directory": "Z:/workspace-GRAVIC_CRYPT/GRAVIC_CRYPT/build/TNS_X-OSS",
  "command": "\"C:/Program Files (x86)/Compaq ETK-NSE/L18.02/usr/bin/c89.exe\" -Wcplusplus -DSSBENC_EXPORTS -D_TANDEM_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -IZ:/Projekte/CRYPT/Sources/SSBENC_common/inc -IZ:/Projekte/CRYPT/Sources/SAMP_COMMON/inc -ID:/PRODUKTE/OpenSSL_1_1_1_NSK/nonstop-nsx/include -I\"C:/Program Files (x86)/Compaq ETK-NSE/L18.02/usr/include\"    -o CMakeFiles/SSBENC.dir/SSBENC_common/src/appvals.cpp.o -c Z:/Projekte/CRYPT/Sources/SSBENC_common/src/appvals.cpp",
  "file": "Z:/Projekte/CRYPT/Sources/SSBENC_common/src/appvals.cpp"
}

@manschwetusCF
Copy link
Author

Sorry, no common option for both compilers

@15knots
Copy link
Owner

15knots commented Nov 1, 2019

Please download and test staged version cmake4eclipse-2.0.0-SNAPSHOT-0.zip.
You will find it at
https://drive.google.com/drive/folders/0B-QU1Qnto3huZUZ0QUdxM01pR0U?usp=sharing

It is a zipped update site. Use Eclipse | Help | Install new software | Add... | Archive... to install the downloaded zip.

@15knots 15knots added this to the next release milestone Nov 1, 2019
@15knots
Copy link
Owner

15knots commented Nov 26, 2019

Please test staged version to get a new release.

@15knots
Copy link
Owner

15knots commented Dec 8, 2019

implemented but needs testing

@15knots 15knots closed this as completed Dec 8, 2019
@15knots 15knots added port to CDT not yet in CDT cmake support and removed feedback awaited labels Jul 24, 2021
@15knots 15knots removed the port to CDT not yet in CDT cmake support label Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants