Opened 9 years ago

Closed 5 years ago

#48016 closed defect (fixed)

icu do not compile under OSX 10.7 (error: initialization of non-aggregate type with an initializer list)

Reported by: cgilles (HumanDynamo) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.3.3
Keywords: Cc: RJVB (René Bertin), mojca (Mojca Miklavec)
Port: icu

Description (last modified by ryandesign (Ryan Carsten Schmidt))

In order to compile digiKam bundle PKG for OSX, I tried successfuly to compile whole digiKam under OSX 10.10, 10.9, 10.8.

It fail under OSX 10.7 due to a C++11 code not supported by XCode/Clang :

OSX107:bundle gilles$ cat /opt/digikam/var/macports/logs//_opt_digikam_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_icu/icu/main.log
version:1
:debug:main Executing org.macports.main (icu)
:debug:main Skipping completed org.macports.archivefetch (icu)
:debug:main Skipping completed org.macports.fetch (icu)
:debug:main Skipping completed org.macports.checksum (icu)
:debug:main Skipping completed org.macports.extract (icu)
:debug:main Skipping completed org.macports.patch (icu)
:debug:main Skipping completed org.macports.configure (icu)
:debug:build build phase started at Thu Jun 11 00:17:45 CEST 2015
:notice:build --->  Building icu
:debug:build Executing org.macports.build (icu)
:debug:build Environment: 
CC_PRINT_OPTIONS='YES'
CC_PRINT_OPTIONS_FILE='/opt/digikam/var/macports/build/_opt_digikam_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_icu/icu/work/.CC_PRINT_OPTIONS'
CPATH='/opt/digikam/include'
LIBRARY_PATH='/opt/digikam/lib'
MACOSX_DEPLOYMENT_TARGET='10.7'
:debug:build Assembled command: 'cd "/opt/digikam/var/macports/build/_opt_digikam_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_icu/icu/work/icu/source" && /usr/bin/gnumake -j4 -w all VERBOSE=1'
:debug:build Executing command line:  cd "/opt/digikam/var/macports/build/_opt_digikam_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_icu/icu/work/icu/source" && /usr/bin/gnumake -j4 -w all VERBOSE=1 
:info:build gnumake: Entering directory `/opt/digikam/var/macports/build/_opt_digikam_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_icu/icu/work/icu/source'
:info:build /usr/bin/gnumake[0]: Making `all' in `stubdata'
:info:build gnumake[1]: Entering directory `/opt/digikam/var/macports/build/_opt_digikam_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_icu/icu/work/icu/source/stubdata'
:info:build gnumake[1]: Nothing to be done for `all'.
:info:build gnumake[1]: Leaving directory `/opt/digikam/var/macports/build/_opt_digikam_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_icu/icu/work/icu/source/stubdata'
:info:build /usr/bin/gnumake[0]: Making `all' in `common'
:info:build gnumake[1]: Entering directory `/opt/digikam/var/macports/build/_opt_digikam_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_icu/icu/work/icu/source/common'
:info:build /usr/bin/clang++ -DU_ATTRIBUTE_DEPRECATED= -DU_COMMON_IMPLEMENTATION -DU_HAVE_ATOMIC=1 -I. "-DDEFAULT_ICU_PLUGINS=\"/opt/digikam/lib/icu\" " -O2 -pipe -Os -arch x86_64 -stdlib=libc++ -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long --std=c++0x -fvisibility=hidden -fno-common -c -MMD -MT "putil.d putil.o putil.ao" -o putil.ao putil.cpp
:info:build /usr/bin/clang++ -DU_ATTRIBUTE_DEPRECATED= -DU_COMMON_IMPLEMENTATION -DU_HAVE_ATOMIC=1 -I. "-DDEFAULT_ICU_PLUGINS=\"/opt/digikam/lib/icu\" " -O2 -pipe -Os -arch x86_64 -stdlib=libc++ -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long --std=c++0x -fvisibility=hidden -fno-common -c -MMD -MT "uinit.d uinit.o uinit.ao" -o uinit.ao uinit.cpp
:info:build /usr/bin/clang++ -DU_ATTRIBUTE_DEPRECATED= -DU_COMMON_IMPLEMENTATION -DU_HAVE_ATOMIC=1 -I. "-DDEFAULT_ICU_PLUGINS=\"/opt/digikam/lib/icu\" " -O2 -pipe -Os -arch x86_64 -stdlib=libc++ -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long --std=c++0x -fvisibility=hidden -fno-common -c -MMD -MT "udata.d udata.o udata.ao" -o udata.ao udata.cpp
:info:build /usr/bin/clang++ -DU_ATTRIBUTE_DEPRECATED= -DU_COMMON_IMPLEMENTATION -DU_HAVE_ATOMIC=1 -I. "-DDEFAULT_ICU_PLUGINS=\"/opt/digikam/lib/icu\" " -O2 -pipe -Os -arch x86_64 -stdlib=libc++ -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long --std=c++0x -fvisibility=hidden -fno-common -c -MMD -MT "ucnv_bld.d ucnv_bld.o ucnv_bld.ao" -o ucnv_bld.ao ucnv_bld.cpp
:info:build uinit.cpp:27:33: error: initialization of non-aggregate type 'u_atomic_int32_t' (aka 'atomic<int32_t>') with an initializer list
:info:build static UInitOnce gICUInitOnce = U_INITONCE_INITIALIZER;
:info:build                                 ^~~~~~~~~~~~~~~~~~~~~~
:info:build ./umutex.h:199:33: note: expanded from macro 'U_INITONCE_INITIALIZER'
:info:build #define U_INITONCE_INITIALIZER {ATOMIC_INT32_T_INITIALIZER(0), U_ZERO_ERROR}
:info:build                                 ^
:info:build ./umutex.h:58:41: note: expanded from macro 'ATOMIC_INT32_T_INITIALIZER'
:info:build #define ATOMIC_INT32_T_INITIALIZER(val) ATOMIC_VAR_INIT(val)
:info:build                                         ^
:info:build /usr/bin/../lib/c++/v1/atomic:1497:30: note: expanded from macro 'ATOMIC_VAR_INIT'
:info:build #define ATOMIC_VAR_INIT(__v) {__v}
:info:build                              ^~~~~
:info:build uinit.cpp:66:20: warning: unused parameter 'status' [-Wunused-parameter]
:info:build u_init(UErrorCode *status) {
:info:build                    ^
:info:build 1 warning and 1 error generated.

Configuration :


OSX : 10.7.3
XCode : xcode_4.3.3_for_lion.dmg
CLI Tools : xcode452cltools10_76938212a.dmg

macports.conf includes these lines at end :

cxx_stdlib         libc++
buildfromsource    always
delete_la_files    yes

I tried to use another Clang version from Macports through port select without any difference :

port install clang_select
port install clang-3.6
port select --set clang mp-clang-3.6
port install icu

Thanks in advance to guide me.

Gilles Caulier

Change History (13)

comment:1 Changed 9 years ago by cgilles (HumanDynamo)

Cc: caulier.gilles@… added

Cc Me!

comment:3 Changed 9 years ago by RJVB (René Bertin)

It seems that port select only set the clang version available as /opt/local/bin/clang and clang++, but that doesn't make that the compiler used for building ports. I'm not even sure you can change the default for that globally.

While still under 10.6, adding configure.compiler=XXXX became an acquired motor programme for me ;)

comment:4 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: rjvbertin@… added; ryandesign caulier.gilles@… removed
Description: modified (diff)
Owner: changed from macports-tickets@… to ryandesign@…

caulier.gilles, please remember to use WikiFormatting, that the Cc field requires complete email addresses, and that it is unnecessary to Cc yourself when you are the reporter.

What version of clang do you have? Run clang -v to find out.

You've shown that you're running Xcode 4.3.3, and the Xcode command line tools from Xcode 4.5.2... you should not mismatch these versions, and if possible you should use the latest version for each, which is 4.6.3. Upgrading these may fix the problem; if so, we can blacklist the older clang you were using before.

rjvbertin, yes, port select only affects the user's own actions on the command line; it does not affect what MacPorts does when it builds ports (or, if it does, then it is a bug).

You are correct, a user cannot change the default compiler that will be used for all of MacPorts.

Users should not get in the habit of overriding configure.compiler at the command line, however it is a useful tool to try out different compilers, which can then be added to the portfile as a compiler.blacklist.

comment:5 Changed 9 years ago by cgilles (HumanDynamo)

My Apple Clang version is 4.1 (tags/Apple/clang-421.11.66 based on LLVM 3.1svn)

Gilles Caulier

comment:6 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Ok, that does indeed correspond to the version of clang in the Xcode command line tools version 4.5.2. Can you try updating Xcode and the command line tools to 4.6.3 to see if that helps?

comment:7 Changed 9 years ago by cgilles (HumanDynamo)

I already tested it. This only work with XCode 5.x (under OSX 10.8).

Xcode 4.x cannot handle this kind of C++11 array declaration.

Perhaps a simple patch can be done to fix it. Perhaps an UPSTREAM report must be send to icu team.

Sound like icu is the only port which do not support Xcode 4.x. And to bundle digiKam in a standalone PKG, a lots of ports are compiled. Whole compilation take more than 8 hours on 6 CPU core (i7-3.2Ghz-16G).

comment:8 in reply to:  4 Changed 9 years ago by RJVB (René Bertin)

Replying to ryandesign@…:

You are correct, a user cannot change the default compiler that will be used for all of MacPorts.

Users should not get in the habit of overriding configure.compiler at the command line, however it is a useful tool to try out different compilers, which can then be added to the portfile as a compiler.blacklist.

I'm not sure if it was clear that Gilles followed the recipe to use a modern libc++ instead of the system libstdc++. I have a hunch, possibly mistakingly so, that might require changing the default compiler.

comment:9 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Gilles, it's probably not the Xcode version but rather the clang version that's relevant.

René, yes, I did see that. That is certainly a relevant change. It is true that in order to use C++11 with libc++, a newer compiler is needed; including the cxx11 1.0 portgroup will set up the blacklist appropriately for that situation.

What's different here is that when not using libc++, icu builds fine with older versions of clang (as far as I know). So perhaps icu's configure script is detecting whether C++11 is available, and if so, is using constructs that need the newer clang. A complete log from the icu build might help identify if that's what's happening.

The cxx11 1.0 portgroup currently has only one mode of operation: enforcing that libc++ is used and blacklisting compilers that don't understand C++11. It might be worthwhile to extend the cxx11 portgroup so that it has an optional secondary mode of operation that blacklists non-C++11 compilers only when using libc++.

comment:10 Changed 9 years ago by cgilles (HumanDynamo)

ryandesign,

Xcode and Clang versions are closed as you can seen in wikipedia :

http://en.wikipedia.org/wiki/Xcode#Toolchain_versions

Q :

if i install icu like this :

port install clang_select
port install clang-3.6
port select --set clang mp-clang-3.6
port install icu configure.compiler=macports-clang-3.6
  1. This want mean that all ports required to install icu (dependencies) will be compiled with "macports-clang-3.6" ?
  2. This want mean that all ports to install later and which use icu as dependency will be compiled with "macports-clang-3.6" ?

Gilles Caulier

Last edited 9 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:11 Changed 9 years ago by cgilles (HumanDynamo)

The solution explained in my previous comment work fine under OSX 10.7.3 with my Xcode configuration :

Selecting 'mp-clang-3.4' for 'clang' succeeded. 'mp-clang-3.4' is now active.

--->  Computing dependencies for icu
--->  Fetching distfiles for icu
--->  Attempting to fetch icu4c-55_1-src.tgz from http://lil.fr.distfiles.macports.org/icu
--->  Verifying checksums for icu
--->  Extracting icu
--->  Applying patches to icu
--->  Configuring icu
--->  Building icu
--->  Staging icu into destroot
--->  Installing icu @55.1_0
--->  Activating icu @55.1_0
--->  Cleaning icu
--->  Updating database of binaries
--->  Scanning binaries for linking errors
--->  No broken files found.
Last edited 9 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:12 in reply to:  10 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to caulier.gilles@…:

Xcode and Clang versions are closed as you can seen in wikipedia :

http://en.wikipedia.org/wiki/Xcode#Toolchain_versions

I'm aware that Xcode versions include specific related versions of clang; we have our own version of that chart at XcodeVersionInfo. But we offer newer versions of clang in MacPorts which could be used to address the situation, as you discovered.

if i install icu like this :

port install clang_select
port install clang-3.6
port select --set clang mp-clang-3.6

The only thing that "selecting" mp-clang-3.6 will do is creating a symlink /opt/local/bin/clang pointing to MacPorts clang 3.6. This makes it more convenient for you to use MacPorts clang 3.6 in your own projects at the command line because you now only have to type "clang". But this will not affect how MacPorts builds any ports. MacPorts will still use the compiler it intends to use, regardless of whether you have a "clang" symlink or what it points to.

port install icu configure.compiler=macports-clang-3.6
  1. This want mean that all ports required to install icu (dependencies) will be compiled with "macports-clang-3.6" ?

Yes, but only the ones that were not already installed. To prevent that, make sure you install all dependencies first.

  1. This want mean that all ports to install later and which use icu as dependency will be compiled with "macports-clang-3.6" ?

No; it is a one-time action for that single installation. It will not affect other later installations of other ports, nor will it affect later rebuilds or upgrades of icu.

Setting configure.compiler at the command line is a diagnostic tool. So thank you for using it to verify that using a newer clang does allow you to build in this situation. Now we just need to decide the best way to fix the port: either manually add code to the icu port to add the cxx11 portgroup when the stdlib is libc++, or add code to the cxx11 portgroup to provide a flag to enable that behavior so that other ports that need it could use it too.

comment:13 Changed 8 years ago by mojca (Mojca Miklavec)

Cc: mojca added

comment:14 Changed 5 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: newclosed

In the time since this ticket was filed, icu has been updated to a new version that requires C++11, and we have made libc++ the default on Mac OS X 10.6, 10.7 and 10.8. I am going to assume that that has solved any build failures. If you have an up-to-date MacPorts and ports tree (sudo port selfupdate) and are still having trouble with icu, please file a new ticket with a new logfile.

Note: See TracTickets for help on using tickets.