Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#59808 closed defect (fixed)

cmake @3.16.0 – patch file patch-cmake-3-12-libuv-tiger.diff fails with this version in Utilities/cmlibuv/src/unix/fs.c

Reported by: ballapete (Peter "Pete" Dyballa) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.6.2
Keywords: tiger Cc: kencu (Ken), michaelld (Michael Dickens)
Port: cmake

Description

Due to changes in C code one of the patches for Utilities/cmlibuv/src/unix/fs.c fails and so the build never really starts.

I have updated the patch file patch-cmake-3-12-libuv-tiger.diff to "version" patch-cmake-3-16-libuv-tiger.diff which at least applies. The build is still going on.

Attachments (3)

patch-cmake-3-16-libuv-tiger.diff (1.4 KB) - added by ballapete (Peter "Pete" Dyballa) 4 years ago.
Patch file for cmake @3.16's Utilities/cmlibuv/src/unix/fs.c
main.log (298.0 KB) - added by ballapete (Peter "Pete" Dyballa) 4 years ago.
Main.log from PPC Tiger, here build with patch-cmake-3-16-libuv-tiger.diff
patch-cmake-3-16-tiger.diff (3.2 KB) - added by kencu (Ken) 4 years ago.
Ken's cmake 3.16.1 Tiger/Leopard patch

Download all attachments as: .zip

Change History (23)

Changed 4 years ago by ballapete (Peter "Pete" Dyballa)

Patch file for cmake @3.16's Utilities/cmlibuv/src/unix/fs.c

comment:1 Changed 4 years ago by kencu (Ken)

Thanks, Peter. Indeed, I have been working on this too. For now, I pegged cmake at 3.15.5 in TigerPorts/LeopardPorts <https://github.com/kencu/TigerPorts/commit/7d00cb7a9c9baa131c9b8727fc1fabb75d5a5858> as it might take some time for this to be resolved.

I suspect we'll have to consider a situation like libuv, where we peg it at certain versions and I update it from time to time, but not on Michael's quick updating schedule for the main MacPorts repo.

comment:2 Changed 4 years ago by ballapete (Peter "Pete" Dyballa)

Build fails with:

/opt/local/bin/g++-mp-7 -L/opt/local/lib -Wl,-headerpad_max_install_names -lMacportsLegacySupport -Wl,-framework -Wl,ApplicationServices -lMacportsLegacySupport -arch ppc -framework CoreFoundation -pipe -Os -D_GLIBCXX_USE_CXX11_ABI=0 -arch ppc       -DCMAKE_BOOTSTRAP   -I/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-3.16.0/Bootstrap.cmk   -I/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-3.16.0/Source   -I/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-3.16.0/Source/LexerParser   -I/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-3.16.0/Utilities/std   -I/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-3.16.0/Utilities  cmAddCustomCommandCommand.o cmAddCustomTargetCommand.o cmAddDefinitionsCommand.o cmAddDependenciesCommand.o cmAddExecutableCommand.o cmAddLibraryCommand.o cmAddSubDirectoryCommand.o cmAddTestCommand.o cmArgumentParser.o cmBinUtilsLinker.o cmBinUtilsLinuxELFGetRuntimeDependenciesTool.o cmBinUtilsLinuxELFLinker.o cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool.o cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.o cmBinUtilsMacOSMachOLinker.o cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool.o cmBinUtilsWindowsPEGetRuntimeDependenciesTool.o cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool.o cmBinUtilsWindowsPELinker.o cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool.o cmBreakCommand.o cmBuildCommand.o cmCMakeMinimumRequired.o cmCMakePolicyCommand.o cmCPackPropertiesGenerator.o cmCacheManager.o cmCheckCustomOutputs.o cmCommand.o cmCommandArgumentParserHelper.o cmCommands.o cmCommonTargetGenerator.o cmComputeComponentGraph.o cmComputeLinkDepends.o cmComputeLinkInformation.o cmComputeTargetDepends.o cmConditionEvaluator.o cmConfigureFileCommand.o cmContinueCommand.o cmCoreTryCompile.o cmCreateTestSourceList.o cmCustomCommand.o cmCustomCommandGenerator.o cmDefinePropertyCommand.o cmDefinitions.o cmDepends.o cmDependsC.o cmDocumentationFormatter.o cmEnableLanguageCommand.o cmEnableTestingCommand.o cmExecProgramCommand.o cmExecuteProcessCommand.o cmExpandedCommandArgument.o cmExportBuildFileGenerator.o cmExportFileGenerator.o cmExportInstallFileGenerator.o cmExportSet.o cmExportTryCompileFileGenerator.o cmExprParserHelper.o cmExternalMakefileProjectGenerator.o cmFileCommand.o cmFileCopier.o cmFileInstaller.o cmFileTime.o cmFileTimeCache.o cmFileTimes.o cmFindBase.o cmFindCommon.o cmFindFileCommand.o cmFindLibraryCommand.o cmFindPackageCommand.o cmFindPathCommand.o cmFindProgramCommand.o cmForEachCommand.o cmFunctionBlocker.o cmFunctionCommand.o cmFSPermissions.o cmGeneratedFileStream.o cmGeneratorExpression.o cmGeneratorExpressionContext.o cmGeneratorExpressionDAGChecker.o cmGeneratorExpressionEvaluationFile.o cmGeneratorExpressionEvaluator.o cmGeneratorExpressionLexer.o cmGeneratorExpressionNode.o cmGeneratorExpressionParser.o cmGeneratorTarget.o cmGetCMakePropertyCommand.o cmGetDirectoryPropertyCommand.o cmGetFilenameComponentCommand.o cmGetPipes.o cmGetPropertyCommand.o cmGetSourceFilePropertyCommand.o cmGetTargetPropertyCommand.o cmGetTestPropertyCommand.o cmGlobalCommonGenerator.o cmGlobalGenerator.o cmGlobalUnixMakefileGenerator3.o cmGlobVerificationManager.o cmHexFileConverter.o cmIfCommand.o cmIncludeCommand.o cmIncludeGuardCommand.o cmIncludeDirectoryCommand.o cmIncludeRegularExpressionCommand.o cmInstallCommand.o cmInstallCommandArguments.o cmInstallDirectoryGenerator.o cmInstallExportGenerator.o cmInstallFilesCommand.o cmInstallFilesGenerator.o cmInstallGenerator.o cmInstallScriptGenerator.o cmInstallSubdirectoryGenerator.o cmInstallTargetGenerator.o cmInstallTargetsCommand.o cmInstalledFile.o cmLDConfigLDConfigTool.o cmLDConfigTool.o cmLinkDirectoriesCommand.o cmLinkItem.o cmLinkLineComputer.o cmLinkLineDeviceComputer.o cmListCommand.o cmListFileCache.o cmLocalCommonGenerator.o cmLocalGenerator.o cmLocalUnixMakefileGenerator3.o cmMSVC60LinkLineComputer.o cmMacroCommand.o cmMakeDirectoryCommand.o cmMakefile.o cmMakefileExecutableTargetGenerator.o cmMakefileLibraryTargetGenerator.o cmMakefileTargetGenerator.o cmMakefileUtilityTargetGenerator.o cmMarkAsAdvancedCommand.o cmMathCommand.o cmMessageCommand.o cmMessenger.o cmNewLineStyle.o cmOSXBundleGenerator.o cmOptionCommand.o cmOrderDirectories.o cmOutputConverter.o cmParseArgumentsCommand.o cmPathLabel.o cmPolicies.o cmProcessOutput.o cmProjectCommand.o cmPropertyDefinition.o cmPropertyDefinitionMap.o cmPropertyMap.o cmReturnCommand.o cmRulePlaceholderExpander.o cmRuntimeDependencyArchive.o cmScriptGenerator.o cmSearchPath.o cmSeparateArgumentsCommand.o cmSetCommand.o cmSetDirectoryPropertiesCommand.o cmSetPropertyCommand.o cmSetSourceFilesPropertiesCommand.o cmSetTargetPropertiesCommand.o cmSetTestsPropertiesCommand.o cmSiteNameCommand.o cmSourceFile.o cmSourceFileLocation.o cmState.o cmStateDirectory.o cmStateSnapshot.o cmString.o cmStringAlgorithms.o cmStringReplaceHelper.o cmStringCommand.o cmSubcommandTable.o cmSubdirCommand.o cmSystemTools.o cmTarget.o cmTargetCompileDefinitionsCommand.o cmTargetCompileFeaturesCommand.o cmTargetCompileOptionsCommand.o cmTargetIncludeDirectoriesCommand.o cmTargetLinkLibrariesCommand.o cmTargetPrecompileHeadersCommand.o cmTargetPropCommandBase.o cmTargetPropertyComputer.o cmTargetSourcesCommand.o cmTest.o cmTestGenerator.o cmTimestamp.o cmTryCompileCommand.o cmTryRunCommand.o cmUnsetCommand.o cmUVHandlePtr.o cmUVProcessChain.o cmVersion.o cmWhileCommand.o cmWorkingDirectory.o cmake.o cmakemain.o cmcmd.o string_view.o cmCommandArgumentLexer.o cmCommandArgumentParser.o cmExprLexer.o cmExprParser.o cmListFileLexer.o Directory.o EncodingCXX.o FStream.o Glob.o RegularExpression.o SystemTools.o EncodingC.o ProcessUNIX.o String.o System.o Terminal.o uv-src-strscpy.c.o uv-src-timer.c.o uv-src-uv-common.c.o uv-src-unix-cmake-bootstrap.c.o uv-src-unix-core.c.o uv-src-unix-fs.c.o uv-src-unix-loop.c.o uv-src-unix-loop-watcher.c.o uv-src-unix-no-fsevents.c.o uv-src-unix-pipe.c.o uv-src-unix-poll.c.o uv-src-unix-posix-hrtime.c.o uv-src-unix-posix-poll.c.o uv-src-unix-process.c.o uv-src-unix-signal.c.o uv-src-unix-stream.c.o  -o cmake
Undefined symbols:
  "_close$NOCANCEL$UNIX2003", referenced from:
      _uv__close_nocancel in uv-src-unix-core.c.o
      _uv__close_nocheckstdio in uv-src-unix-core.c.o
ld: symbol(s) not found
collect2: error: ld returned 1 exit status
gmake: *** [Makefile:2: cmake] Error 1
---------------------------------------------
Error when bootstrapping CMake:
Problem while running gmake
---------------------------------------------
Log of errors: /opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-3.16.0/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-3.16.0" && ./configure --prefix=/opt/local --docdir=share/doc/cmake --parallel=1 --init=/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/work/cmake-3.16.0/macports.cmake --system-libs --no-system-jsoncpp --no-system-librhash --no-qt-gui 
Exit code: 9

Changed 4 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

Main.log from PPC Tiger, here build with patch-cmake-3-16-libuv-tiger.diff

comment:3 Changed 4 years ago by michaelld (Michael Dickens)

@kencu didn't we (try to) fix the "_close$NOCANCEL$UNIX2003" issue in libuv? hmm ...

I'll update the cmake patch shortly. Just not enough time in the day to test on anything other than the CI here!

comment:4 Changed 4 years ago by michaelld (Michael Dickens)

Can this patch just be applied to all installs? it looks like the only real change for modern macOS is to use #include <copyfile.h> instead of #include <sys/sysctl.h> ... I'm trying building on 10.14 right now to see if this works. If so, I'll make a PR to see if the CI works with it too.

comment:5 Changed 4 years ago by kencu (Ken)

I did fix the $NOCANCEL thing in libuv, and sent that upstream, but still cmake fails.

It squeeks by on a 10.6.8 that is already bootstrapped by building with clang-9.0.

Otherwise 10.7 fails too (although builds if clang-9 is forced). We'll need some brainpower on this. There is another ticket somewhere for the 10.7 thing.

comment:6 Changed 4 years ago by michaelld (Michael Dickens)

my my my ... so something has changed in libuv ... again ...

Anyway: that patch seems fine to me for general use. I'm creating a PR to see how it does with the CI we use. if that works, then I'll merge. Which at least takes care of 1 issue ...

comment:7 Changed 4 years ago by michaelld (Michael Dickens)

I do think it would be wise to peg CMake at some known-working version for older OSs ... like we do with libuv. Do you have the bandwidth to look at that, Ken? I'm pretty bandwidth-impaired for a while due to work and contracts and such ...

comment:8 Changed 4 years ago by michaelld (Michael Dickens)

comment:9 Changed 4 years ago by michaelld (Michael Dickens)

In b47e604b355871a1fb257992759b6614e8cf8f17/macports-ports (master):

cmake: fix the libuv Tiger fix and make it global

Ref: #59808

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

Peter -- cmake 3.16 still does not build after this. Working on it.

Currently:

  1. cmake does not build with any gcc version on MacOS (so no PPC builds)
  2. cmake does not build with any gcc or clang compiler on 10.5 Intel (Riccardo's report).
  3. cmake does not build with clang-3.4 (causes bootstrapping issues on 10.7 and less).

I have cmake pegged to 3.15.5 in my overlays.

Setting up cmake to use a pegged version in MacPorts looks to be considerably more complicated that for libuv, due to multiple patch files (easy enough to fix) and more of an issue, variants with patchfiles in the variants that would need to be pegged as well.

I'm thinking through another scenario.

Version 2, edited 4 years ago by kencu (Ken) (previous) (next) (diff)

comment:11 Changed 4 years ago by kencu (Ken)

Success. Now to bundle this up for a PR...

$ port -v installed cmake
The following ports are currently installed:
  cmake @3.16.0_0 (active) platform='darwin 8' archs='ppc' date='2019-12-04T19:01:32-0800'

comment:12 Changed 4 years ago by kencu (Ken)

Leopard Intel is fixed.

$ port -v installed cmake
The following ports are currently installed:
  cmake @3.16.0_0 (active) platform='darwin 9' archs='i386' date='2019-12-05T08:14:13-0800'

Leopard PPC works also, although there is a weird error with libgcc7 7.5.0 about a "non-aligned pointer being freed" that goes away when I downgrade to libgcc7 7.4.x that will need to get sorted out -- something to do with our posix_memalign implementation in legacysupport? not sure...

comment:13 Changed 4 years ago by kencu (Ken)

I have a new patch for Tiger that works (the current one in the port does not).

I think this patch will also fix Leopard (the #include <memory> part is the key).

Changed 4 years ago by kencu (Ken)

Attachment: patch-cmake-3-16-tiger.diff added

Ken's cmake 3.16.1 Tiger/Leopard patch

comment:14 Changed 4 years ago by kencu (Ken)

All that patchfile can be applied to all cmake builds -- I am not yet certain about the #include <memory> addition. I think it is meaningless to clang, as it must be included automatically somehow by clang/libc++, but I have not as yet tested exactly when it is needed and if there are any circumstances where it can't be included.

comment:15 in reply to:  13 Changed 4 years ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

I have a new patch for Tiger that works (the current one in the port does not).

cmake @3.16.1_0 (active) platform='darwin 9' archs='ppc' date='2019-12-13T18:28:16+0100' built here on PPC Leopard, Mac OS X 10.5.8. It built with GCC 7.4.

Last edited 4 years ago by ballapete (Peter "Pete" Dyballa) (previous) (diff)

comment:16 in reply to:  13 Changed 4 years ago by ballapete (Peter "Pete" Dyballa)

Replying to kencu:

I have a new patch for Tiger that works (the current one in the port does not).

cmake @3.16.1_0 (active) platform='darwin 8' archs='ppc' date='2019-12-14T01:18:21+0100' built here on PPC Tiger, Mac OS X 10.4.11. It built with GCC 7.5.

comment:17 in reply to:  13 Changed 4 years ago by jmroot (Joshua Root)

Replying to kencu:

I think this patch will also fix Leopard (the #include <memory> part is the key).

That part at least should be upstreamed; it's incorrect to use unique_ptr without including <memory> first.

comment:18 Changed 4 years ago by michaelld (Michael Dickens)

Does https://trac.macports.org/changeset/cf6e913039d8bfafa4c4c9e2ec994ce83888f311/macports-ports fix this? I reviewed it, tested it as best I could, and then merged it.

comment:19 Changed 4 years ago by kencu (Ken)

Resolution: fixed
Status: newclosed

Indeed. sorry I neglected to ref this in the PR

comment:20 Changed 4 years ago by michaelld (Michael Dickens)

NP & thx for both the fix & dealing with this!

Note: See TracTickets for help on using tickets.