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

How to build on OSX (possibly) #8

Open
futurepr0n opened this issue Feb 6, 2024 · 5 comments
Open

How to build on OSX (possibly) #8

futurepr0n opened this issue Feb 6, 2024 · 5 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@futurepr0n
Copy link

Working through getting the build on OSX, here is what I have done along the way with issues I have encountered and how I managed to get passed some of them.

First problem I had was when building it could not find objcopy or gobjcopy

So first I made sure I had brew install binutils installed and then I was required to also run the following:

export PATH=/usr/local/opt/binutils/bin:$PATH 
export LDFLAGS="-L/usr/local/opt/binutils/lib"
export CPPFLAGS="-I/usr/local/opt/binutils/include"

Next I re-ran ./configure --enable-local, things looked good until I encountered

checking for help2man... no
configure: error: missing required tool: help2man

Once again I ran brew install help2man and you may not run into this issue but I could not link it

futurepr0n@MacBook-Pro crosstool-ng % brew install help2man
==> Downloading https://formulae.brew.sh/api/formula.jws.json
######################################################################### 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json

==> Downloading https://ghcr.io/v2/homebrew/core/help2man/manifests/1.49.3_2
######################################################################### 100.0%
==> Fetching dependencies for help2man: berkeley-db@5 and perl
==> Downloading https://ghcr.io/v2/homebrew/core/berkeley-db/5/manifests/5.3.28_
######################################################################### 100.0%
==> Fetching berkeley-db@5
==> Downloading https://ghcr.io/v2/homebrew/core/berkeley-db/5/blobs/sha256:db12
######################################################################### 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/perl/manifests/5.38.2_1
######################################################################### 100.0%
==> Fetching perl
==> Downloading https://ghcr.io/v2/homebrew/core/perl/blobs/sha256:4da05eef811a9
######################################################################### 100.0%
==> Fetching help2man
==> Downloading https://ghcr.io/v2/homebrew/core/help2man/blobs/sha256:c7be1329f
######################################################################### 100.0%
==> Installing dependencies for help2man: berkeley-db@5 and perl
==> Installing help2man dependency: berkeley-db@5
==> Downloading https://ghcr.io/v2/homebrew/core/berkeley-db/5/manifests/5.3.28_
Already downloaded: /Users/futurepr0n/Library/Caches/Homebrew/downloads/17e4e0def00184b561c8a490b5c0813a7c4f5e1365eb2e927570786eb4e05e09--berkeley-db@5-5.3.28_1.bottle_manifest.json
==> Pouring berkeley-db@5--5.3.28_1.sonoma.bottle.tar.gz
🍺  /usr/local/Cellar/berkeley-db@5/5.3.28_1: 5,271 files, 86.2MB
==> Installing help2man dependency: perl
==> Downloading https://ghcr.io/v2/homebrew/core/perl/manifests/5.38.2_1
Already downloaded: /Users/futurepr0n/Library/Caches/Homebrew/downloads/e664800549b3654bc040f70178f610931fec1d5299fe0d845f2dd2b969ad1372--perl-5.38.2_1.bottle_manifest.json
==> Pouring perl--5.38.2_1.sonoma.bottle.tar.gz
🍺  /usr/local/Cellar/perl/5.38.2_1: 2,516 files, 67.8MB
==> Installing help2man
==> Pouring help2man--1.49.3_2.sonoma.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/man/de/man1/help2man.1
/usr/local/share/man/de/man1 is not writable.

You can try again using:
  brew link help2man
==> Summary
🍺  /usr/local/Cellar/help2man/1.49.3_2: 72 files, 776.0KB
==> Running `brew cleanup help2man`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

To get around this brew link would not work either, so I found an article where fixing that issue was to run sudo chown -R $(whoami) $(brew --prefix)/* after that I executed the brew link help2man successfully and ran ./configure --enable-local . Successfully.

Next, steps:

 cd ..
 cp configs/sh2eb-elf/native-linux.config .config

Still at the moment trying to get passed the next part, as build sh2 part fails

@ijacquez
Copy link
Collaborator

ijacquez commented Feb 6, 2024

Thanks for looking into this. Unfortunately I don't have immediate access to a MacOS machine at the moment. Could you try looking at this reply from another repository issue?

The idea is the same as to how I build the Windows tool-chain. It's a Canadian Cross build. That is, first you build a compiler that runs on Linux, that generates MacOS executables. Then the second step is you use the compiler from the first step to target SH-2. At the end you'll end up with a compiler that runs on MacOS and targets SH-2.

@ijacquez ijacquez added the help wanted Extra attention is needed label Feb 6, 2024
@futurepr0n
Copy link
Author

Thanks I will check out in detail, but at immediate glance I don't know if this was same thing I ran into. I was able to build cross tool successfully, but not able to build using cross tool due to the local disk being non case sensitive.

futurepr0n@Marks-MacBook-Pro libyaul-build-scripts % unset LIBRARY_PATH 
futurepr0n@Marks-MacBook-Pro libyaul-build-scripts % unset CPATH
futurepr0n@Marks-MacBook-Pro libyaul-build-scripts % crosstool-ng/ct-ng build
[INFO ]  Performing some trivial sanity checks
[INFO ]  Build started 20240206.180023
[INFO ]  Building environment variables
[WARN ]  Directory '/Users/futurepr0n/src' does not exist.
[WARN ]  Will not save downloaded tarballs to local storage.
[EXTRA]  Preparing working directories
[ERROR]  Your file system in '/Users/futurepr0n/.local/x-tools/sh2eb-elf' is *not* case-sensitive!
[ERROR]   
[ERROR]  >>
[ERROR]  >>  Build failed in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_Abort[scripts/functions@488]
[ERROR]  >>        called from: CT_TestAndAbort[scripts/functions@508]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@329]
          

Current command (unknown), exited with error code: 1
Please fix it up and finish by exiting the shell with one of these values:
    1  fixed, continue with next build command
    3  abort build

I have been able to use the docker build now and I might admit defeat in this regard unless there is some way to change that out of the crosstool build portion? Could I comment parts out that are strictly checking it? Or can I change the paths where this happens and make the path same as where I am running the build? Or will there be dependencies that are going to need the strict case sensitivity after this part too?


[INFO ]  Building environment variables
[WARN ]  Directory '/Users/futurepr0n/src' does not exist.
[WARN ]  Will not save downloaded tarballs to local storage.
[EXTRA]  Preparing working directories
[ERROR]  Your file system in '/Users/futurepr0n/.local/x-tools/sh2eb-elf' is *not* case-sensitive!

If I can change this path and if nothing matters after that I may be successful native.

@ijacquez
Copy link
Collaborator

ijacquez commented Feb 7, 2024

crosstool-ng looks at .config. You can change the path by modifying this variable:

CT_PREFIX_DIR="${CT_PREFIX:-${HOME}/.local/x-tools}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}"

You can change it to:

CT_PREFIX_DIR="${CT_PREFIX:-/path/to/your/case-sensitive-volume/x-tools}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}"

@futurepr0n
Copy link
Author

tried changing the path and hardcoding it to where would be case sensitive and valid, but new errors during the process came up - it was unable to run with failed current command "mkdir" "-p" - something about this just does not want to work smoothly with mac and thats ok - the docker build seems to be a great alternative. Thank you for the help and trying

@ijacquez
Copy link
Collaborator

Thanks @futurepr0n.

I'll keep this open.

@ijacquez ijacquez reopened this Feb 14, 2024
@ijacquez ijacquez self-assigned this Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants