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

with --profile, error: invalid argument '-std=c++11' not allowed with 'C' #102

Closed
gaze opened this issue Oct 21, 2019 · 8 comments
Closed

Comments

@gaze
Copy link

gaze commented Oct 21, 2019

Hey all, I have an lts-14.11 stack project that builds just fine when invoking stack build, but when building using stack build --profile, I get the following output

$ stack build --profile
inline-c-cpp-0.3.0.2: configure
inline-c-cpp-0.3.0.2: build
Progress 1/2

--  While building package inline-c-cpp-0.3.0.2 using:
      /Users/gaze/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-osx/Cabal-2.4.0.1 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
    Logs have been written to: /Users/gaze/my/nestor-hs/nestor/.stack-work/logs/inline-c-cpp-0.3.0.2.log

    Configuring inline-c-cpp-0.3.0.2...
    Preprocessing library for inline-c-cpp-0.3.0.2..
    Building library for inline-c-cpp-0.3.0.2..
    [1 of 2] Compiling Language.C.Inline.Cpp ( src/Language/C/Inline/Cpp.hs, .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/Language/C/Inline/Cpp.o )
    [2 of 2] Compiling Language.C.Inline.Cpp.Exceptions ( src/Language/C/Inline/Cpp/Exceptions.hs, .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/Language/C/Inline/Cpp/Exceptions.o )
    [1 of 2] Compiling Language.C.Inline.Cpp ( src/Language/C/Inline/Cpp.hs, .stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/Language/C/Inline/Cpp.p_o )
    error: invalid argument '-std=c++11' not allowed with 'C'
    `clang++' failed in phase `C Compiler'. (Exit code: 1)

This is under macOS 10.14.4. It's repeatable when deleting ~/.stack and/or .stack-work and then running build or build --profile in either order.

@bitonic
Copy link
Collaborator

bitonic commented Oct 21, 2019

Thanks for the report. It looks like a clang-specific issue. However, I can't easily reproduce because of commercialhaskell/stack#4073 . I might just try on the macbook later, but in the meantime, can you post a fully verbose build here? Maybe I can offer some guidance then.

@gaze
Copy link
Author

gaze commented Oct 21, 2019

Here's stack build --profile --verbose

dump.txt

@bitonic
Copy link
Collaborator

bitonic commented Oct 21, 2019

@gaze sadly that does not include the ghc invocation, and the invocation itself is not verbose. I think --verbose --cabal-verbose --ghc-options=-v should do it.

@gaze
Copy link
Author

gaze commented Oct 21, 2019

Apologies! Still a bit new to Haskell.

stack build --profile --verbose --cabal-verbose --ghc-options=-v 2> dump2.txt
dump2.txt

@gaze
Copy link
Author

gaze commented Oct 22, 2019

Fwiw, this allowed me to build. Not sure what the interaction would be with other platforms

diff --git a/inline-c-cpp/inline-c-cpp.cabal b/inline-c-cpp/inline-c-cpp.cabal
index 7985158..2e9ad42 100644
--- a/inline-c-cpp/inline-c-cpp.cabal
+++ b/inline-c-cpp/inline-c-cpp.cabal
@@ -26,7 +26,7 @@ library
                      , safe-exceptions
   hs-source-dirs:      src
   default-language:    Haskell2010
-  ghc-options:         -Wall -optc-std=c++11
+  ghc-options:         -Wall -optc-xc++
   if os(darwin)
     -- avoid https://gitlab.haskell.org/ghc/ghc/issues/11829
     ld-options:        -Wl,-keep_dwarf_unwind

@bitonic
Copy link
Collaborator

bitonic commented Oct 23, 2019

@gaze thank you, -optc-x-c++ makes a lot of sense, but I do not know why it'd break only with --profile. Anyway, I've created #103 to fix this problem in the repo. It's a shame that even with those verbosity options we still do not see the cc invocation...

@bitonic
Copy link
Collaborator

bitonic commented Oct 23, 2019

@gaze I've added -x-c++ to inline-c-cpp.cabal, and uploaded new inline-c-cpp version 0.3.0.3.

@tscholak
Copy link

seems this issue is back with ghc 8.10.3. has anybody else run into this again recently?

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

No branches or pull requests

3 participants