buck icon indicating copy to clipboard operation
buck copied to clipboard

Support MacOS Big Sur

Open khoadotan12 opened this issue 4 years ago • 11 comments

Did buck support for MacOS BigSur? I have same issue as #2491 with buck and can't build dev branch with ant. Maybe there're problems with java SDK

khoadotan12 avatar Nov 30 '20 10:11 khoadotan12

  • download openJDK 11 from - https://adoptopenjdk.net/archive.html?variant=openjdk11&jvmVariant=hotspot
  • clone dev branch. -> git clone --branch dev https://github.com/facebook/buck.git

After installing JDK open terminal and write

  • export JAVA_HOME=$(/usr/libexec/java_home)

after write *echo $JAVA_HOME

And its print should be like this - /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home --> IMPORTANT U SEE adoptopenjdk-11.jdk!!! java 8 not working only 11

after

  • cd "my buck folder path"

after just copy past

ant ./bin/buck build --show-output buck buck-out/gen/programs/buck.pex --help

Done. Tested fucking macOs Big Sure 11.1

Some Links

*build example - https://buck.build/setup/getting_started.html *java download - https://adoptopenjdk.net/archive.html?variant=openjdk11&jvmVariant=hotspot

alyfreym avatar Dec 28 '20 12:12 alyfreym

  • download openJDK 11 from - https://adoptopenjdk.net/archive.html?variant=openjdk11&jvmVariant=hotspot
  • clone dev branch. -> git clone --branch dev https://github.com/facebook/buck.git

After installing JDK open terminal and write

  • export JAVA_HOME=$(/usr/libexec/java_home)

after write *echo $JAVA_HOME

And its print should be like this - /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home --> IMPORTANT U SEE adoptopenjdk-11.jdk!!! java 8 not working only 11

after

  • cd "my buck folder path"

after just copy past

ant ./bin/buck build --show-output buck buck-out/gen/programs/buck.pex --help

Done. Tested fucking macOs Big Sure 11.1

Some Links

*build example - https://buck.build/setup/getting_started.html *java download - https://adoptopenjdk.net/archive.html?variant=openjdk11&jvmVariant=hotspot

Thanks @alyfreym , but when I build buck with ant, there are some errors with javac. My javac version is 11.0.9.1

compile:
    [javac] Compiling 5 source files to /Users/khoadt2/Downloads/Documents/buck/ant-out/classes
    [javac] [compiled 965 lines in 1005 ms: 960.1 lines/s]
    [javac] [2 .class files generated]
    [javac] ----------
    [javac] 1. ERROR in /Users/khoadt2/Downloads/Documents/buck/src/com/facebook/buck/jvm/java/abi/AccessFlags.java (at line 200)
    [javac] 	switch (modifier) {
    [javac] 	        ^^^^^^^^
    [javac] The enum constant NON_SEALED should have a corresponding case label in this enum switch on Modifier. To suppress this problem, add a comment //$CASES-OMITTED$ on the line above the 'default:'
    [javac] ----------
    [javac] 2. ERROR in /Users/khoadt2/Downloads/Documents/buck/src/com/facebook/buck/jvm/java/abi/AccessFlags.java (at line 200)
    [javac] 	switch (modifier) {
    [javac] 	        ^^^^^^^^
    [javac] The enum constant SEALED should have a corresponding case label in this enum switch on Modifier. To suppress this problem, add a comment //$CASES-OMITTED$ on the line above the 'default:'
    [javac] ----------
    [javac] ----------
    [javac] 3. ERROR in /Users/khoadt2/Downloads/Documents/buck/src/com/facebook/buck/jvm/java/abi/JarReader.java (at line 71)
    [javac] 	fileSystem = FileSystems.newFileSystem(jarPath, null);
    [javac] 	                         ^^^^^^^^^^^^^
    [javac] The method newFileSystem(Path, ClassLoader) is ambiguous for the type FileSystems
    [javac] ----------
    [javac] ----------
    [javac] 4. ERROR in /Users/khoadt2/Downloads/Documents/buck/src/com/facebook/buck/jvm/java/abi/java11/SourceVersionUtils.java (at line 27)
    [javac] 	switch (version) {
    [javac] 	        ^^^^^^^
    [javac] The enum constant RELEASE_12 should have a corresponding case label in this enum switch on SourceVersion. To suppress this problem, add a comment //$CASES-OMITTED$ on the line above the 'default:'
    [javac] ----------
    [javac] 5. ERROR in /Users/khoadt2/Downloads/Documents/buck/src/com/facebook/buck/jvm/java/abi/java11/SourceVersionUtils.java (at line 27)
    [javac] 	switch (version) {
    [javac] 	        ^^^^^^^
    [javac] The enum constant RELEASE_13 should have a corresponding case label in this enum switch on SourceVersion. To suppress this problem, add a comment //$CASES-OMITTED$ on the line above the 'default:'
    [javac] ----------
    [javac] 6. ERROR in /Users/khoadt2/Downloads/Documents/buck/src/com/facebook/buck/jvm/java/abi/java11/SourceVersionUtils.java (at line 27)
    [javac] 	switch (version) {
    [javac] 	        ^^^^^^^
    [javac] The enum constant RELEASE_14 should have a corresponding case label in this enum switch on SourceVersion. To suppress this problem, add a comment //$CASES-OMITTED$ on the line above the 'default:'
    [javac] ----------
    [javac] 7. ERROR in /Users/khoadt2/Downloads/Documents/buck/src/com/facebook/buck/jvm/java/abi/java11/SourceVersionUtils.java (at line 27)
    [javac] 	switch (version) {
    [javac] 	        ^^^^^^^
    [javac] The enum constant RELEASE_15 should have a corresponding case label in this enum switch on SourceVersion. To suppress this problem, add a comment //$CASES-OMITTED$ on the line above the 'default:'
    [javac] ----------
    [javac] ----------
    [javac] 8. ERROR in /Users/khoadt2/Downloads/Documents/buck/src/com/facebook/buck/util/unarchive/Unzip.java (at line 321)
    [javac] 	try (FileSystem zipFs = FileSystems.newFileSystem(archiveAbsolutePath, null)) {
    [javac] 	                                    ^^^^^^^^^^^^^
    [javac] The method newFileSystem(Path, ClassLoader) is ambiguous for the type FileSystems
    [javac] ----------
    [javac] 8 problems (8 errors)

khoadotan12 avatar Dec 29 '20 04:12 khoadotan12

  • download openJDK 11 from - https://adoptopenjdk.net/archive.html?variant=openjdk11&jvmVariant=hotspot
  • clone dev branch. -> git clone --branch dev https://github.com/facebook/buck.git

After installing JDK open terminal and write

  • export JAVA_HOME=$(/usr/libexec/java_home)

after write *echo $JAVA_HOME And its print should be like this - /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home --> IMPORTANT U SEE adoptopenjdk-11.jdk!!! java 8 not working only 11 after

  • cd "my buck folder path"

after just copy past ant ./bin/buck build --show-output buck buck-out/gen/programs/buck.pex --help Done. Tested fucking macOs Big Sure 11.1 Some Links *build example - https://buck.build/setup/getting_started.html *java download - https://adoptopenjdk.net/archive.html?variant=openjdk11&jvmVariant=hotspot

Thanks @alyfreym , but when I build buck with ant, there are some errors with javac. My javac version is 11.0.9.1

compile:
    [javac] Compiling 5 source files to /Users/khoadt2/Downloads/Documents/buck/ant-out/classes
    [javac] [compiled 965 lines in 1005 ms: 960.1 lines/s]
    [javac] [2 .class files generated]
    [javac] ----------
    [javac] 1. ERROR in /Users/khoadt2/Downloads/Documents/buck/src/com/facebook/buck/jvm/java/abi/AccessFlags.java (at line 200)
    [javac] 	switch (modifier) {
    [javac] 	        ^^^^^^^^
    [javac] The enum constant NON_SEALED should have a corresponding case label in this enum switch on Modifier. To suppress this problem, add a comment //$CASES-OMITTED$ on the line above the 'default:'
    [javac] ----------
    [javac] 2. ERROR in /Users/khoadt2/Downloads/Documents/buck/src/com/facebook/buck/jvm/java/abi/AccessFlags.java (at line 200)
    [javac] 	switch (modifier) {
    [javac] 	        ^^^^^^^^
    [javac] The enum constant SEALED should have a corresponding case label in this enum switch on Modifier. To suppress this problem, add a comment //$CASES-OMITTED$ on the line above the 'default:'
    [javac] ----------
    [javac] ----------
    [javac] 3. ERROR in /Users/khoadt2/Downloads/Documents/buck/src/com/facebook/buck/jvm/java/abi/JarReader.java (at line 71)
    [javac] 	fileSystem = FileSystems.newFileSystem(jarPath, null);
    [javac] 	                         ^^^^^^^^^^^^^
    [javac] The method newFileSystem(Path, ClassLoader) is ambiguous for the type FileSystems
    [javac] ----------
    [javac] ----------
    [javac] 4. ERROR in /Users/khoadt2/Downloads/Documents/buck/src/com/facebook/buck/jvm/java/abi/java11/SourceVersionUtils.java (at line 27)
    [javac] 	switch (version) {
    [javac] 	        ^^^^^^^
    [javac] The enum constant RELEASE_12 should have a corresponding case label in this enum switch on SourceVersion. To suppress this problem, add a comment //$CASES-OMITTED$ on the line above the 'default:'
    [javac] ----------
    [javac] 5. ERROR in /Users/khoadt2/Downloads/Documents/buck/src/com/facebook/buck/jvm/java/abi/java11/SourceVersionUtils.java (at line 27)
    [javac] 	switch (version) {
    [javac] 	        ^^^^^^^
    [javac] The enum constant RELEASE_13 should have a corresponding case label in this enum switch on SourceVersion. To suppress this problem, add a comment //$CASES-OMITTED$ on the line above the 'default:'
    [javac] ----------
    [javac] 6. ERROR in /Users/khoadt2/Downloads/Documents/buck/src/com/facebook/buck/jvm/java/abi/java11/SourceVersionUtils.java (at line 27)
    [javac] 	switch (version) {
    [javac] 	        ^^^^^^^
    [javac] The enum constant RELEASE_14 should have a corresponding case label in this enum switch on SourceVersion. To suppress this problem, add a comment //$CASES-OMITTED$ on the line above the 'default:'
    [javac] ----------
    [javac] 7. ERROR in /Users/khoadt2/Downloads/Documents/buck/src/com/facebook/buck/jvm/java/abi/java11/SourceVersionUtils.java (at line 27)
    [javac] 	switch (version) {
    [javac] 	        ^^^^^^^
    [javac] The enum constant RELEASE_15 should have a corresponding case label in this enum switch on SourceVersion. To suppress this problem, add a comment //$CASES-OMITTED$ on the line above the 'default:'
    [javac] ----------
    [javac] ----------
    [javac] 8. ERROR in /Users/khoadt2/Downloads/Documents/buck/src/com/facebook/buck/util/unarchive/Unzip.java (at line 321)
    [javac] 	try (FileSystem zipFs = FileSystems.newFileSystem(archiveAbsolutePath, null)) {
    [javac] 	                                    ^^^^^^^^^^^^^
    [javac] The method newFileSystem(Path, ClassLoader) is ambiguous for the type FileSystems
    [javac] ----------
    [javac] 8 problems (8 errors)

if you print command in terminal - echo $JAVA_HOME -> what does he show?

alyfreym avatar Dec 29 '20 04:12 alyfreym

@alyfreym I compiled buck success but got a problem , when I run buck-out/gen/programs/buck.pex --help, it show The operation couldn’t be completed. Unable to locate a Java Runtime that supports buck. My command echo $JAVA_HOME is /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home

khoadotan12 avatar Dec 29 '20 07:12 khoadotan12

Addepar currently maintains a Java 11 / Python2 fork of Buck: https://github.com/Addepar/buck/releases/tag/v2. This might be helpful.

It's really just some minor edits and selective cherry-picks of the wonderful work of FaceBuck contributors 😄. At some point our dream is to remove our fork, but we have some work to do internally in our CI/CD stack to get there.

If you want to use Python3, I think you'll be able to do so with minor code contributions: revert https://github.com/Addepar/buck/commit/eca27469a5adde0443d9078e5f102e633e842ad0 and apply any recent python3 compatibility commits off of FaceBuck master.

navkast avatar Dec 30 '20 00:12 navkast

Addepar currently maintains a Java 11 / Python2 fork of Buck: https://github.com/Addepar/buck/releases/tag/v2. This might be helpful.

It's really just some minor edits and selective cherry-picks of the wonderful work of FaceBuck contributors 😄. At some point our dream is to remove our fork, but we have some work to do internally in our CI/CD stack to get there.

If you want to use Python3, I think you'll be able to do so with minor code contributions: revert Addepar@eca2746 and apply any recent python3 compatibility commits off of FaceBuck master.

I run buck.pex file and terminal show Permission denied. Can you help me how to run it?

khoadotan12 avatar Dec 30 '20 02:12 khoadotan12

@khoadotan12 perhaps you can try chmod 755 buck.pex if you're using a unix-like system?

navkast avatar Dec 30 '20 02:12 navkast

@navkast thank you, it's really helpful. I can using buck now

khoadotan12 avatar Dec 30 '20 07:12 khoadotan12

@navkast thank you, it's really helpful. I can using buck now

You build back from this link ? -> https://github.com/Addepar/buck/releases/tag/v2

I got error

Total time: 5 seconds [Errno 2] No such file or directory: '/Users/alishershermatov/Desktop/buck/ant-out/buck-info.json' Traceback (most recent call last): File "/Users/alishershermatov/Desktop/buck/bin/../programs/buck.py", line 243, in <module> exit_code_callable = main(sys.argv, reporter) File "/Users/alishershermatov/Desktop/buck/bin/../programs/buck.py", line 220, in main with get_repo(project) as buck_repo: File "/Users/alishershermatov/Desktop/buck/bin/../programs/buck.py", line 199, in get_repo return BuckRepo(THIS_DIR, p, reporter) File "/Users/alishershermatov/Desktop/buck/programs/buck_repo.py", line 62, in __init__ super(BuckRepo, self).__init__(buck_project, buck_reporter) File "/Users/alishershermatov/Desktop/buck/programs/buck_tool.py", line 356, in __init__ self._package_info = self._get_package_info() File "/Users/alishershermatov/Desktop/buck/programs/buck_repo.py", line 90, in _get_package_info return json.loads(self.__read_file(BUCK_INFO_LOCATION)) File "/Users/alishershermatov/Desktop/buck/programs/buck_repo.py", line 93, in __read_file with open(os.path.join(self.buck_dir, filename)) as file:

alyfreym avatar Dec 30 '20 07:12 alyfreym

@alyfreym no I installed the pre-built binary buck.pex and run script on it

khoadotan12 avatar Dec 30 '20 09:12 khoadotan12

open /usr/local/Homebrew/Library/Taps/facebook/homebrew-fb/buck.rb and change openjdk@8 to openjdk@11

hasayakey avatar Jan 21 '21 03:01 hasayakey