golosio / xrmc

17 stars 10 forks source link

Installing on macOS? #43

Open xxyxxyxyx1 opened 5 years ago

xxyxxyxyx1 commented 5 years ago

How can I install XRMC on macOS?

homebrew/science no longer exists and XRMC was never migrated to a new homebrew repository

I tried building 6.6.0 from http://lvserver.ugent.be/xrmc/files/, but make fails:

./configure
<no errors>

make
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in src
Making all in arrayNd
make[3]: Nothing to be done for `all'.
Making all in composition
/bin/sh ../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../..  -I/usr/local/include/xraylib -I./../device/ -I./../xrmc_algo -I./../gettoken -I./../exception -I./../xrmc_math -I./../xrmc_algo -I./../randmt -I./../main    -g -O2 -MT libcomposition_la-composition.lo -MD -MP -MF .deps/libcomposition_la-composition.Tpo -c -o libcomposition_la-composition.lo `test -f 'composition.cpp' || echo './'`composition.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -I/usr/local/include/xraylib -I./../device/-I./../xrmc_algo -I./../gettoken -I./../exception -I./../xrmc_math -I./../xrmc_algo -I./../randmt-I./../main -g -O2 -MT libcomposition_la-composition.lo -MD -MP -MF.deps/libcomposition_la-composition.Tpo -c composition.cpp  -fno-common -DPIC -o .libs/libcomposition_la-composition.o
composition.cpp:75:17: error: no matching function for call to 'CS_Total'
    MuAtom[i] = CS_Total(Z[i], E); // total cross section  for atomic num. Z
                ^~~~~~~~
/usr/local/include/xraylib/xraylib.h:151:8: note: candidate function not viable: requires 3 arguments, but 2 were provided
double CS_Total(int Z, double E, xrl_error **error);
       ^
composition.cpp:89:32: error: no matching function for call to 'Fi'
    double num = W[i]*KD*(Z[i]+Fi(Z[i],E));
                               ^~
/usr/local/include/xraylib/xraylib.h:246:8: note: candidate function not viable: requires 3 arguments, but 2 were provided
double Fi(int Z, double E, xrl_error **error);
       ^
composition.cpp:90:20: error: no matching function for call to 'AtomicWeight'
    double denom = AtomicWeight(Z[i])*E*E;
                   ^~~~~~~~~~~~
/usr/local/include/xraylib/xraylib.h:143:8: note: candidate function not viable: requires 2 arguments, but 1 was provided
double AtomicWeight(int Z, xrl_error **error);
       ^
3 errors generated.
make[3]: *** [libcomposition_la-composition.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
tschoonj commented 5 years ago

The correct way to install xrmc via homebrew is:

brew install tschoonj/tap/xrmc

You will however need to uninstall xraylib first, which you appear to have installed by cloning the git master branch, and which is not compatible with the current stable release of xrmc.

xxyxxyxyx1 commented 5 years ago

Thank you for the fast reply! I apologize if this is a basic issue; I am not much of a programmer.

I ran make uninstall in my xraylib directory, then brew install tschoonj/tap/xrmc:

==> Installing tschoonj/tap/xrmc dependency: xraylib
==> Downloading https://xraylib.tomschoonjans.eu/xraylib-3.3.0.tar.gz
######################################################################## 100.0%
==> ./configure --disable-silent-rules --prefix=/usr/local/Cellar/xraylib/3.3.0 --disable-idl --disable-php --disable-java --enable-fortran2003 --disable-perl --disabl
==> make
==> make install
🍺  /usr/local/Cellar/xraylib/3.3.0: 40 files, 34.6MB, built in 1 minute 16 seconds
==> Installing tschoonj/tap/xrmc
==> Downloading https://xrmc.tomschoonjans.eu/xrmc-6.6.0.tar.gz
######################################################################## 100.0%
==> Downloading https://patch-diff.githubusercontent.com/raw/golosio/xrmc/pull/38.patch
######################################################################## 100.0%
Warning: Cannot verify integrity of e564650a59fc80d855e6892ed9ec420e9aaf05b2fa8465fe40562b2c45168c59--38.patch
A checksum was not provided for this resource
For your reference the SHA-256 is: 0c912ad949ba9924a2c2d5395b253a0478370ffcd45e3883b73f1f2b63d35a57
==> Downloading https://github.com/golosio/xrmc/commit/2e12a7daf3f29fdf1f6b2c8d06b86889cf5eaf3f.patch
######################################################################## 100.0%
Warning: Cannot verify integrity of 34b46c515e5931d6ea89dad3971a2308912e7b67931914fb4a0d81a9f62c4977--2e12a7daf3f29fdf1f6b2c8d06b86889cf5eaf3f.patch
A checksum was not provided for this resource
For your reference the SHA-256 is: 9f7a0e9afcfc94f3314d0cde90037bf8ee557a6bd70ab14f1cb8135adceeb973
==> Patching
==> Applying 38.patch
patching file src/xmi-msim/xmimsim-loaddetectorconvolute.cpp
patching file src/randmt/randmt.c
patching file src/randmt/randmt.h
patching file src/randmt/randmt.c
patching file src/main/loadparams.cpp
==> Applying 2e12a7daf3f29fdf1f6b2c8d06b86889cf5eaf3f.patch
patching file src/composition/composition.cpp
patching file src/geom3d/geom3d.cpp
patching file src/geom3d/xrmc_geom3d.h
==> autoreconf -fiv
==> ./configure --disable-silent-rules --prefix=/usr/local/Cellar/xrmc/6.6.0_1 --enable-openmp --docdir=/usr/local/Cellar/xrmc/6.6.0_1/share/doc/xrmc --datarootdir=/us
==> make
Last 15 lines from /Users/mathesu/Library/Logs/Homebrew/xrmc/03.make:
  443 | int     getiopolicy_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
      |         ^~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/resource.h:443:24: error: parameter name omitted
  443 | int     getiopolicy_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
      |                        ^~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/resource.h:443:29: error: parameter name omitted
  443 | int     getiopolicy_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
      |                             ^~~
randmt.c:344: error: expected '{' at end of input
  344 | }
      | 
make[3]: *** [randmt.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
  https://github.com/tschoonj/homebrew-tap/issues
tschoonj commented 5 years ago

Can't say I have seen that error before.

Can you run brew gist-logs -n tschoonj/tap/xrmc? This should create a new issue automatically with all relevant logs.

Thanks!

xxyxxyxyx1 commented 5 years ago

That command does not seem to work:

brew gist-logs -n tschoonj/tap/xrmc 
Error: Not Found
tschoonj commented 5 years ago

Hmmm try brew gist-logs -n xrmc instead.

xxyxxyxyx1 commented 5 years ago

The same Error: Not Found

tschoonj commented 5 years ago

That is strange... what if you drop the -n?

Is there a folder called ~/Library/Logs/Homebrew/xrmc??

xxyxxyxyx1 commented 5 years ago

without the -n it seems to work:

https://gist.github.com/xxyxxyxyx1/7eecd67464e3e99b9ee923f44935969c

tschoonj commented 5 years ago

Hmmm this could be related to the new version of Xcode you installed... I will see if I can confirm this build error tomorrow when I can use my iMac at work which is also running Mojave with the latest Xcode.

tschoonj commented 5 years ago

I updated the XRMC brew formula. It compiles now with Xcode11... Apple is really making life hard for people that like to use command line tools nowadays 😢