Fork me on GitHub

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#1114 closed Bug (fixed)

Compilation Error

Reported by: williamhuang Owned by:
Priority: minor Milestone:
Component: Delphes code Version: Delphes 3
Keywords: Cc:

Description

When I installed Delphes in MG5, I got a bug as the following

c++: error: unrecognized command line option '-stdlib=libc++'
c++: error: unrecognized command line option '-stdlib=libc++'
make: * [tmp/classes/ClassesDict.o] Error 1
Error detected during the compilation. Please check the compilation error and run make manually.

The version of my computer is macOS Sierra 10.12.3

Very thank you if there is any solution!

Change History (11)

comment:1 by Pavel Demin, 8 years ago

-stdlib=libc++ isn't in the Delphes Makefile. So, I suppose that this flag is provided by the root-config --cflags command.

Please provide more details about your ROOT version and how it was installed.

Please also check the output of the root-config --cflags.

I've just found a similar issue discussed on the ROOT forum:
https://root-forum.cern.ch/t/stdlib-libc-unrecognized/18933

One of the comments in this discussion suggests that the problem is in how Homebrewbuilds ROOT.

So, if you install ROOT via Homebrew, then I suggest uninstall it and to install a ROOT binary package provided by the ROOT developers:
https://root.cern.ch/content/release-60806

in reply to:  1 comment:2 by williamhuang, 8 years ago

My ROOT version is 6.09/02 and I installed the ROOT binary package provided by the ROOT developers.

The Output of the root-config --cflags is

-pthread -stdlib=libc++ -std=c++11 -m64 -I/Applications/root_v6.09.02/include

comment:3 by Pavel Demin, 8 years ago

Thanks for the details about your ROOT installation. So, stdlib=libc++ is provided by root-config --cflags. However, it's unclear why c++ complains about stdlib=libc++.

Is the c++ compiler that you're using is clang80 provided by Apple?

comment:4 by williamhuang, 8 years ago

I installed gcc via MacPort. I guess it is not clang80?

comment:5 by Pavel Demin, 8 years ago

No, gcc isn't clang. Apple provides clang bundled with Xcode:
https://itunes.apple.com/be/app/xcode/id497799835

After installing Xcode, the command line tools should be installed with the following command:

xcode-select --install

comment:6 by williamhuang, 8 years ago

Xcode was already installed and the version is the latest.

comment:7 by Pavel Demin, 8 years ago

OK. So, I think the solution would be to make sure that Xcode/clang and not gcc is used when building Delphes.

comment:8 by williamhuang, 8 years ago

So, how do I use Xcode/clang to build Delphes?

comment:9 by Pavel Demin, 8 years ago

So, how do I use Xcode/clang to build Delphes?

I don't know. Since you have two compilers (gcc and clang) installed on your system, you should be able to somehow switch from one to the other.

In my understanding, the problem is that you have gcc configured as the default compiler and you have ROOT built with clang. When you build Delphes,the gcc compiler is used but it's incompatible with your ROOT installation and you get error messages.

Possible solutions:

  • keep ROOT built with clang and setup clang as the default compiler
  • keep gcc as the default compiler and install ROOT built with the gcc compiler

It's up to you to find which solution corresponds better to your requirements.

I can just point to the source of the problem but please don't expect me to help you with the configuration of your system.

comment:10 by Pavel Demin, 8 years ago

Resolution: fixed
Status: newclosed

comment:11 by williamhuang, 8 years ago

Very thank you for your suggestions.

Note: See TracTickets for help on using tickets.