Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#39918 closed defect (fixed)

serf1: re-enable universal variant

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: blair (Blair Zajac)
Priority: Normal Milestone:
Component: ports Version: 2.2.0
Keywords: Cc: cooljeanius (Eric Gallager), jpenney (Jason Penney), Serge3leo (Serguei E. Leontiev), jeremyhu (Jeremy Huddleston Sequoia)
Port: serf1

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

r108691 updated serf1 to 1.3.0 and switched to its scons build system, which brought with it use_configure no, which removes the universal variant, thereby dooming all ports depending on serf1 to non-universality. Please reinstate the universal variant.

At minimum, you'll need to add this line before the first time you invoke the get_canonical_archflags proc:

variant universal {}

However that alone does not appear to be sufficient. The port tries to communicate the archflags to the build system via the ARCHFLAGS environment variable, but grepping the serf source for ARCHFLAGS does not reveal any hits, so I'm not sure whether this is intended to work. (Is this a standard scons environment variable?)

My own opinion is that the scons build system is difficult to use, especially in MacPorts. That might be partially remedied by the creation of a scons portgroup to abstract away some of the implementation details.

Change History (20)

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

Description: modified (diff)

comment:2 Changed 11 years ago by blair (Blair Zajac)

I just copied this section from mongodb's port:

build.env       ARCHFLAGS="[get_canonical_archflags]" \
                CPPFLAGS="${configure.cppflags}" \
                LDFLAGS="${configure.ldflags}"

I found CFLAGS in SConstruct and it's next to PREFIX and the other flags set via build.target. Maybe we remove ARCHFLAGS and set CFLAGS where PREFIX is set in build.target. Can you see if that works?

Do you have systems with universal builds?

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

Yes, my primary system defaults to universal builds. But it's trivial for you to try it out too; just run "sudo port install serf1 +universal" and MacPorts will universalize dependencies as necessary.

comment:4 Changed 11 years ago by blair (Blair Zajac)

I'd rather not switch my system to universal. I'll update the Portfile here and can you try it?

comment:5 Changed 11 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

comment:6 Changed 11 years ago by cooljeanius (Eric Gallager)

Fink actually also had some issues with serf1 and scons ignoring arch flags... let me see if I can find how they solved it again...

comment:7 in reply to:  2 Changed 11 years ago by jmroot (Joshua Root)

Replying to blair@…:

I just copied this section from mongodb's port:

Mongodb patches the SConstruct to make that work.

comment:8 Changed 11 years ago by jpenney (Jason Penney)

Cc: jpenney@… added

Cc Me!

comment:9 Changed 11 years ago by Serge3leo (Serguei E. Leontiev)

Cc: leo@… added

Cc Me!

comment:10 Changed 11 years ago by Serge3leo (Serguei E. Leontiev)

Portfile probably contains a few errors:

  • ARCHFLAGS not required to build serf;
  • CFLAGS is not defined properly;
  • serf build requires LINKFLAGS, not LDFLAGS;
  • serf SConstruct can't use environment variables, it requires command-line arguments;

For add build universal variant should fix the Portfile:

variant universal {
    build.args CC=${configure.cc} \
        CFLAGS=[string map {" " ","} "${configure.universal_cflags}"] \
        CPPFLAGS=[string map {" " ","} "${configure.universal_cppflags}"] \
        LINKFLAGS=[string map {" " ","} "${configure.universal_ldflags}"]
}

build.cmd       ${prefix}/bin/scons
build.args      CC=${configure.cc} \
                CFLAGS=[string map {" " ","} "${configure.cflags}"] \
                CPPFLAGS=[string map {" " ","} "${configure.cppflags}"] \
                LINKFLAGS=[string map {" " ","} "${configure.ldflags}"]

-- Sorry for my best English

Last edited 11 years ago by Serge3leo (Serguei E. Leontiev) (previous) (diff)

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

This (though untested) would be shorter, and more accurate in that the universal build would get the regular c-, cpp- and ldflags too, and the non-universal build would get correct -arch flags too:

variant universal {}

build.cmd       ${prefix}/bin/scons
build.args      CC=${configure.cc} \
                CFLAGS=[string map {" " ","} "${configure.cflags} [get_canonical_archflags cc]"] \
                CPPFLAGS=[string map {" " ","} "${configure.cppflags}"] \
                LINKFLAGS=[string map {" " ","} "${configure.ldflags} [get_canonical_archflags ld]"]

That's assuming it's correct to concatenate these flags with commas instead of spaces. I've never seen that before and it seems weird to me. But we've already established that scons is needlessly weird.

comment:12 in reply to:  11 Changed 11 years ago by Serge3leo (Serguei E. Leontiev)

Replying to ryandesign@…:

That's assuming it's correct to concatenate these flags with commas instead of spaces. I've never seen that before and it seems weird to me. But we've already established that scons is needlessly weird.

Not scons, but serf-1.3.0/SConstruct :) See function RawListVariable() at serf-1.3.0/SConstruct:40 and CFLAGS at line 89

Last edited 11 years ago by Serge3leo (Serguei E. Leontiev) (previous) (diff)

comment:13 in reply to:  11 Changed 11 years ago by larryv (Lawrence Velázquez)

It would be cleaner to use join for this.

[join "${configure.cflags},[get_canonical_archflags cc]" ,]

comment:14 Changed 11 years ago by blair (Blair Zajac)

So is the following correct, incorporating all the feedback?

variant universal {}

build.cmd       ${prefix}/bin/scons
build.args      CC=${configure.cc} \
                CPPFLAGS=[join "${configure.cppflags}" ,] \
                CFLAGS=[join "${configure.cflags},[get_canonical_archflags cc]" ,] \
                LINKFLAGS=[join "${configure.ldflags},[get_canonical_archflags ld]" ,]

Ryan, feel free to commit any changes you want.

comment:15 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Cc: jeremyhu@… added

Cc Me!

comment:16 Changed 11 years ago by blair (Blair Zajac)

When this is fixed, does svn need to have its revisions bumped to recompile so it picks up the universal pieces?

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

Resolution: fixed
Status: newclosed

It appears to work. Committed in r108804.

No, other ports should not need any changes.

comment:18 Changed 11 years ago by blair (Blair Zajac)

Thanks.

So the pre-fixed version would, say, only have x86_64 bits while the universal build would have x86_64 and i386? But how could Subversion link the i386 version against libserf-1.dylib when it only contains x86_64? Or it only cares about the symbols and the symbols are there for both arches?

comment:19 in reply to:  18 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to blair@…:

So the pre-fixed version would, say, only have x86_64 bits

Right, whatever was specified for build_arch in the user's macports.conf.

while the universal build would have x86_64 and i386?

Right, whatever was specified for universal_archs in the user's macports.conf.

But how could Subversion link the i386 version against libserf-1.dylib when it only contains x86_64? Or it only cares about the symbols and the symbols are there for both arches?

It could not. MacPorts knows this and checks that the architectures match before allowing a build. If a user had tried to install or upgrade subversion +universal, MacPorts would have exited with an error explaining that it could not be done because dependency serf1 did not have a universal variant. And now it does so now it should work again.

comment:20 Changed 11 years ago by blair (Blair Zajac)

OK, great, thanks for the explanation.

Note: See TracTickets for help on using tickets.