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

Error compiling LDC on OSX Mavericks in driver/linker.cpp #544

Closed
dymk opened this issue Nov 18, 2013 · 7 comments
Closed

Error compiling LDC on OSX Mavericks in driver/linker.cpp #544

dymk opened this issue Nov 18, 2013 · 7 comments

Comments

@dymk
Copy link

dymk commented Nov 18, 2013

...
In file included from /Users/dymk/code/ldc/driver/linker.cpp:17:
/Users/dymk/code/ldc/./gen/logger.h:75:16: error: invalid operands to binary expression ('std::ostream' (aka 'basic_ostream<char>') and 'char const[2]')
            OS << Thing;
            ~~ ^  ~~~~~
...
4 warnings and 1 error generated.
make[2]: *** [CMakeFiles/ldc2.dir/driver/linker.cpp.o] Error 1
make[1]: *** [CMakeFiles/ldc2.dir/all] Error 2
make: *** [all] Error 2

GCC version:

Codeinator:build dymk$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.2
Thread model: posix

I should mention that I'm using LLVM version 3.2, from the archive linked on the wiki page on building LDC

I'm not sure if I've configured something incorrectly, or if this is a legit bug in compiling on OSX.

@redstar
Copy link
Member

redstar commented Nov 18, 2013

That's strange. LLVM 3.2 is the right version for OS X. And clang 3.3 can compile ldc. I can't check this right now as I don't have a OSX Mavericks installation at hand.

@dymk
Copy link
Author

dymk commented Nov 18, 2013

Commenting out line 75 of logger.h allows ldc to compile (although I assume with stunted logging capabilities).

    template<typename Ty, int N>
    struct Writer {
        static void write(std::ostream& OS, const Ty& Thing) {
            // OS << Thing;
        }
    };

@itaiferber
Copy link
Contributor

Don't mean to bump this if it isn't relevant, but I ran into the same issue on OS X Mavericks. I have LLVM 3.4 installed via Homebrew, and I got the same issue when trying to compile LDC. Rather than comment out the line in gen/logger.h (seems like a sweeping change to me), I elected to change lines 226–7 and lines 336–7 of driver/linker.cpp to

    logstr << std::string("'" + *I + "' ");
logstr << std::string("\n");

Don't know what about my config is different that allows LDC to compile correctly on other machines but not my own, but this allowed it to compile perfectly fine. Hope I didn't make a dumb mistake in doing this, but it seems to work okay for now — haven't done any thorough testing yet, though.

@dnadlinger
Copy link
Member

I think at this point is is perfectly clear that any fix that allows compilation is a big improvement over the current state. Care to submit a pull request? Does including iostream in logger.h also solve the problem for you?

@itaiferber
Copy link
Contributor

Actually, sticking #include <iostream> into logger.h fixes the issue. I can submit a pull request for that if you'd like.

@dnadlinger
Copy link
Member

Yes, please do!

@itaiferber
Copy link
Contributor

Yep, submitted a pull request —hope I did it right (never submitted one before).

dnadlinger added a commit that referenced this issue Feb 20, 2014
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

4 participants