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

macOS 10.13.6 installation: cannot run C++ compiled programs #151

Closed
mdozmorov opened this issue Apr 9, 2019 · 11 comments
Closed

macOS 10.13.6 installation: cannot run C++ compiled programs #151

mdozmorov opened this issue Apr 9, 2019 · 11 comments

Comments

@mdozmorov
Copy link

Hello,

Running ./configure fails with "configure: error: cannot run C++ compiled programs." A bigger picture - I'm trying to compile ea-utils, which fails with the same error.

The detailed output of ./configure is:

checking whether make sets $(MAKE)... yes
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/Users/mdozmorov/Documents/nobackup/ea-utils/clipper/sparsehash':
configure: error: cannot run C++ compiled programs.

And the full config.log is attached.

Thanks for your help,
Mikhail
config.log

@PhilipDeegan
Copy link
Member

ExpressionAnalysis/ea-utils#75

you could try this to see if it works for you

@mdozmorov
Copy link
Author

The sparsehash-c11 version doesn't have the configure file. When I just try running make, it still errors:

<... lots of outputs skipped ...>
      testing::internal::UniversalTersePrinter<wchar_t const*>::Print(wchar_t const*, std::__1::basic_ostream<char, std::__1::char_traits<char> >*) in gmock-gtest-all.o
  "_write", referenced from:
      testing::internal::DeathTestImpl::Abort(testing::internal::DeathTest::AbortReason) in gmock-gtest-all.o
ld: symbol(s) not found for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:46: sparsehash_unittests] Error 1

I'm not very familiar with C code structure and compiling, so not sure where to go from here...

@PhilipDeegan
Copy link
Member

https://github.com/sparsehash/sparsehash-c11 is header only - there is no configure required.

make is just compiling the tests, which it looks like you're having trouble with a system call with

@PhilipDeegan
Copy link
Member

are you positive your compiler is not misconfigured in some way?

@mdozmorov
Copy link
Author

Not sure what may be misconfigured. The system is rather fresh. I've been googling, finding some suggestions about "LD_LIBRARY_PATH" variable (empty in my case), but not sure where to go from there. My configuration files are rather simple: dotfiles.

And, some info about gcc and g++:

/usr/bin/gcc
(base) MacBook-Pro-4:dotfiles mdozmorov$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
(base) MacBook-Pro-4:dotfiles mdozmorov$ which g++
/usr/bin/g++
(base) MacBook-Pro-4:dotfiles mdozmorov$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
(base) MacBook-Pro-4:dotfiles mdozmorov$

Anything obviously misconfigured?

@PhilipDeegan
Copy link
Member

clang++ and g++ have different targets
I've found g++ on macos to be quite troublesome

did you install the latest xcode? that has a version of clang > 4 I think and I would suggest using that if possible

@mdozmorov
Copy link
Author

Xcode seem up-to-date, Version 10.1 (10B61), no updates. clang version is

clang --version
clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Users/mdozmorov/miniconda2/bin
(base) MacBook-Pro-4:Cancer_notes mdozmorov$ which clang
/Users/mdozmorov/miniconda2/bin/clang

Re: "clang++ and g++ have different targets" - anything one can do about it?

@PhilipDeegan
Copy link
Member

https://travis-ci.org/mkn/google.sparsehash/jobs/517842961 looks all ok here with OSX 10.2 and CLANG 7

@mdozmorov
Copy link
Author

I was following https://embeddedartistry.com/blog/2017/2/20/installing-clangllvm-on-osx. After setting the path and the flags in a terminal session as recommended, I can run make on https://github.com/sparsehash/sparsehash-c11 without errors.

Not sure what to do next to compile sparsehash itself.

@PhilipDeegan
Copy link
Member

did you try "./configure" after setting the flags/etc?

@mdozmorov
Copy link
Author

Compiling after setting the environment as described https://embeddedartistry.com/blog/2017/2/20/installing-clangllvm-on-osx worked! So, after running make for https://github.com/sparsehash/sparsehash-c11, I could ./configure, make and make install for https://github.com/sparsehash/sparsehash.

As of the bigger picture, ea-utils partially compiled with these setting. Most of the tools can now be run as binaries. One error ('samtools/sam.h' file not found with include; use "quotes" instead), but that is a different story and issue.

Thank you, @dekken, for quick help with this.

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

2 participants