Upgrade to Pro — share decks privately, control downloads, hide ads and more …

swift build と Xcode での Build の違い

swift build と Xcode での Build の違い

Tokyo Server-Side Swift Meetup #4

Toshihiro Morimoto

June 27, 2016
Tweet

More Decks by Toshihiro Morimoto

Other Decks in Technology

Transcript

  1. swift build ͱ Xcode Ͱͷ Build ͷҧ͍ 2016/06/27 Tokyo Server-Side

    Swift Meetup #4 @dealforest Toshihro Morimoto
  2. ࣄલ४උ • DEVELOPMENT-SNAPSHOT-2016-05-31-a ΛΠϯετʔϧ (commit ʹΑͬͯมΘΓ·͢) $ brew install libuv

    openssl hiredis $ brew link libuv --force $ brew link openssl --force $ brew link -f hiredis
  3. αʔόʔΛىಈ $ git clone https://github.com/noppoMan/Slimane-Fullstack $ cd Slimane-Fullstack $ make

    debug $ ./.build/debug/Example Slimane server is listening at 0.0.0.0:3000
  4. Xcode Ͱ Build Ͱ͖ΔΑ͏ʹͳΔ·Ͱ 1. 'uv.h' file not found 2.

    ld: library not found for -luv for architecture x86_64 3. ld: library not found for -lCURIParser for architecture x86_64
  5. 2. ld: library not found for -luv for architecture x86_64

    ͜Ε͸ઌ΄Ͳ Homebrew ͰೖΕͨϥΠϒϥϦͷ dynamic library ͕ݟ͔ͭΒͳ͍ͷ͕ݪҼͰ͢
  6. 3. ld: library not found for -lCURIParser for architecture x86_64

    ͜Ε͸ SPM Ͱґଘ͍ͯ͠ΔϥΠϒϥϦʹؚ·ΕΔ dylib ͕Ϗϧυ࣌ʹղܾͰ͖ͳ͍ͷ͕ݪҼͰ͢
  7. 3. ld: library not found for -lCURIParser for architecture x86_64

    ͪΌΜͱղܾ͕࣌ؒͳ͔ͬͨͷͰɹɹɹɹɹɹɹ ࢑ఆରԠͱͳΓ·͢ Ұ౓ swift build Λ࣮ߦ͓ͯ͘͠ඞཁ͕͋Γ·͢ (slimane Ͱ͍͏ make debug ͷ͜ͱͰ͢)
  8. Xcode • Xcode Ͱ target Λબ୒͍ͯ Run Ͱ࣮ߦ • DerivedData

    ௚ԼʹதؒϑΝΠϧ͕Ͱ͖Δ • ґଘϥΠϒϥϦ͸ dynamic framework Ͱ link ͍ͯ͠Δ • xcodebuild Ͱ΍ͬͯ΋ಉ͡ (CONFIGURATION_BUILD_DIR΋ಈ͘) xcodebuild build -project "SlimaneFullstack.xcodeproj" ɹɹ-scheme "Example" -configuration Debug ɹ ɹɹ-sdk macosx10.11 CONFIGURATION_BUILD_DIR=build
  9. /Applications/Xcode-7.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -dynamiclib -isysroot /Applications/Xcode-7.3.1.app/Contents/Developer/Platforms/MacOSX.platform/ Developer/SDKs/MacOSX10.11.sdk -L/Users/dealforest/Library/Developer/Xcode/DerivedData/ SlimaneFullstack-bahaftgmcprmzfgeqgmkpxlvnuog/Build/Products/Debug -F/Users/dealforest/Library/Developer/

    Xcode/DerivedData/SlimaneFullstack-bahaftgmcprmzfgeqgmkpxlvnuog/Build/Products/Debug -filelist /Users/ dealforest/Library/Developer/Xcode/DerivedData/SlimaneFullstack-bahaftgmcprmzfgeqgmkpxlvnuog/Build/ Intermediates/SlimaneFullstack.build/Debug/URI.build/Objects-normal/x86_64/URI.LinkFileList -install_name @rpath/URI.framework/Versions/A/URI -Xlinker -rpath -Xlinker /Library/Developer/Toolchains/swift- DEVELOPMENT-SNAPSHOT-2016-05-31-a.xctoolchain/usr/lib/swift/macosx -mmacosx-version-min=10.10 - fobjc-link-runtime -L/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-05-31- a.xctoolchain/usr/lib/swift/macosx -Xlinker -add_ast_path -Xlinker /Users/dealforest/Library/Developer/Xcode/ DerivedData/SlimaneFullstack-bahaftgmcprmzfgeqgmkpxlvnuog/Build/Intermediates/SlimaneFullstack.build/ Debug/URI.build/Objects-normal/x86_64/URI.swiftmodule -framework C7 -framework CURIParser -framework String -single_module -Xlinker -dependency_info -Xlinker /Users/ dealforest/Library/Developer/Xcode/DerivedData/SlimaneFullstack-bahaftgmcprmzfgeqgmkpxlvnuog/Build/ Intermediates/SlimaneFullstack.build/Debug/URI.build/Objects-normal/x86_64/URI_dependency_info.dat -o / Users/dealforest/Library/Developer/Xcode/DerivedData/SlimaneFullstack-bahaftgmcprmzfgeqgmkpxlvnuog/ Build/Products/Debug/URI.framework/Versions/A/URI