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

Building dart on Mac OS X Lion with xcode 4 #18

Closed
DartBot opened this issue Oct 10, 2011 · 18 comments
Closed

Building dart on Mac OS X Lion with xcode 4 #18

DartBot opened this issue Oct 10, 2011 · 18 comments
Assignees
Labels
area-infrastructure Use area-infrastructure for SDK infrastructure issues, like continuous integration bot changes.
Milestone

Comments

@DartBot
Copy link

DartBot commented Oct 10, 2011

This issue was originally filed by bats...@gmail.com


What steps will reproduce the problem?

  1. checkout source code
  2. run tools/build.py

Result:
=== BUILD NATIVE TARGET v8_base OF PROJECT v8 WITH CONFIGURATION Debug_x64 ===
** BUILD FAILED **

The problem is in macosx sdk version. Google Dart needs 10.5 for building, but there are no macosx10.5 sdk in XCode 4 in Lion.

Workaround: specify sdk manually in build.py:
Index: tools/build.py
===================================================================

--- tools/build.py (revision 296)
+++ tools/build.py (working copy)
@@ -106,6 +106,8 @­@
         if os.path.exists('dart-%s.gyp' % CurrentDirectoryBaseName()):
           project_file = 'dart-%s.xcodeproj' % CurrentDirectoryBaseName()
         args = ['xcodebuild',

  •            '-sdk',
    
  •            'macosx10.6',
    
                     '-project',
                     project_file,
                     '-target',

Full instruction for workaround on Lion:
http://batsuev.com/2011/10/building-google-dart-on-os-x-lion-with-xcode-4/

@DartBot
Copy link
Author

DartBot commented Oct 11, 2011

This comment was originally written by drfibonacci@google.com


Set owner to mmendez@google.com.
Added Area-Compiler, Accepted labels.

@iposva-google
Copy link
Contributor

We need to evaluate whether we still need to build against 10.5.


Set owner to @iposva-google.
Removed Area-Compiler label.
Added Area-Build label.

@DartBot
Copy link
Author

DartBot commented Oct 11, 2011

This comment was originally written by bats...@gmail.com


Most of tests passed after 10.6 build. Just one fail.

@iposva-google
Copy link
Contributor

Issue #31 has been merged into this issue.

@DartBot
Copy link
Author

DartBot commented Oct 21, 2011

This comment was originally written by mlwarren...@gmail.com


It seems like the workaround doesn't work for all versions of xcode on Lion. I'm using xcode 4.2 and am still having problems, even after the workaround. I believe others are having the same issue.

@kevmoo
Copy link
Member

kevmoo commented Oct 28, 2011

I would really appreciate help with OSX Lion.

Thanks!

@DartBot
Copy link
Author

DartBot commented Dec 9, 2011

This comment was originally written by jakobgt...@gmail.com


If it is any help I get the following error message, when trying to build on Lion with XCode 4.2 and setting the SDK to macosx10.7:

svnversion:

Verify exit code of build task 'PhaseScriptExecution Script-83F146809089295397E58BF0.sh'
Build task failed without generating error messages.

** BUILD FAILED **

The following build commands failed:
    Check dependencies
    PhaseScriptExecution "Action "build_closure_compiler"" /Users/gedefar/workspace/dart/dart/xcodebuild/dart-compiler.build/Debug_x64/closure_compiler.build/Script-83F146809089295397E58BF0.sh
(2 failures)
BUILD FAILED

@DartBot
Copy link
Author

DartBot commented Dec 30, 2011

This comment was originally written by ShaneLSteve...@gmail.com


I'm getting a similar error (I tried the 10.6 fix, that didn't work either, so now using 10.7):

[~/Development/ext/google/dart-source/dart]$./tools/build.py --arch=x64
Please set JAVA_HOME to /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
xcodebuild -sdk macosx10.7 -project dart.xcodeproj -target All -parallelizeTargets -configuration Debug_x64 SYMROOT=/Users/shane/Development/ext/google/dart-source/dart/xcodebuild
Build settings from command line:
    SDKROOT = macosx10.7
    SYMROOT = /Users/shane/Development/ext/google/dart-source/dart/xcodebuild

2011-12-30 12:41:03.578 xcodebuild[22379:4003] error: Error Domain=NSPOSIXErrorDomain Code=2 "Non-zero exit code 127 returned from shell command: /Developer/usr/bin/gcc-4.2 -v -E -dM -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk -x c++ -c /dev/null 2>&1" UserInfo=0x401dad8a0 {NSLocalizedDescription=Non-zero exit code 127 returned from shell command: /Developer/usr/bin/gcc-4.2 -v -E -dM -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk -x c++ -c /dev/null 2>&1, NSLocalizedFailureReason=No such file or directory}
2011-12-30 12:41:03.579 xcodebuild[22379:4003] Warning: Couldn't discover the 'gcc-4.2' compiler's built-in search paths and preprocessor definitions for language dialect 'c++'.
Compiler: /Developer/usr/bin/gcc-4.2
Reason: /Developer/usr/bin/gcc-4.2 -v -E -dM -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk -x c++ -c /dev/null 2>&1
2011-12-30 12:41:03.616 xcodebuild[22379:4003] error: Error Domain=NSPOSIXErrorDomain Code=2 "Non-zero exit code 127 returned from shell command: /Developer/usr/bin/gcc-4.2 -v -E -dM -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk -x c -c /dev/null 2>&1" UserInfo=0x4020ddf40 {NSLocalizedDescription=Non-zero exit code 127 returned from shell command: /Developer/usr/bin/gcc-4.2 -v -E -dM -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk -x c -c /dev/null 2>&1, NSLocalizedFailureReason=No such file or directory}
2011-12-30 12:41:03.617 xcodebuild[22379:4003] Warning: Couldn't discover the 'gcc-4.2' compiler's built-in search paths and preprocessor definitions for language dialect 'c'.
Compiler: /Developer/usr/bin/gcc-4.2
Reason: /Developer/usr/bin/gcc-4.2 -v -E -dM -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk -x c -c /dev/null 2>&1
=== BUILD NATIVE TARGET v8_base OF PROJECT v8 WITH CONFIGURATION Debug_x64 ===
Check dependencies
Unsupported compiler 'GCC 4.2' selected for architecture 'x86_64'

=== BUILD AGGREGATE TARGET js2c OF PROJECT v8 WITH CONFIGURATION Debug_x64 ===

=== BUILD AGGREGATE TARGET d8_js2c OF PROJECT d8 WITH CONFIGURATION Debug_x64 ===

=== BUILD NATIVE TARGET libdart OF PROJECT dart-runtime WITH CONFIGURATION Debug_x64 ===

=== BUILD AGGREGATE TARGET generate_builtin_cc_file OF PROJECT dart-runtime WITH CONFIGURATION Debug_x64 ===

=== BUILD NATIVE TARGET v8_nosnapshot OF PROJECT v8 WITH CONFIGURATION Debug_x64 ===

=== BUILD AGGREGATE TARGET closure_compiler OF PROJECT dart-compiler WITH CONFIGURATION Debug_x64 ===
PhaseScriptExecution "Action "build_closure_compiler"" /Users/shane/Development/ext/google/dart-source/dart/xcodebuild/dart-compiler.build/Debug_x64/closure_compiler.build/Script-83F146809089295397E58BF0.sh
    cd /Users/shane/Development/ext/google/dart-source/dart/compiler
    /bin/sh -c /Users/shane/Development/ext/google/dart-source/dart/xcodebuild/dart-compiler.build/Debug_x64/closure_compiler.build/Script-83F146809089295397E58BF0.sh
note: Building closure compiler
Buildfile: ../third_party/closure_compiler_src/build.xml

clean:
   [delete] Deleting directory /Users/shane/Development/ext/google/dart-source/dart/xcodebuild/Debug_x64/closure_out

rhino:

properties:

init:
    [mkdir] Created dir: /Users/shane/Development/ext/google/dart-source/dart/xcodebuild/Debug_x64/closure_out/lib
    [mkdir] Created dir: /Users/shane/Development/ext/google/dart-source/dart/xcodebuild/Debug_x64/closure_out/lib/classes
    [mkdir] Created dir: /Users/shane/Development/ext/google/dart-source/dart/xcodebuild/Debug_x64/closure_out/lib/rhino1_7R3pre

compile:

compile-most:
    [javac] Compiling 191 source files to /Users/shane/Development/ext/google/dart-source/dart/xcodebuild/Debug_x64/closure_out/lib/classes
     [copy] Copying 2 files to /Users/shane/Development/ext/google/dart-source/dart/xcodebuild/Debug_x64/closure_out/lib/classes

compile-jdk15:
    [javac] Compiling 1 source file to /Users/shane/Development/ext/google/dart-source/dart/xcodebuild/Debug_x64/closure_out/lib/classes

compile:

properties:

compile:
    [javac] Compiling 28 source files to /Users/shane/Development/ext/google/dart-source/dart/xcodebuild/Debug_x64/closure_out/lib/classes
    [javac] /Users/shane/Development/ext/google/dart-source/dart/third_party/closure_compiler_src/lib/rhino/src/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/debugger/SwingGui.java:3143: warning: [deprecation] disable() in javax.swing.JComponent has been deprecated
    [javac] public void disable() {
    [javac] ^
    [javac] /Users/shane/Development/ext/google/dart-source/dart/third_party/closure_compiler_src/lib/rhino/src/mozilla/js/rhino/toolsrc/org/mozilla/javascript/tools/debugger/SwingGui.java:3155: warning: [deprecation] enable() in javax.swing.JComponent has been deprecated
    [javac] public void enable() {
    [javac] ^
    [javac] 2 warnings
     [copy] Copying 1 file to /Users/shane/Development/ext/google/dart-source/dart/xcodebuild/Debug_x64/closure_out/lib/classes

xmlimplsrc-compile:
     [echo] Calling /Users/shane/Development/ext/google/dart-source/dart/third_party/closure_compiler_src/lib/rhino/src/mozilla/js/rhino/xmlimplsrc/build.xml

compile:

compile-all:

compile:
    [javac] Compiling 3 source files to /Users/shane/Development/ext/google/dart-source/dart/xcodebuild/Debug_x64/closure_out/lib/classes

jar:
      [jar] Building jar: /Users/shane/Development/ext/google/dart-source/dart/xcodebuild/Debug_x64/closure_out/lib/rhino1_7R3pre/js.jar

rhino-jarjar:
   [jarjar] Building jar: /Users/shane/Development/ext/google/dart-source/dart/xcodebuild/Debug_x64/closure_out/lib/rhino.jar

Verify exit code of build task 'PhaseScriptExecution Script-83F146809089295397E58BF0.sh'
Build task failed without generating error messages.

** BUILD FAILED **

The following build commands failed:
        Check dependencies
        PhaseScriptExecution "Action "build_closure_compiler"" /Users/shane/Development/ext/google/dart-source/dart/xcodebuild/dart-compiler.build/Debug_x64/closure_compiler.build/Script-83F146809089295397E58BF0.sh
(2 failures)
BUILD FAILED
[~/Development/ext/google/dart-source/dart]$

@DartBot
Copy link
Author

DartBot commented May 13, 2012

This comment was originally written by financeC...@gmail.com


Should this bug be closed, I dont find this an issue anymore. The only change that needs to be done now is the following.

19:15:04-adam@Adams-MacBook-Air:~/dart_bleeding/dart/tools
$ svn diff
Index: gyp/configurations_xcode.gypi
===================================================================

--- gyp/configurations_xcode.gypi (revision 7573)
+++ gyp/configurations_xcode.gypi (working copy)
@@ -8,8 +8,8 @­@
       'Dart_Base': {
         'xcode_settings': {
           # To switch to the LLVM based backend change the two lines below.

  •      #'GCC_VERSION': 'com.apple.compilers.llvmgcc42',
    
  •      'GCC_VERSION': '4.2',
    
  •      'GCC_VERSION': 'com.apple.compilers.llvmgcc42',
    
  •      #'GCC_VERSION': '4.2',
    
               'GCC_C_LANGUAGE_STANDARD': 'ansi',
               'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
               'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti

@DartBot
Copy link
Author

DartBot commented Jun 9, 2012

This comment was originally written by le...@google.com


Switching GCC_VERSION does not fix it for me; I still get:

Verify exit code of build task 'PhaseScriptExecution Script-85526B89821EAEBE18292E1E.sh'
Build task failed without generating error messages.

=== BUILD NATIVE TARGET libdart_export OF PROJECT dart-runtime WITH CONFIGURATION DebugIA32 ===

** BUILD FAILED **

The following build commands failed:
    PhaseScriptExecution "Action "build_dartc"" /Users/leese/dart_code/dart/xcodebuild/dart-compiler.build/DebugIA32/dartc.build/Script-85526B89821EAEBE18292E1E.sh

Whether or not a workaround exists for my setup, this is a bug for two reasons:

  1. PhaseScriptExecution has an error and the only thing it can tell me is that it can't tell me what the error is?

  2. This is just one of many tweaks I've found online that are supposed to make dart build on Lion. The necessity of these tweaks is a bug; find the tweaks people are making and fix the build script to handle these cases. The build script certainly doesn't provide any information on what it doesn't like about my combination of tools.

@sethladd
Copy link
Contributor

This patch works for an XCode 4 + Lion config:

https://github.com/kevmoo/dart-repo/commit/3ccbfadc63d7c72c6b9315fe5720b56715e147e7.patch

It would be awesome to merge this with the main build scripts.

@DartBot
Copy link
Author

DartBot commented Sep 5, 2012

This comment was originally written by ericarnol...@google.com


I am getting the same output as comment #­8 from above (http://code.google.com/p/dart/issues/detail?id=18#c8 ), even after applying the patch at https://github.com/kevmoo/dart-repo/commit/3ccbfadc63d7c72c6b9315fe5720b56715e147e7.patch

Any ideas?

@DartBot
Copy link
Author

DartBot commented Sep 5, 2012

This comment was originally written by le...@google.com


Kevin's patch doesn't fix my issue either. Is there any way to get more information out of the build scripts? Is there code I should modify to get the build scripts to print out how far they've progressed?

@DartBot
Copy link
Author

DartBot commented Sep 6, 2012

This comment was originally written by brian.chin@gmail.com


I ran into the same problem. I fixed it by rerunning "gclient sync; gclient runhooks" after adding the llvm version patch above. Since this modifies the gyp file in the project, you have to regenerate the xcode project as well, which I believe one of these does.

@DartBot
Copy link
Author

DartBot commented Sep 13, 2012

This comment was originally written by ericarnol...@google.com


That appears to have worked! Thanks!

@sethladd
Copy link
Contributor

Tested and verified with Mountain Lion and XCode 4.4 and Kevin's patch.


cc @dgrove.

@iposva-google
Copy link
Contributor

This depends on http://crbug.com/147515

@iposva-google
Copy link
Contributor

Added this to the M2 milestone.

copybara-service bot pushed a commit that referenced this issue Jul 21, 2023
Here's a minimal repro that this CL fixes:

`ui.dart`

```dart
library dart.ui;

import 'dart:ffi';

part 'foo.dart';
```

`foo.dart`

```dart
part of dart.ui;

@Native<Void Function()>(symbol: 'foo_func', isLeaf: true)
external void foo_func();
```

When compiling with `compile_platform.dart` with `--target=dart2wasm`, the following error appears:


```
Unhandled exception:
Verification error: Target=wasm, VerificationStage.afterModularTransformations: Invalid location with target 'wasm' on FunctionNode() (FunctionNode): RangeError (offset): Invalid value: Not in inclusive range 0..56: 91
Context: 'foo_func_$import'.
Node: 'FunctionNode()'.
#0      VerificationErrorListener.reportError (package:kernel/verifier.dart:81:5)
#1      VerifyingVisitor.problem (package:kernel/verifier.dart:222:14)
#2      VerifyingVisitor._getLocation (package:kernel/verifier.dart:1361:7)
#3      VerifyingVisitor._hasLocation (package:kernel/verifier.dart:1370:26)
#4      VerifyingVisitor.getSameLibraryLastSeenTreeNode (package:kernel/verifier.dart:1342:28)
#5      VerifyingVisitor.localContext (package:kernel/verifier.dart:1382:24)
#6      VerifyingVisitor.defaultDartType (package:kernel/verifier.dart:1491:41)
#7      Visitor.visitVoidType (package:kernel/visitor.dart:1309:37)
#8      VoidType.accept (package:kernel/ast.dart:11190:42)
#9      FunctionNode.visitChildren (package:kernel/ast.dart:3919:16)
#10     VerifyingVisitor.visitChildren (package:kernel/verifier.dart:259:10)
#11     VerifyingVisitor.visitWithLocalScope (package:kernel/verifier.dart:266:5)
#12     VerifyingVisitor.visitFunctionNode (package:kernel/verifier.dart:721:5)
#13     FunctionNode.accept (package:kernel/ast.dart:3908:38)
#14     VerifyingVisitor.visitProcedure (package:kernel/verifier.dart:620:19)
#15     Procedure.accept (package:kernel/ast.dart:3311:40)
#16     visitList (package:kernel/ast.dart:14488:14)
#17     Library.visitChildren (package:kernel/ast.dart:591:5)
#18     VerifyingVisitor.visitChildren (package:kernel/verifier.dart:259:10)
#19     VerifyingVisitor.defaultTreeNode (package:kernel/verifier.dart:196:5)
#20     TreeVisitor.visitLibrary (package:kernel/visitor.dart:503:35)
#21     VerifyingVisitor.visitLibrary (package:kernel/verifier.dart:367:11)
#22     Library.accept (package:kernel/ast.dart:577:38)
#23     visitList (package:kernel/ast.dart:14488:14)
#24     Component.visitChildren (package:kernel/ast.dart:14320:5)
#25     VerifyingVisitor.visitChildren (package:kernel/verifier.dart:259:10)
#26     VerifyingVisitor.visitComponent (package:kernel/verifier.dart:342:7)
#27     Component.accept (package:kernel/ast.dart:14313:38)
#28     VerifyingVisitor.check (package:kernel/verifier.dart:171:15)
#29     verifyComponent (package:kernel/verifier.dart:69:20)
...
```

The issue seems to be that after doing this native transformation, the node's `fileUri` references the enclosing library (`ui.dart` above), but the `node.location` references the actual source file (`foo.dart` above) indirectly through `node.fileOffset`.

This ends up being an issue when compiling the platform dill in Google3,   but I didn't look into why `flutter build web --wasm` isn't broken.

Internal bug: b/292172146

Change-Id: I2b8d7d215b2c36354860257ce651d50168e9523d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/315360
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Jia Hao Goh <jiahaog@google.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Use area-infrastructure for SDK infrastructure issues, like continuous integration bot changes.
Projects
None yet
Development

No branches or pull requests

5 participants