Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: migrate swift to CMake 3.15.1 #2524

Merged
merged 2 commits into from Nov 5, 2019
Merged

Conversation

compnerd
Copy link
Collaborator

This migrates Foundation to CMake 3.15.1 and uses the new export targets from
libdispatch to enable simpler builds with better dependency tracking.

@compnerd compnerd force-pushed the cmake-3.15.1 branch 2 times, most recently from e6c66cb to 678690e Compare September 28, 2019 00:11
@compnerd
Copy link
Collaborator Author

Please test with following PR:
apple/swift-corelibs-libdispatch#525

@swift-ci please test

@compnerd
Copy link
Collaborator Author

Please test with following PR:
apple/swift-corelibs-libdispatch#525
apple/swift#27434

@swift-ci please test

@compnerd
Copy link
Collaborator Author

Please test with following PR:
apple/swift-corelibs-libdispatch#525
apple/swift#27438

@swift-ci please test

@compnerd
Copy link
Collaborator Author

Please test with following PR:
apple/swift-corelibs-libdispatch#525
apple/swift#27438

@swift-ci please test

@compnerd
Copy link
Collaborator Author

Please test with following PR:
apple/swift-corelibs-libdispatch#530
apple/swift#27438

@swift-ci please test

@compnerd
Copy link
Collaborator Author

compnerd commented Oct 1, 2019

Please test with following PR:
apple/swift-corelibs-libdispatch#530
apple/swift#27438
apple/swift-llbuild#568

@swift-ci please test

@compnerd
Copy link
Collaborator Author

compnerd commented Oct 1, 2019

Please test with following PR:
apple/swift#27438
apple/swift-llbuild#568
apple/swift-package-manager#2359

@swift-ci please test

@compnerd
Copy link
Collaborator Author

compnerd commented Oct 3, 2019

Please test with following PR:
apple/swift-package-manager#2359

@swift-ci please test

1 similar comment
@compnerd
Copy link
Collaborator Author

Please test with following PR:
apple/swift-package-manager#2359

@swift-ci please test

@compnerd
Copy link
Collaborator Author

Please test with following PR:
apple/swift-package-manager#2359
apple/swift#27657

@swift-ci please test Linux platform

1 similar comment
@spevans
Copy link
Collaborator

spevans commented Oct 14, 2019

Please test with following PR:
apple/swift-package-manager#2359
apple/swift#27657

@swift-ci please test Linux platform

@spevans
Copy link
Collaborator

spevans commented Oct 14, 2019

Please test with following PR:
apple/swift#27657

@swift-ci please test Linux platform

1 similar comment
@compnerd
Copy link
Collaborator Author

Please test with following PR:
apple/swift#27657

@swift-ci please test Linux platform

@compnerd
Copy link
Collaborator Author

Please test with following PR:
apple/swift#27853

@swift-ci please test Linux platform

@norio-nomura
Copy link
Contributor

FYI, building toolchain package using this PR fails with following error:

CMake Error at Tools/plutil/cmake_install.cmake:41 (file):
  file INSTALL cannot find
  "/Users/norio/github/swift-dev/swift-corelibs-foundation/Tools/plutil/plutil".
Call Stack (most recent call first):
  Tools/cmake_install.cmake:42 (include)
  cmake_install.cmake:52 (include)


FAILED: CMakeFiles/install.util 
cd /Users/norio/github/swift-dev/build/buildbot_linux/foundation-linux-x86_64 && /Users/norio/github/swift-dev/build/cmake-linux-x86_64/bin/cmake -P cmake_install.cmake
ninja: build stopped: subcommand failed.
swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting
swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

I guess that is not reproduced with the test triggered by #2524 (comment)

@compnerd
Copy link
Collaborator Author

Ugh, seems that PROGRAMS uses the FILES path, not the TARGETS path, which is probably why it fails. Should be trivial to fix... changing PROGRAMS to TARGETS.

@compnerd
Copy link
Collaborator Author

@swift-ci please test

1 similar comment
@spevans
Copy link
Collaborator

spevans commented Oct 24, 2019

@swift-ci please test

@compnerd
Copy link
Collaborator Author

@swift-ci please test

@norio-nomura
Copy link
Contributor

building toolchain package with updated commit fails with following error:

CMake Error at cmake_install.cmake:93 (file):
  file INSTALL cannot find
  "/Users/norio/github/swift-dev/build/buildbot_linux/foundation-linux-x86_64/plutil".


FAILED: CMakeFiles/install.util 
cd /Users/norio/github/swift-dev/build/buildbot_linux/foundation-linux-x86_64 && /Users/norio/github/swift-dev/build/cmake-linux-x86_64/bin/cmake -P cmake_install.cmake
ninja: build stopped: subcommand failed.
swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting
swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

plutil seems to be created at /Users/norio/github/swift-dev/build/buildbot_linux/foundation-linux-x86_64/Tools/plutil/plutil.

@compnerd
Copy link
Collaborator Author

That is the correct location; I wonder why its looking for plutil in the wrong location. Did you do a clean build @norio-nomura?

@norio-nomura
Copy link
Contributor

Did you do a clean build @norio-nomura?

No.
I'll try again with removing foundation-linux-x86_64.

@norio-nomura
Copy link
Contributor

I'll try again with removing foundation-linux-x86_64.

I got same result.
regenerated build/buildbot_linux/foundation-linux-x86_64/cmake_install.cmake has entry:

file(INSTALL DESTINATION "/usr/bin" TYPE PROGRAM FILES "/Users/norio/github/swift-dev/build/buildbot_linux/foundation-linux-x86_64/plutil")

but, plutil is placed at:

…/build/buildbot_linux/foundation-linux-x86_64/Tools/plutil/plutil

instead of

…/build/buildbot_linux/foundation-linux-x86_64/plutil

that cmake_install.cmake expects.

@compnerd
Copy link
Collaborator Author

Something seems cached there, this is what is getting generated for me:

if("x${CMAKE_INSTALL_COMPONENT}x" STREQUAL "xUnspecifiedx" OR NOT CMAKE_INSTALL_COMPONENT)
  file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "S:/b/foundation/Tools/plutil/plutil.exe")
  if(EXISTS "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/plutil.exe" AND
     NOT IS_SYMLINK "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/plutil.exe")
    if(CMAKE_INSTALL_DO_STRIP)
      execute_process(COMMAND "S:/b/toolchain/bin/strip.exe" "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/plutil.exe")
    endif()
  endif()
endif()

@norio-nomura
Copy link
Contributor

building toolchain package with updated commit fails with following error:

+ /Users/norio/github/swift-dev/indexstore-db/Utilities/build-script-helper.py build --verbose --package-path /Users/norio/github/swift-dev/indexstore-db --build-path /Users/norio/github/swift-dev/build/buildbot_linux/indexstoredb-linux-x86_64 --configuration release --toolchain /Users/norio/github/swift-dev/build/swift-nightly-install --ninja-bin /Users/norio/github/swift-dev/build/buildbot_linux/ninja-build/ninja
/Users/norio/github/swift-dev/build/swift-nightly-install/usr/bin/swift build --package-path /Users/norio/github/swift-dev/indexstore-db --build-path /Users/norio/github/swift-dev/build/buildbot_linux/indexstoredb-linux-x86_64 --configuration release --verbose -Xcxx -I -Xcxx /Users/norio/github/swift-dev/build/swift-nightly-install/usr/lib/swift -Xcxx -I -Xcxx /Users/norio/github/swift-dev/build/swift-nightly-install/usr/lib/swift/Block
lsb_release -r
/Users/norio/github/swift-dev/build/swift-nightly-install/usr/bin/swiftc --driver-mode=swift -L /Users/norio/github/swift-dev/build/swift-nightly-install/usr/lib/swift/pm/4_2 -lPackageDescription -swift-version 4.2 -I /Users/norio/github/swift-dev/build/swift-nightly-install/usr/lib/swift/pm/4_2 -sdk / -package-description-version 4.2 /Users/norio/github/swift-dev/indexstore-db/Package.swift -fileno 7
/Users/norio/github/swift-dev/indexstore-db: error: manifest parse error(s):
/Users/norio/github/swift-dev/indexstore-db/Package.swift:3:8: error: missing required module 'Foundation'
import PackageDescription
       ^
Traceback (most recent call last):
  File "/Users/norio/github/swift-dev/indexstore-db/Utilities/build-script-helper.py", line 94, in <module>
    main()
  File "/Users/norio/github/swift-dev/indexstore-db/Utilities/build-script-helper.py", line 83, in main
    swiftpm('build', swift_exec, swiftpm_args, env)
  File "/Users/norio/github/swift-dev/indexstore-db/Utilities/build-script-helper.py", line 15, in swiftpm
    subprocess.check_call(cmd, env=env)
  File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/Users/norio/github/swift-dev/build/swift-nightly-install/usr/bin/swift', 'build', '--package-path', '/Users/norio/github/swift-dev/indexstore-db', '--build-path', '/Users/norio/github/swift-dev/build/buildbot_linux/indexstoredb-linux-x86_64', '--configuration', 'release', '--verbose', '-Xcxx', '-I', '-Xcxx', '/Users/norio/github/swift-dev/build/swift-nightly-install/usr/lib/swift', '-Xcxx', '-I', '-Xcxx', '/Users/norio/github/swift-dev/build/swift-nightly-install/usr/lib/swift/Block']' returned non-zero exit status 1
swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting
swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

It seems to fail while building indexstore-db with packaging toolchain at build/swift-nightly-install.
It looks that this PR changes locations where Foundation related files are installed.

$ docker-swiftnightly-run find /usr/lib/ -name "*Foundation*"|sort>nightly20191024.txt
$ (cd build/swift-nightly-install; find . -name "*Foundation*"|sed "s/^\.//"|sort)>pr-2524.txt
$ diff -u nightly20191024.txt pr-2524.txt
--- nightly20191024.txt	2019-10-27 09:03:51.000000000 +0900
+++ pr-2524.txt	2019-10-27 09:03:57.000000000 +0900
@@ -7,17 +7,17 @@
 /usr/lib/swift/CoreFoundation/CoreFoundation.h
 /usr/lib/swift/CoreFoundation/ForFoundationOnly.h
 /usr/lib/swift/CoreFoundation/ForSwiftFoundationOnly.h
-/usr/lib/swift/linux/libFoundation.so
-/usr/lib/swift/linux/libFoundationNetworking.so
-/usr/lib/swift/linux/libFoundationXML.so
-/usr/lib/swift/linux/x86_64/Foundation.swiftdoc
-/usr/lib/swift/linux/x86_64/Foundation.swiftmodule
-/usr/lib/swift/linux/x86_64/FoundationNetworking.swiftdoc
-/usr/lib/swift/linux/x86_64/FoundationNetworking.swiftmodule
-/usr/lib/swift/linux/x86_64/FoundationXML.swiftdoc
-/usr/lib/swift/linux/x86_64/FoundationXML.swiftmodule
 /usr/lib/swift/shims/CoreFoundationOverlayShims.h
 /usr/lib/swift/shims/CoreFoundationShims.h
 /usr/lib/swift/shims/FoundationOverlayShims.h
 /usr/lib/swift/shims/FoundationShimSupport.h
 /usr/lib/swift/shims/FoundationShims.h
+/usr/lib/x86_64-linux-gnu/libFoundation.so
+/usr/lib/x86_64-linux-gnu/libFoundationNetworking.so
+/usr/lib/x86_64-linux-gnu/libFoundationXML.so
+/usr/lib/x86_64-linux-gnu/swift/linux/x86_64/Foundation.swiftdoc
+/usr/lib/x86_64-linux-gnu/swift/linux/x86_64/Foundation.swiftmodule
+/usr/lib/x86_64-linux-gnu/swift/linux/x86_64/FoundationNetworking.swiftdoc
+/usr/lib/x86_64-linux-gnu/swift/linux/x86_64/FoundationNetworking.swiftmodule
+/usr/lib/x86_64-linux-gnu/swift/linux/x86_64/FoundationXML.swiftdoc
+/usr/lib/x86_64-linux-gnu/swift/linux/x86_64/FoundationXML.swiftmodule

@compnerd
Copy link
Collaborator Author

It seems that CMAKE_INSTALL_LIBDIR is different now? Is it being specified explicitly? It should be lib by default. which would give the same path as previously.

@compnerd
Copy link
Collaborator Author

@swift-ci please test

@compnerd
Copy link
Collaborator Author

@swift-ci please test

1 similar comment
@compnerd
Copy link
Collaborator Author

@swift-ci please test

@compnerd compnerd force-pushed the cmake-3.15.1 branch 2 times, most recently from 25c849b to 99ddef3 Compare October 30, 2019 20:43
@compnerd
Copy link
Collaborator Author

@swift-ci please test

@compnerd
Copy link
Collaborator Author

@swift-ci please test

@compnerd
Copy link
Collaborator Author

@swift-ci please test Linux platform

@compnerd
Copy link
Collaborator Author

compnerd commented Nov 4, 2019

@swift-ci please test

@compnerd
Copy link
Collaborator Author

compnerd commented Nov 5, 2019

@swift-ci please test

@compnerd
Copy link
Collaborator Author

compnerd commented Nov 5, 2019

@swift-ci please test Linux platform

@compnerd
Copy link
Collaborator Author

compnerd commented Nov 5, 2019

Please test with following PR:
apple/swift-corelibs-xctest#287

@swift-ci please test Linux platform

2 similar comments
@shahmishal
Copy link
Member

Please test with following PR:
apple/swift-corelibs-xctest#287

@swift-ci please test Linux platform

@compnerd
Copy link
Collaborator Author

compnerd commented Nov 5, 2019

Please test with following PR:
apple/swift-corelibs-xctest#287

@swift-ci please test Linux platform

@compnerd
Copy link
Collaborator Author

compnerd commented Nov 5, 2019

@swift-ci please test macOS platform

This migrates Foundation to CMake 3.15.1 and uses the new export targets from
libdispatch to enable simpler builds with better dependency tracking.
Ensure that we export the Foundation libraries, plutil, and uuid for users of
Foundation against the build tree.
@compnerd
Copy link
Collaborator Author

compnerd commented Nov 5, 2019

@swift-ci please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants