Skip to content

Commit

Permalink
Removed gcc on macOS
Browse files Browse the repository at this point in the history
I decided that we shouldn't even consider this. Way too much hassel, not any great payout.
  • Loading branch information
vetlewi committed Oct 28, 2021
1 parent 4f70be8 commit 3010995
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ The simplest way to get the new repo is to rerun the installation instructions b
The `MaMa` format has some limitation. Mainly the format will not be able to save the `std` attribute, meaning that error-bars will not be stored. The `MaMa` format is always in keV units, meaning that the `units` keyword in the `Vector.save` method is ignored.
#### Compiling with `gcc` on macOS
Short answer: Don't. Long answer: If you want to compile using `gcc` you are on your own. This is not a standard setup and will require careful configuration of the system. There is a recent update (PR #191) that will ensure that compilation will complete without any issues, however there may be linking issues at runtime. If you have issues, please consider using the standard `clang` compiler or use the docker image.
Short answer: Don't. Please use `clang`.

## General usage
All the functions and classes in the package are available in the main module. You get everything by importing the package
Expand Down
1 change: 0 additions & 1 deletion release_note.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Changed:
- Reimplemented PPF for normal distribution and truncated normal distribution in C++ for improved performance (about 300% faster than the SciPy implementation!).
- Fixed a potential bug where `units` attribute is set erroniously when reading the discrete level density from file (`load_levels_discrete` and `load_levels_discrete_smooth`).
- Fixed a bug that prevented compilation on ARM platforms.
- Added a workaround for cases where `gcc` is used rather than `clang` on macOS. This setup will probably still fail on runtime unless the system is correctly configured. That is not our problem, solve it yourself.

Deprecated:
- `shape` argument of Matrix for creation of a matrix filled with zeros. Use `ZerosMatrix` instead.
Expand Down
27 changes: 1 addition & 26 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,6 @@
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)


def check_if_clang_compiler():
"""Check if the compiler is clang or gcc"""

# Find the CC variable
cc = os.getenv("CC")
cc = 'gcc' if cc is None else cc # Will be gcc if none.
std_err = subprocess.run(cc, capture_output=True, text=True).stderr
if "clang" in std_err:
return True


# Return the git revision as a string
# See also ompy/version.py
def git_version():
Expand Down Expand Up @@ -146,7 +135,7 @@ def write_version_py(filename='ompy/version_setup.py'):
extra_compile_args_cpp = ["-std=c++11", "-O3"]

extra_link_args = []
if openmp and platform.system() == 'Darwin' and check_if_clang_compiler():
if openmp and platform.system() == 'Darwin':
extra_compile_args_cython.insert(-1, "-Xpreprocessor -fopenmp")
extra_link_args.insert(-1, "-lomp")
elif openmp:
Expand All @@ -171,20 +160,6 @@ def write_version_py(filename='ompy/version_setup.py'):
extra_compile_args=extra_compile_args_cpp)
]

# Superhacky solution to get pybind11 to play nicely with GCC...
if platform.system() == 'Darwin' and not check_if_clang_compiler():
try:
idx = ext_modules_pybind11[0].extra_compile_args.index(
'-stdlib=libc++')
del ext_modules_pybind11[0].extra_compile_args[idx]
except ValueError:
pass
try:
idx = ext_modules_pybind11[0].extra_link_args.index('-stdlib=libc++')
del ext_modules_pybind11[0].extra_link_args[idx]
except ValueError:
pass

install_requires = [
"cython",
"numpy>=1.20.0",
Expand Down

0 comments on commit 3010995

Please sign in to comment.