Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Path quoting in CxxFlags with bash #1242

Closed
@llaniewski

Description

@llaniewski

Hi. In relation to the discussion in#1188 I just wanted to mention an issue introduced there.

Problem

Adding quotes around path in#1189 broke compilation for anybody who was usingCxxFlags in simple compilation script like:

CXXFLAGS="$(R CMD config --cppflags)"CXXFLAGS="$CXXFLAGS$(R --vanilla --slave -e"Rcpp:::CxxFlags()")"g++$CXXFLAGS -c main.cpp

This is because bash will use exactly what is returned byCxxFlags as argument for the compiler (g++). This means that the compiler gets-I"/some/path" and searches for headers in"/some/path" rather then/some/path.

Other use cases

  • You can resolve the quotes in bash by doingeval g++ ... in the script, but one cannot modify the all the compiler calls to use "eval" in eg../configure scripts fromautoconf.
  • If one uses theCxxFlags() in GNU make, it works. This is becausemake resolves the quotes. For example, the compilation of RInside examples (example/standard) works fine.
  • On the other hand, it seems to breakcmake-based compilation. When I try to compile the same examples usingcmake 3.16.3 for configuration, it fails with the error. Apparently passing path with quotes toinclude_directories() through a variable causes some weird behaviour.

Questions

  • If anybody has a good idea how to fix this without hurting windows users and their beloved spaces, I would be happy to implement it and make a pull request. The only half-decent workaround I can think of now is quoting pathif it has a space.
  • Is there a better way to do get include paths from Rcpp, which would work with eg. autoconf?

Notes

We run into this problem, as we useRInside in ourC++ code. We currently use a workaround of stripping quotes.

Themain.cpp file can be as simple as:

#include<Rcpp.h>intmain () {return0;}

I'm not attachingsessionInfo() as this issue is not about R.

@eddelbuettel Do you think it is an issue at all and would you expect such a bash script to work? If not, I you can close the issue, and we'll stick with our workaround.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp