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 mayo in conda environment on macOS #186

Open
andrsd opened this issue Mar 30, 2023 · 4 comments
Open

Building mayo in conda environment on macOS #186

andrsd opened this issue Mar 30, 2023 · 4 comments
Labels
build error Compilation and linking errors

Comments

@andrsd
Copy link
Contributor

andrsd commented Mar 30, 2023

If you are building mayo in conda environment on macOS, you can do so, but you will need to patch the build.

  1. opencascade can be obtained via conda-forge channel conda install occt
  2. You won't have libTKXSDRAW.dylib (most likely because they do not build it with conda)
  3. You may have a conflicting libconv.dylib installed.

Patch the source with:

$ cd /path/to/mayo
$ git apply conda-build.patch

To build, use:

$ export CASCADE_BASE_DIR=$CONDA_PREFIX
$ qmake ../mayo CASCADE_INC_DIR=$CASCADE_BASE_DIR/include/opencascade CASCADE_LIB_DIR=$CASCADE_BASE_DIR/lib
$ make

conda-build.patch

@HuguesDelorme
Copy link
Member

Hello, thank you so much for the hint.
Do you know if there is a way to check any potential conflict with the iconv library?
How did you install iconv library on your system?

Maybe users with the same build issue can try:
$> qmake ../mayo "LIBS -= -liconv -lTKXSDRAW" "LIBS+=$SDKROOT/usr/lib/libiconv.2.tbd" ...

@andrsd
Copy link
Contributor Author

andrsd commented Mar 31, 2023

How did you install iconv library on your system?

The system one (i.e. the .tbd one) comes from Xcode/CommandLineTools which is the Apple supplied tool chain. The offending one came via conda when installing opencascade. So, you cannot really get rid of that one :-(

Do you know if there is a way to check any potential conflict with the iconv library?

It could be a version collision, i.e. Apple's iconv have different version that the conda one. I can check that. The problem is that you use iconv, iconv_open and iconv_close and these symbols are in the system iconv, but they are named libiconv, libiconv_open and libiconv_close in the conda iconv. The linking step finds the conda iconv, because the conda environment is preferred over the system one (that's by design).

I can try that qmake command you provided - much better solution than patching the sources 👍

@andrsd
Copy link
Contributor Author

andrsd commented Mar 31, 2023

The qmake command works, but needs to have this form:

$ qmake ../mayo CASCADE_INC_DIR=$CASCADE_BASE_DIR/include/opencascade \
  CASCADE_LIB_DIR=$CASCADE_BASE_DIR/lib \
  -after "LIBS -= -liconv -lTKXSDRAW" "LIBS+=$SDKROOT/usr/lib/libiconv.2.tbd"

Then, all builds as expected without patching.

@HuguesDelorme
Copy link
Member

Thanks for the feedback, for now I will add some "troubleshooting" notes on this iconv topic for the macOS build wiki page.
Let's see later in the mid-term how to solve this iconv issue with some compiler checks in the qmake script.

@HuguesDelorme HuguesDelorme added the build error Compilation and linking errors label Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build error Compilation and linking errors
Projects
None yet
Development

No branches or pull requests

2 participants