Fork me on GitHub

Opened 10 years ago

Closed 10 years ago

#315 closed How to (fixed)

Issue compiling Delphes 3.1.2 on MacOS 10.9.4

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

Description

Hello,

I am having a problem compiling Delphes 3.1.2 in MacOS 10.9.4 that I don't understand.

Last summer I installed Delphes from MadGraph without any issue but I haven't needed it until now again and when I am trying to update it to the latest version I get this error:

>> Compiling external/tcl/panic.c
error: invalid argument '-std=c++11' not allowed with 'C/ObjC'
make: *** [tmp/external/tcl/panic.o] Error 1

and I cannot compile it. It seems that make sense not to be able to use c++11 with a C code but I might not understand this well.

I have searched for this issue and found that the problem might be related with the compiler version which is being used (reading Makefile.arch I see it is g++) which in my case points to clang as usual.

$ g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix

but I cannot find what to do to solve this.

What I find estrange is that it is only Delphes who complains for this. I have installed ROOT from Macports, MadGraph, MadAnalysis and a copule of other codes with no issue but I cannot find a solution for this.

Thanks a lot for you help in advance!
Juanpe.

Change History (6)

comment:1 by Pavel Demin, 10 years ago

Hi Juanpe,

The problem is that I can't reproduce this problem. I have an access to a Apple computer with MacOSX 10.9.4 and XCode 5.1. You can find more details on how I installed XCode, ROOT, etc in one of the previous tickets. As, for example, #277 (https://cp3.irmp.ucl.ac.be/projects/delphes/ticket/277).

Some of the Delphes' users that encountered the same problem managed to solve it by doing one of the following:

  • upgrade to the latest Xcode
  • install the latest command line tools
  • build ROOT from sources
  • point all the environment variables to the correct XCode and/or ROOT installation directory

I propose to try to compare the commands that make generates when compiling external/tcl/panic.c

Could you remove the @ character in the beginning of the line 1756 in Makefile?

  @gcc $(CXXFLAGS) -c $< $(OutPutOpt)$@

After the modification this line should look like

  gcc $(CXXFLAGS) -c $< $(OutPutOpt)$@

Here is what I get:

# rm tmp/external/tcl/panic.o
# make
>> Compiling external/tcl/panic.c
gcc -O2 -pipe -Wall -W -Woverloaded-virtual -pthread -stdlib=libc++ -m32 -I/Users/pavel/root/root-5.34.18/include -pthread -stdlib=libc++ -m32 -I/Users/pavel/root/root-5.34.18/include -Wno-write-strings -D_FILE_OFFSET_BITS=64 -DDROP_CGAL -I. -Iexternal -Iexternal/tcl -c external/tcl/panic.c -o tmp/external/tcl/panic.o

There is indeed the '-stdlib=libc++' flag but no error message.

Regards,

Pavel

comment:2 by Pavel Demin, 10 years ago

I've just looked through the Makefile.arch file and I'd say that the '-std=c++11' flag is generated by the 'root-config --cflags' command.

If it's so, the solution could be to somehow remove '-std=c++11' from the gcc $(CXXFLAGS) .. command.

Last edited 10 years ago by Pavel Demin (previous) (diff)

comment:3 by Pavel Demin, 10 years ago

Just found some information about the C++11 and ROOT on the ROOT's forum:

http://root.cern.ch/phpBB3/viewtopic.php?f=21&t=16544

Looks like MacPorts build ROOT with the '--enable-cxx11' flag.

And I don't build ROOT with this flag. That is most probably why I can't reproduce this problem.

comment:4 by Pavel Demin, 10 years ago

Hi Juanpe,

I'd say that I've found a solution.

Could you try to replace the line 1756 in Makefile

@gcc $(CXXFLAGS) -c $< $(OutPutOpt)$@

with the following expression

@$(CC) $(patsubst -std=%,,$(CXXFLAGS)) -c $< $(OutPutOpt)$@

Regards,

Pavel

in reply to:  4 comment:5 by Juanpe, 10 years ago

Hi Pavel,

sorry for the delay. I have followed your comments and what you propose makes a lot of sense. I have changed the line you said and that indeed fixes the problem. I have also checked that when I do

root-config --cflags

I get the -std=c++11 flag, so that is coming from the macports root installation.

Thanks a lot!
Juanpe.

Replying to pavel:

Hi Juanpe,

I'd say that I've found a solution.

Could you try to replace the line 1756 in Makefile

@gcc $(CXXFLAGS) -c $< $(OutPutOpt)$@

with the following expression

@$(CC) $(patsubst -std=%,,$(CXXFLAGS)) -c $< $(OutPutOpt)$@

Regards,

Pavel

comment:6 by Pavel Demin, 10 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.