-
Notifications
You must be signed in to change notification settings - Fork 7
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 universal2 binaries from mixed Fortran/C++ code (current issue: ___builtin_nested_func_ptr_created
symbol not found)
#23
Comments
@slayoo Can you provide more details? It works for me just fine for me (see below), but make sure the script is executable (
(I'd change the name of the script to something more obvious like |
@s-u, thank you for quick reply! I was exactly assuming as you describe it - that it's a drop-in replacement for gfortran. Thank you for checking with CMake. I'm trying to automate building of universal2 wheels for the PyPartMC project. In the CI script, this looks like this: and the log is here: I'm investigating further... |
This is the problem:
it doesn't pull the script - you need the raw version from GH so it should be
|
Thank you, @s-u! |
@slayoo BTW: As a test I just tried to compile |
Thanks! Perhaps CMake doesn't add it since unpatched gfortran doesn't support multiple arch options? |
After setting
Any hints? |
Highly likely you are missing
before. |
Thank you, @s-u!
which leads to https://gcc.gnu.org/bugzilla//show_bug.cgi?id=106487 ... and further (TBC) |
same error message was reported, e.g., here: iains/gcc-darwin-arm64#34 (comment) |
___builtin_nested_func_ptr_created
symbol not found)
This is no longer related to the universal wrapper - that looks like a problem in your linking (failing to link the necessary |
Thank you, @s-u Concerning
(https://raw.githubusercontent.com/Homebrew/formula-patches/1d184289/gcc/gcc-12.2.0-arm.diff) ... still digesting what it means for this workflow... Anyhow, let me also ask about this warning which points to
Does it mean that the linker is unable to correctly link against libgfortran? Could it be related with the above libgcc error? Thanks! |
@slayoo as I said above - you are using the wrong linking flags (look at the paths - it's using Ok, let me explain a bit more in detail what I meant above: In most projects, the linker (
Notice all the Fortran run-time linking flags adding the gcc library paths and in particular notice the So if you use the Fortran driver to link, everything is just fine and everything works as is should. Now the problem starts if you are mixing languages and toolchains. So let's look at the C++ driver instead which comes from Apple's clang:
Notice that there is no This is where things get really complicated: in order to create binary with both C++ and Fortran code (simple lesson: don't do that!), you have to manually find out all the run-time flags and in the right order. In your last example above, obviously some part of the configuration has been trying to detect the flags, but it only did it for Similarly, in you first example, it was using I suspect that your project is simply not setup to handle dual-archs correctly. I think CMake is simply incapable of linking Fortran and C++ automatically (which is possibly why The links you posted above are unrelated - there is nothing wrong here, the Fortran compiler works just fine - most of the posts above are simply proofs of bad run-time mismatches, because you get the error with I hope this helps to explain. I think the crux of the problem is the attempt to use C++ linker for Fortran code. I'd say it would be a lot easier to use the Fortran linker instead and add the C++ flags as they are far simpler to add - so that would be my recommendation. |
___builtin_nested_func_ptr_created
symbol not found)___builtin_nested_func_ptr_created
symbol not found)
Thank you, once again, @s-u! Based on your explanation, I was able to silence the "attempting to link with file built for macOS-arm64" warning by doing:
Still, it complains at runtime about the missing symbol. No luck yet with using the gfortran linker to assemble the final .so file. Will try to create a minimal example to narrow the scope and be able to ask more precise questions. Meanwhile, let me close this "issue" and thank again for your help! |
@slayoo I don't know what you did or didn't do, but if you can't link per architecture then you need to If I was you I'd build separate targets and |
Hello,
CC: @s-u
I'm using the packaged gcc-12-branch from https://github.com/R-macos/gcc-12-branch/releases and I'm trying to build universal binaries using the
dr.sh
driver driver script (https://github.com/R-macos/gcc-12-branch/blob/gcc-12-2-darwin/build/dr.sh). I'm instructing CMake to use it withcmake -DCMAKE_Fortran_COMPILER=dr.sh
but it errs withThe CMAKE_Fortran_COMPILER: /Users/runner/work/PyPartMC/PyPartMC/dr.sh is not a full path to an existing compiler tool.
What is the intended way to use the
dr.sh
?(posting here as the R-macos fork has issues disabled)
Thanks,
Sylwester
The text was updated successfully, but these errors were encountered: