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

Build problems with macOS + gcc #42

Closed
maxscheurer opened this issue Mar 9, 2019 · 3 comments

Comments

@maxscheurer
Copy link

commented Mar 9, 2019

When trying to build gau2grid with gcc 8.2.0 on macOS, I get a
lot of the following warnings

/tmp/gau2grid/build/gau2grid_deriv2.c: In function 'gg_collocation_L8_deriv2':
/tmp/gau2grid/build/gau2grid_pragma.h:35:62: warning: incompatible implicit declaration of built-in function 'aligned_alloc'
     #define ALIGNED_MALLOC(alignment, size)                  aligned_alloc(alignment, size)
                                                              ^~~~~~~~~~~~~
/tmp/gau2grid/build/gau2grid_deriv2.c:5637:51: note: in expansion of macro 'ALIGNED_MALLOC'
     double* PRAGMA_RESTRICT cache_data = (double*)ALIGNED_MALLOC(64, 256 * sizeof(double));
                                                   ^~~~~~~~~~~~~~
/tmp/gau2grid/build/gau2grid_pragma.h:35:62: note: include '<stdlib.h>' or provide a declaration of 'aligned_alloc'
     #define ALIGNED_MALLOC(alignment, size)                  aligned_alloc(alignment, size)

finally resulting in a linker error:

Undefined symbols for architecture x86_64:
  "_aligned_alloc", referenced from:
      _gg_collocation_L0 in gau2grid_phi.c.o
      _gg_collocation_L1 in gau2grid_phi.c.o
      _gg_collocation_L2 in gau2grid_phi.c.o
      _gg_collocation_L3 in gau2grid_phi.c.o
      _gg_collocation_L4 in gau2grid_phi.c.o
      _gg_collocation_L5 in gau2grid_phi.c.o
      _gg_collocation_L6 in gau2grid_phi.c.o
      ...
ld: symbol(s) not found for architecture x86_64

I tried to include <stdlib.h> in the respective file, but it did not seem to work.
Any ideas on this issue?

@dgasmith

This comment has been minimized.

Copy link
Owner

commented Mar 20, 2019

Hmm, I still cannot reproduce this. I would love to help, but no luck. How did you acquire GCC?

BTW, in general we discourage GCC on Mac due to the poor toolchain. We always very much emphasize clang.

@maxscheurer

This comment has been minimized.

Copy link
Author

commented Mar 20, 2019

I installed it through Homebrew... I'll close this issue since it's not reproducible.
As you say, it works fine with clang.

@wadejong

This comment has been minimized.

Copy link

commented Jul 2, 2019

This is reproducible.

cmake -H. -Bbuild -DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8 -DCMAKE_Fortran_COMPILER=gfortran-8

Homebrew installed gcc-8

Components of NWChemEx cannot compile properly with clang, hence we are using gcc on a Mac right now. Not clear where it goes wrong. Most likely the path to the include file is not found?

Bert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.