Welcome to the forums. Please post in English or French.

You are not logged in.

#1 2022-04-04 20:03:05

Registered: 2022-04-04
Posts: 1

Undefined references for architecture - Circular dependency

Good evening,

I am struggling to build code_aster 15.2.0 from sources on macOS. I chose not to use the dependencies shipped with the source code but instead tried to use available packaged version of them (from homebrew for example) where possible.

Here is where I'm at:

  • I found, built and installed all the dependencies

  • I sligthly tweaked wscripts in various places to replace linux commands by macOS equivalent (details below)

  • The configure step was successful, it seems to find everything it needs in my envrionment

  • The build step goes all the through until linking stage where it errors

First here are the patches I applied, you can find patch files in the attached archive:

  • waftools/mathematics.py

    • nproc doesn't exists on macOS, I'm calling a equivalent command

    • ldd doesn't exists on macOS, Calling otool instead

  • bibc/wscript

    • -Wl,--no-keep-memory is not available on macOS, removed that flag

For the configure step, I ran the following: ./waf.engine configure --prefix=./dist --out=build/std

I also made sure it would only use GCC all the way through and not mix Apple clang for C/C++ with gfortran. You can find output of that command in the attached archive.

Then I simply ran ./waf.engine build --jobs=12 --prefix=./dist --out=build/std

The error states undefined references when linking the bibc library. From looking up the name of the functions, I figured out that the references it is looking for actually exist in the code base, in the other libs bibfor and bibcxx. From there I read through the wscripts and tried my best to understand what was going on. I tried to issue commands for individual libraries and see what comes out: From the the error messages it seems like there's a circular dependency between bibfor, bibc and bibcxx that my linker is not able to work out.

  • bibfor tries to link against functions from bibc like fetsco(...), getfac(...), etc

  • bibc uses both bibcxx and bibfor like _raiseException(...) or abortf(...)

  • bibcxx tries to get things from bibc and bibfor like GetJdcAttr(...) and achvc(...)

The errors happens on whichever library happens to be linked first. Running the command to build that individual library gives the same result.

Here are the three commands for the three libs, output of these available in the attached archive:

  • ./waf.engine build --jobs=12 --prefix=./dist --out=build/std --targets=asterbibfor

  • ./waf.engine build --jobs=12 --prefix=./dist --out=build/std --targets=asterbibc

  • ./waf.engine build --jobs=12 --prefix=./dist --out=build/std --targets=asterbibcxx

I don't really know what to do now and will kindly accept any form of help.

Thanks in advance

Nicolas Jarnoux

Last edited by NicoJarnoux (2022-04-05 09:12:30)

Archive.zip, Size: 12.12 KiB, Downloads: 165