Opened 4 years ago

Closed 22 months ago

#61321 closed defect (fixed)

libtool, apr: SDK path is baked into installed files

Reported by: pierswalter (Piers Uso Walter) Owned by: larryv (Lawrence Velázquez)
Priority: Normal Milestone:
Component: ports Version: 2.6.3
Keywords: Cc: danielluke (Daniel J. Luke), murrayE
Port: apr libtool

Description

MacPorts 2.6.3, Xcode 12.0.1, macOS 10.15.7

I'm trying to install subversion +no_bdb. This fails in trying to build the dependency apr-util.

I can reproduce this when just building apr-util on its own:
Trying to build apr-util without using the +no_bdb variant works fine.
Trying to build apr-util +no_bdb fails just like the subversion build did.

I'll attach the build log.

The root cause seems to be that the build at one point starts to use this non-existing folder as sysroot:

/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk

This is puzzling because initially it seems to use the correct folder:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk

Please note that I've just opened ticket #61320 about an installer error message that appeared when I tried to install MacPorts on this computer. I am not sure whether or not that error was indicative of a real problem or not (MacPorts seems to work). I hope that the apr-util problem is not a followup error of #61320.

Attachments (3)

main.log (46.3 KB) - added by pierswalter (Piers Uso Walter) 4 years ago.
The build log
config.log (10.5 KB) - added by murrayE 4 years ago.
config.log from sudo port -ns upgrade --force apr with Xcode CLT 12.4 under macOS 11.1
main.2.log (13.8 KB) - added by murrayE 4 years ago.
main.log from sudo port -ns upgrade --force apr with Xcode CLT 12.4 under macOS 11.1

Download all attachments as: .zip

Change History (20)

Changed 4 years ago by pierswalter (Piers Uso Walter)

Attachment: main.log added

The build log

comment:1 Changed 4 years ago by mf2k (Frank Schima)

In the future, please add the port maintainer(s) to Cc (port info --maintainers apr-util), if any.

comment:2 Changed 4 years ago by mf2k (Frank Schima)

Owner: set to danielluke
Status: newassigned

comment:3 Changed 4 years ago by jmroot (Joshua Root)

We do strongly recommend that you install the Command Line Tools, which provides the SDK in /Library/Developer/CommandLineTools/SDKs, because Xcode does not necessarily provide an SDK matching your current OS version.

That said, this does seem to be a case of the SDK path being inappropriately baked in to apr's files. Changing variants would fix it because only the default variant would be installed from a binary archive; installing with different variants would result in a local build that bakes in the (currently) right path.

Last edited 4 years ago by jmroot (Joshua Root) (previous) (diff)

comment:4 Changed 4 years ago by jmroot (Joshua Root)

Port: apr added

comment:5 Changed 4 years ago by pierswalter (Piers Uso Walter)

@Frank:
Thanks for your reminder.
I'll try to keep it in mind to not forget to add the port maintainer(s) to Cc

@Joshua:
Thanks for the update.

As a side note, I currently do not seem to be able to install the command line tools.
Trying xcode-select --install opens the installer which informs me that the software cannot be installed since it currently is not available on the software update server.

Earlier today, the command line tools had shown up in system preferences' software updates pane. Trying to install them from there resulted in an error message: Command Line Tools for Xcode are no longer required for your computer or have already been installed.

I'll retry over the next few days, but as you mention, this specific case may not be related to my currently not having the separately installed command line tools.

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

Cc: danielluke added
Owner: changed from danielluke to larryv
Port: libtool added; apr-util removed
Summary: apr-util @1.6.1_2 +no_bdb fails to build (due to wrong sysroot?)libtool, apr: SDK path is baked into installed files

The SDK path gets baked into the files installed by the libtool port.

$ grep SDK /opt/local/bin/glibtool
/opt/local/bin/glibtool:LTCFLAGS="-pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64"

apr bundles and installs a copy of libtool so this affects the apr port too.

$ grep SDK /opt/local/share/apr-1/build/libtool /opt/local/share/apr-1/build/apr_rules.mk
/opt/local/share/apr-1/build/libtool:LTCFLAGS="-pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64"
/opt/local/share/apr-1/build/apr_rules.mk:CFLAGS=-pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64
/opt/local/share/apr-1/build/apr_rules.mk:CPPFLAGS=-I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
/opt/local/share/apr-1/build/apr_rules.mk:LDFLAGS=-L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64
$

The SDK path that gets baked in is the one from the command line tools, if the command line tools are installed, which they are on our build machines. You probably got a binary of apr from our build machines which is why that's the path it's looking for on your system.

You can avoid the problem by installing the command line tools or by rebuilding apr from source using sudo port -ns upgrade --force apr. Then, if you don't have the command line tools installed, the SDK path that will be baked in will be the Xcode SDK path.

If xcode-select --install does not work to install the command line tools you can download the installer from the Apple developer downloads web site.

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

Cc: murrayE added

Has duplicate #62150.

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

Has duplicate #62169.

Changed 4 years ago by murrayE

Attachment: config.log added

config.log from sudo port -ns upgrade --force apr with Xcode CLT 12.4 under macOS 11.1

Changed 4 years ago by murrayE

Attachment: main.2.log added

main.log from sudo port -ns upgrade --force apr with Xcode CLT 12.4 under macOS 11.1

comment:9 Changed 4 years ago by murrayE

Unfortunately, the recommendation in comment:6 to use sudo port -ns upgrade --force apr gives a config error. as shown in this excerpt from config.log:

configure:5440: /usr/bin/clang --version >&5
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
configure:5451: $? = 0
configure:5440: /usr/bin/clang -v >&5
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
configure:5451: $? = 0
configure:5440: /usr/bin/clang -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:5451: $? = 1
configure:5440: /usr/bin/clang -qversion >&5
clang: error: unknown argument '-qversion'; did you mean '--version'?
clang: error: no input files
configure:5451: $? = 1
configure:5471: checking whether the C compiler works
configure:5493: /usr/bin/clang -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk -arch x86_64 -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk -arch x86_64 conftest.c  >&5
ld: library not found for -lSystem
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:5497: $? = 1
configure:5535: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:5540: error: in `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_apr/apr/work/apr-1.7.0':
configure:5542: error: C compiler cannot create executables

Here also is the corresponding portion of main.log:

:info:configure checking for gcc... /usr/bin/clang
:info:configure checking whether the C compiler works... no
:info:configure configure: error: in `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_apr/apr/work/apr-1.7.0':
:info:configure configure: error: C compiler cannot create executables
Last edited 4 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:10 Changed 4 years ago by jmroot (Joshua Root)

Looks like your CLTs are missing some pieces, try ProblemHotlist#reinstall-clt

comment:11 Changed 4 years ago by murrayE

I just used the ProblemHotlist#reinstall-clt method, ran sudo port sync, and again tried sudo port -ns upgrade --force apr. Still getting what seems to be the very same configure error.

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

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

Your configure output shows that it is still trying to use MacOSX11.0.sdk, which won't work because that does not exist in your version of Xcode. I haven't yet tried to figure out why that's happening for you.

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

It sounds like #61866 but that was supposed to have been fixed in master already (which you are using).

comment:14 Changed 4 years ago by murrayE

Would it matter that I compiled master using Xcode CLT 12.3 but now I'm trying to install and upgrade ports using 12.4?

comment:15 Changed 4 years ago by murrayE

I've now installed apr @1.7.0_2 (MacPorts 2.6.99 under Big Sur 11.1 with XCode CLT 11.4) after removing all MacOSX10.x.sdk's and the truncated MacOSX11.0.sdk.

comment:16 in reply to:  14 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to murrayE:

Would it matter that I compiled master using Xcode CLT 12.3 but now I'm trying to install and upgrade ports using 12.4?

As far as I know, that should not matter.

comment:17 Changed 22 months ago by jmroot (Joshua Root)

Resolution: fixed
Status: assignedclosed

In dab529c446e7ec4ead56ccdcd3887bc7856f98bf/macports-ports (master):

apr: don't force use of baked-in SDK and CC

Maintainer timeout.

Closes: #61321

Note: See TracTickets for help on using tickets.