Opened 10 days ago

Closed 6 days ago

#60739 closed defect (fixed)

SFML 2.4.2 fails to build because it picks the wrong compiler

Reported by: programmingkidx Owned by: rkitover (Rafael Kitover)
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: Cc:
Port: SFML

Description (last modified by kencu (Ken))

I tried building SFML on Mac OS 10.4 (intel) and it failed to build.

Here is the error:

:info:configure Error when bootstrapping CMake:
:info:configure Cannot find a C++ compiler that supports both C++11 and the specified C++ flags.
:info:configure Please specify one using environment variable CXX.
:info:configure The C++ flags are "-pipe -Os -fpermissive -stdlib=macports-libstdc++ -D_GLIBCXX_USE_CXX11_ABI=0 -arch i386".
:info:configure They can be changed using the environment variable CXXFLAGS.
:info:configure See cmake_bootstrap.log for compilers attempted.

I'm thinking a good fix to this issue is to scan the /opt/local/bin/ folder for compilers that should work. I do have gcc-7 install. For some reason it picked /opt/local/bin/clang++-mp-3.4 instead.

Change History (21)

comment:1 Changed 10 days ago by kencu (Ken)

I have fixed this error (I believe) with this commit [3ea1fb4eeb5b91940361d70634e003ec2fc572c5/macports-base].

I would be eternally grateful if you would install (from source) the current tip of the git repo on MacPorts base and run with that (or, at least implement the commit yourself in your current installation) and report back quickly if you see any errors.

A new base is coming soon, and I want to get this right before it comes out.

comment:2 Changed 10 days ago by programmingkidx

Description: modified (diff)

I found this in the cmake_bootstrap.log file:

clang: error: invalid library name in argument '-stdlib=macports-libstdc++'
Test failed to compile

The only compiler that is tested is clang++-3.4.

Last edited 10 days ago by ryandesign (Ryan Schmidt) (previous) (diff)

comment:3 Changed 10 days ago by kencu (Ken)

Description: modified (diff)

On another note, I have set up a binaries server with many many GB of prebuilt binaries for MacOSX 10.4 Intel, 10.4 PPC, and 10.5 PPC. If you email me at kencu@…, I will send you the information regarding how to access it.

comment:4 Changed 10 days ago by kencu (Ken)

Description: modified (diff)

comment:5 Changed 10 days ago by kencu (Ken)

One other thing you might be happy to note. There is a new "cmake-bootstrap" port in MacPorts that builds and installs cmake 3.9.4 using only the OS compiler on every macOS system from 10.4 to current.

cmake 3.9.4 is quite capable, and although not 3.17, it can build a lot of things for bootstrapping purposes. You might find it useful. There are notes in cmake-bootstrap regarding how to use it instead of the full cmake port.

comment:6 Changed 10 days ago by kencu (Ken)

by the way, don't miss comment:1 with all these comments.

that is the real fix for this, and that is what I want you to test out.

Last edited 10 days ago by ryandesign (Ryan Schmidt) (previous) (diff)

comment:7 Changed 10 days ago by programmingkidx

How do I apply your patch and test it out? Really sorry for the noob question. I could not figure out how you wanted it tested.

comment:9 Changed 10 days ago by ryandesign (Ryan Schmidt)

Keywords: SFML removed
Milestone: MacPorts 2.6.3
Version: 2.6.2

comment:10 Changed 10 days ago by kencu (Ken)

Ryan's instructions are very complete.

Last edited 10 days ago by kencu (Ken) (previous) (diff)

comment:11 Changed 10 days ago by programmingkidx

Thank you for the instructions Ryan.

I did install macports-base. I noticed every dependency that was to be installed failed activation. Here is an example:

---> Activating p5.28-gssapi @0.280.0_3 Error: Failed to activate p5.28-gssapi: Image error: /opt/local/lib/perl5/vendor_perl/5.28/darwin-thread-multi-2level/ already exists and does not belong to a registered port. Unable to activate port p5.28-gssapi. Use 'port -f activate p5.28-gssapi' to force the activation.

Forcing the activation seems to work.

comment:12 Changed 10 days ago by kencu (Ken)

Well -- good thing you found that now. That was going to need to be fixed. Please be more specific about exactly what you are trying to do, and what fails.

So you installed the new base over top of your old one. That works, I have done it 1000 times. So the new base is (most likely) not the issue.

Base was installed. You then typed -- what? sudo port -v install XYZ? Tell us exactly, and exactly what the response is please.

comment:13 Changed 10 days ago by kencu (Ken)

If forcing the activation works, then there was software somehow installed in /opt/local that was not registered by port into the database.

Either something got really messed up, or perhaps you installed some software in some other way into /opt/local, like just decompressing it into there? (I only ask because I have noticed that you might be inclined to take matters into your own hands sometimes and do stuff like that :> ).

comment:14 Changed 10 days ago by kencu (Ken)

One thing -- months ago, I made available a clang-7.0 installer that was built to go into /opt/local, over on TigerBrew.

If you installed that, then you have stuff in /opt/local from that package that has to be removed.

I know it is not advised to make available things built to go into /opt/local for exactly this reason, but clang-7.0 on Tiger Intel was just frankly too big a behemoth to ever consider doing another entire installation into a new prefix.

Any Tiger Intel users who found that package useful and wanted to install a full macports (like programmingkid here) would need to sudo rm -rf /opt/local first to clean out that package.

comment:15 Changed 10 days ago by mf2k (Frank Schima)

Owner: set to rkitover
Status: newassigned

comment:16 Changed 10 days ago by programmingkidx

After following the instructions to install macport-base, I then tried installing SFML like this: sudo port install SFML

I did try your Clang installer months ago. That could be the reason why I see these activation issues. Is there a way to automatically force activation for every dependency that needs it?

comment:17 Changed 10 days ago by kencu (Ken)

You're functional right now, but in the long run, hosed.

When you're ready and can face the music, now that you have access to my binary archives (with all the compilers built, etc), you will have to follow these instructions <> to completely uninstall MacPorts.

Then install a new copy of MacPorts from the git tip like we said, and you can reinstall the ports you want from my archives with much less pain.

You might want to make a list of your currently installed ports first <> and then use that list to get you back in gear.

It is not impossible for you to keep and use the archives you have already built locally. It is just another non-trivial step. If you have the disc space, copy /opt/local/var/macports/software to someplace you like like /Users/Shared/software, and then maybe (maybe) we can come up with some way you can use those locally, just in case I don't already have them.

My apologies, in a way, for hooking you into macports with that clang-7.0 installer package but not realizing you still had it installed.

comment:18 Changed 10 days ago by programmingkidx

Please don't apologize. I prefer installers to having to build software myself. I am very thankful for your installer and hope more ports become available as installers.

comment:19 Changed 9 days ago by programmingkidx

I noticed there is a ton of ports that begin with p5.28. What does that mean?

I found a way around the problem.

Step 1: use a shell script that automatically activates ports:

if [ "$EUID" -ne 0 ]
  then echo "Please run as root"
while [ 1 ]
    echo trying to install "$target"
    if [[ $(port installed "$target" | grep "$target") ]]; then echo "$target" present; break; fi
    line=`port install "$target" 2>&1 > /dev/tty | grep "port -f activate"`
    package=$(echo $line | sed -e "s/^.*port -f activate //" -e "s/. .*//")
    if [ "$package" = "$oldpackage" ]; then echo double \""$package"\"; break; fi
    echo activating "$package"
    port -f activate "$package"

# This will all go in an executable shell script file called

Step 2: Find a way to say yes automatically to all the MacPorts prompts: The yes command.

Step 3: combine them together to completely automate installing ports.

yes | sudo sfml

Last edited 9 days ago by programmingkidx (previous) (diff)

comment:20 Changed 9 days ago by kencu (Ken)

very clever:)

port btw has an -N option that will often avoid the "yes" problem.

comment:21 Changed 6 days ago by kencu (Ken)

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