RESOLVED WONTFIX 205353
Force `yasm` to be built for host OS
https://bugs.webkit.org/show_bug.cgi?id=205353
Summary Force `yasm` to be built for host OS
Keith Rollin
Reported 2019-12-17 13:12:48 PST
When using `make` to build for the iOS Simulator, yasm would also get built for that platform, due to the specification of SDKROOT=iphonesimulator on the command line. However, yasm is supposed to be built for the current build host so that it can later be used in the build process. Using yasm on the build host even though it was built for iOS Simulator seems to have worked so far, but that may not always be the case. Fix this by forcing yasm to be built for the host as opposed to whatever it specified in SDKROOT on the `make` command-line.
Attachments
Patch (1.74 KB, patch)
2019-12-17 13:15 PST, Keith Rollin
no flags
Patch (7.59 KB, patch)
2019-12-19 17:21 PST, Keith Rollin
no flags
Radar WebKit Bug Importer
Comment 1 2019-12-17 13:13:05 PST
Keith Rollin
Comment 2 2019-12-17 13:15:15 PST
Jonathan Bedard
Comment 3 2019-12-17 13:30:54 PST
Comment on attachment 385913 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=385913&action=review > Source/ThirdParty/libwebrtc/Makefile:9 > +OVERRIDE_ARCHS = default While this is generally the correct way to do this, I'd like to better understand why this is the case. The only other place we have precedence of doing this right now is ImageDiff, and we only do it for embedded builds (ie, we conditionality it to iOS, watchOS and tvOS), and that's because we need the binary for testing. I would expect that libwebrtc is built for embedded platforms, is it not?
Tim Horton
Comment 4 2019-12-17 13:36:43 PST
(In reply to Jonathan Bedard from comment #3) > Comment on attachment 385913 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=385913&action=review > > > Source/ThirdParty/libwebrtc/Makefile:9 > > +OVERRIDE_ARCHS = default > > While this is generally the correct way to do this, I'd like to better > understand why this is the case. > > The only other place we have precedence of doing this right now is > ImageDiff, and we only do it for embedded builds (ie, we conditionality it > to iOS, watchOS and tvOS), and that's because we need the binary for > testing. I would expect that libwebrtc is built for embedded platforms, is > it not? This is a tool used to generate code that is then subsequently built for simulator. The tool runs on Mac; it's the same kind of problem as ImageDiff.
Keith Rollin
Comment 5 2019-12-17 13:42:08 PST
...and my change affects all of libwebrtc, when I wanted it to affect only yasm. This needs more fixing.
Jonathan Bedard
Comment 6 2019-12-17 13:44:18 PST
(In reply to Tim Horton from comment #4) > (In reply to Jonathan Bedard from comment #3) > > Comment on attachment 385913 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=385913&action=review > > > > > Source/ThirdParty/libwebrtc/Makefile:9 > > > +OVERRIDE_ARCHS = default > > > > While this is generally the correct way to do this, I'd like to better > > understand why this is the case. > > > > The only other place we have precedence of doing this right now is > > ImageDiff, and we only do it for embedded builds (ie, we conditionality it > > to iOS, watchOS and tvOS), and that's because we need the binary for > > testing. I would expect that libwebrtc is built for embedded platforms, is > > it not? > > This is a tool used to generate code that is then subsequently built for > simulator. The tool runs on Mac; it's the same kind of problem as ImageDiff. libwebrtc is a tool? That's confusing, I would expect it to be a library based on the name. Should it be included in build archives? Or is it just used in the build process? I think we should do the same thing we did with ImageDiff: ifneq (,$(findstring iphone,$(SDKROOT))) OVERRIDE_SDKROOT = default OVERRIDE_ARCHS = default endif ifneq (,$(findstring watch,$(SDKROOT))) OVERRIDE_SDKROOT = default OVERRIDE_ARCHS = default endif ifneq (,$(findstring tv,$(SDKROOT))) OVERRIDE_SDKROOT = default OVERRIDE_ARCHS = default endif that way if the caller is overriding the Mac SDK, we build with the overwridden Mac SDK
Jonathan Bedard
Comment 7 2019-12-17 13:45:04 PST
(In reply to Jonathan Bedard from comment #6) > .... > libwebrtc is a tool? That's confusing, I would expect it to be a library > based on the name. Should it be included in build archives? Or is it just > used in the build process? Keith just answered by question ...
Keith Rollin
Comment 8 2019-12-18 17:19:48 PST
I've got a solution in place. However, it's a little ugly in that it re-invokes xcodebuild in order to build just 'yasm' for macOS. I'm talking with a Developer Tools guy who thinks that there's a cleaner solution. It works for him but it doesn't work for me. I'm going to try to get his project to see how it differs from libwebrtc's.
Keith Rollin
Comment 9 2019-12-18 20:41:48 PST
One Developer Tools guy said "Hey, do <this>". I said "I tried that and it didn't work. May I see your project?" To which he said "Hmm, my approach doesn't seem to be working any more...". Another Developer Tools guy said "Xcode can't build host content simultaneously with device content. You will fight this battle forever and lose." I'm marking this as the selected answer. A third said "Your scripted build should be able to use a -destination argument instead of overriding the SDKROOT build setting to build for different run destinations (aka operating systems etc.)" The "scripted build" refers to building from the command-line as opposed to from within the IDE. I may look into this -destination-based solution down the road, but right now I'm worried that it might be more trouble than it's worth. For instance, it seems to be workspace/scheme based rather than project-based, as we operate now. Also, some of the destinations we'd want to specify seem hands-off: % xcodebuild -showdestinations -workspace WebKit.xcworkspace -scheme 'All Source' ... Ineligible destinations for the "All Source" scheme: { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Generic iOS Device } { platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Generic iOS Simulator Device } ... So I'll test that my current approach (which re-invokes xcodebuild to build yasm) works and upload that for review.
Keith Rollin
Comment 10 2019-12-19 17:21:06 PST
Jonathan Bedard
Comment 11 2019-12-20 09:24:37 PST
Comment on attachment 386167 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=386167&action=review > Source/ThirdParty/libwebrtc/libwebrtc.xcodeproj/project.pbxproj:15944 > + shellScript = "ARGS=(\n -project \"${PROJECT_FILE_PATH}\"\n -target yasm\n -sdk macosx\n -arch \"${NATIVE_ARCH_ACTUAL}\"\n -configuration Release\n OBJROOT=${PROJECT_TEMP_DIR}/Build_yasm/Intermediates.noindex\n SYMROOT=${PROJECT_TEMP_DIR}/Build_yasm/Products\n )\n\nxcodebuild \"${ARGS[@]}\"\n\nYASM_PATH=$(xcodebuild \"${ARGS[@]}\" -showBuildSettings | grep -w BUILT_PRODUCTS_DIR | sed -Ee 's/[^=]* = (.*)/\\1/')\nYASM_NAME=$(xcodebuild \"${ARGS[@]}\" -showBuildSettings | grep -w EXECUTABLE_NAME | sed -Ee 's/[^=]* = (.*)/\\1/')\n\nSRC=\"${YASM_PATH}/${YASM_NAME}\"\nDEST=\"${BUILT_PRODUCTS_DIR}/yasm\"\n\n[[ -e \"${SRC}\" ]] || exit 1\n[[ -e \"${DEST}\" ]] && { cmp \"${SRC}\" \"${DEST}\" && exit 0; }\ncp \"${SRC}\" \"${DEST}\" || exit 1\n\nexit 0\n"; I'm pretty confused where this is actually triggered. I applied the patch and I can't find this script in Xcode.
Keith Rollin
Comment 12 2019-12-20 11:22:20 PST
I guess I don't know why you can't find it. It's 'a custom build step in the "vpx" target'. If you look at the build steps for vpx, you should see it as the second build step, called "Build yasm for macOS". Regardless, this is all moot. Youenn is taking a different approach in Bug 205491, where yasm is no longer needed for non-macOS platforms. I'll be closing this bug as NTBF once that one lands.
Note You need to log in before you can comment on or make changes to this bug.