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

Fails on Darwin with "clang: error: no input files" #282

Open
avdv opened this issue Jul 12, 2022 · 0 comments
Open

Fails on Darwin with "clang: error: no input files" #282

avdv opened this issue Jul 12, 2022 · 0 comments

Comments

@avdv
Copy link

avdv commented Jul 12, 2022

$ c2hs external/c2hs_repo/Baz.chs -o out//Baz.hs --cpp /usr/bin/cpp -C-includeghcplatform.h -C-includeghcversion.h -C-iquote 
clang: error: no input files

Seems Darwin's cpp is behaving similar to the "openbsd" variant regarding the -xc vs. -x c flags:

bash-3.2$ which cpp
/usr/bin/cpp

bash-3.2$ cpp --version
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: arm64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

bash-3.2$ cpp -x c foo.c
clang: error: no input files

I guess the cppopts function could use a little update?

c2hs/src/C2HS/Config.hs

Lines 53 to 67 in e05db30

-- | C preprocessor options
--
-- * `-x c' forces CPP to regard the input as C code; this option seems to be
-- understood at least on Linux, FreeBSD, and Solaris and seems to make a
-- difference over the default language setting on FreeBSD
--
-- * @-P@ would suppress @#line@ directives
--
cppopts :: [String]
cppopts = case (os,cpp) of
-- why is gcc different between all these platforms?
("openbsd","cpp") -> ["-xc"]
(_,"cpp") -> ["-x", "c"]
(_,"gcc") -> ["-E", "-x", "c"]
_ -> []

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

1 participant