Installing the Julia-package on macOS 10.14.5

Discussions on installation issues go here.
schmitt
Posts: 4
Joined: 17 Jul 2019, 12:05

Installing the Julia-package on macOS 10.14.5

Postby schmitt » 17 Jul 2019, 12:59

I successfully compiled polymake on macOS 10.14.5 using homebrew and perlbrew following the instructions (https://polymake.org/doku.php/install/m ... stallation).
However, now I would like to install the Julia-package. So I did

Code: Select all

export POLYMAKE_CONFIG="~/Documents/polymake/bin/polymake-config"
and then in julia

Code: Select all

]add Polymake.jl
as described here: https://github.com/oscar-system/Polymak ... f-polymake.
But building Polymake.jl gives this error:

Code: Select all

┌ Error: Error building `Polymake`: │ -- The C compiler identification is AppleClang 10.0.1.10010046 │ -- The CXX compiler identification is AppleClang 10.0.1.10010046 │ -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc │ -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works │ -- Detecting C compiler ABI info │ -- Detecting C compiler ABI info - done │ -- Detecting C compile features │ -- Detecting C compile features - done │ -- Check for working CXX compiler: /usr/bin/g++ │ -- Check for working CXX compiler: /usr/bin/g++ -- works │ -- Detecting CXX compiler ABI info │ -- Detecting CXX compiler ABI info - done │ -- Detecting CXX compile features │ -- Detecting CXX compile features - done │ -- Found Julia executable: /Applications/Julia-1.1.app/Contents/Resources/julia/bin/julia │ -- Julia_VERSION_STRING: 1.1.0 │ -- Julia_INCLUDE_DIRS: /Applications/Julia-1.1.app/Contents/Resources/julia/include/julia │ -- Julia_LIBRARY_DIR: /Applications/Julia-1.1.app/Contents/Resources/julia/lib │ -- Julia_LIBRARY: /Applications/Julia-1.1.app/Contents/Resources/julia/lib/libjulia.dylib │ -- JULIA_HOME: /Applications/Julia-1.1.app/Contents/Resources/julia/bin │ -- Julia_LLVM_VERSION: v6.0.1 │ -- Julia_WORD_SIZE: 64 │ -- Found Julia: /Applications/Julia-1.1.app/Contents/Resources/julia/lib/libjulia.dylib (found version "1.1.0") │ -- Configuring done │ -- Generating done │ -- Build files have been written to: /Users/JSchmitt/.julia/packages/Polymake/ZrnNN/deps/src │ Scanning dependencies of target polymake │ [ 16%] Building CXX object CMakeFiles/polymake.dir/polymake.cpp.o │ [ 16%] Building CXX object CMakeFiles/polymake.dir/polymake_arrays.cpp.o │ In file included from /Users/JSchmitt/.julia/packages/Polymake/ZrnNN/deps/src/polymake.cpp:1: │ In file included from /Users/JSchmitt/.julia/packages/Polymake/ZrnNN/deps/src/polymake_includes.h:18: │ In file included from /Users/JSchmitt/Documents/polymake/include/polymake/IncidenceMatrix.h:20: │ In file included from /Users/JSchmitt/Documents/polymake/include/polymake/next/IncidenceMatrix.h:28: │ In file included from /Users/JSchmitt/Documents/polymake/include/polymake/permutations.h:21: │ In file included from /Users/JSchmitt/Documents/polymake/include/polymake/Integer.h:20: │ In file included from /Users/JSchmitt/.julia/packages/Polymake/ZrnNN/deps/src/polymake_arrays.cpp:1: │ In file included from /Users/JSchmitt/.julia/packages/Polymake/ZrnNN/deps/src/polymake_includes.h:18: │ In file included from /Users/JSchmitt/Documents/polymake/include/polymake/IncidenceMatrix.h:20: │ In file included from /Users/JSchmitt/Documents/polymake/include/polymake/next/IncidenceMatrix.h:28: │ In file included from /Users/JSchmitt/Documents/polymake/include/polymake/permutations.h:21: │ In file included from /Users/JSchmitt/Documents/polymake/include/polymake/Integer.h:20: │ /Users/JSchmitt/Documents/polymake/include/polymake/next/Integer.h:30:10: fatal error: 'gmp.h' file not found │ /Users/JSchmitt/Documents/polymake/include/polymake/next/Integer.h:30:10: fatal error: 'gmp.h' file not found │ #include <gmp.h> │ ^~~~~~~ │ #include <gmp.h> │ ^~~~~~~ │ 1 error generated. │ 1 error generated. │ make[2]: *** [CMakeFiles/polymake.dir/polymake.cpp.o] Error 1 │ make[2]: *** Waiting for unfinished jobs.... │ make[2]: *** [CMakeFiles/polymake.dir/polymake_arrays.cpp.o] Error 1 │ make[1]: *** [CMakeFiles/polymake.dir/all] Error 2 │ make: *** [all] Error 2 │ ERROR: LoadError: failed process: Process(`make -j2`, ProcessExited(2)) [2] │ Stacktrace: │ [1] error(::String, ::Base.Process, ::String, ::Int64, ::String) at ./error.jl:42 │ [2] pipeline_error at ./process.jl:785 [inlined] │ [3] #run#515(::Bool, ::Function, ::Cmd) at ./process.jl:726 │ [4] run(::Cmd) at ./process.jl:724 │ [5] top-level scope at none:0 │ [6] include at ./boot.jl:326 [inlined] │ [7] include_relative(::Module, ::String) at ./loading.jl:1038 │ [8] include(::Module, ::String) at ./sysimg.jl:29 │ [9] include(::String) at ./client.jl:403 │ [10] top-level scope at none:0 │ in expression starting at /Users/JSchmitt/.julia/packages/Polymake/ZrnNN/deps/build.jl:140 └ @ Pkg.Operations /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Operations.jl:1075
Apparently it cannot find the gmp-library which I installed as dependency for polymake using homebrew, so it is definitely there (in /usr/local/Cellar/gmp/6.1.2_2/lib).
Does anybody have any advice on how to tell the build.jl-script where it can find the libraries? Many thanks in advance!
Note, that I also tried to use the polymake_start_julia.jl as described here: https://polymake.org/doku.php/install/m ... l_in_julia. But even after adjusting the path to my polymake-directory that did not work at all (which I pretty much expected since I am not using the bundle).

paffenholz
Developer
Posts: 211
Joined: 24 Dec 2010, 13:47

Re: Installing the Julia-package on macOS 10.14.5

Postby paffenholz » 19 Jul 2019, 17:37

Unfortunately I cannot reproduce your problem on a fresh installation of 10.14. I would need some more details of your installation process.

- Did you install brew into the standard location (which is /usr/local), or to some other path?
- Does the file /usr/local/include/gmp.h exist?
- Have you provided any additional include and/or library paths for the compilation of polymake, either separately with some environment variables before calling configure, or as an option to configure?
- Have you set any additional include/library paths in the shell config (usually $HOME/.bash_profile)?
- can you run polymake-config separately (with the various options it tells you when runnig it without any) and post the output?

Generally, polymake in julia needs the exact same environment as for the compilation of polymake itself, as polymake needs to compile new code both during adding Polymake.jl to Julia and later during using polymake in Julia .

Andreas

schmitt
Posts: 4
Joined: 17 Jul 2019, 12:05

Re: Installing the Julia-package on macOS 10.14.5

Postby schmitt » 19 Jul 2019, 18:13

Thanks for your reply!
Did you install brew into the standard location (which is /usr/local), or to some other path?
I'm pretty sure I did. (The directories Homebrew and Cellar are in /usr/local.)
Does the file /usr/local/include/gmp.h exist?
Yes, it is a link to /usr/local/Cellar/gmp/6.1.2_2/include/gmp.h.
Have you provided any additional include and/or library paths for the compilation of polymake, either separately with some environment variables before calling configure, or as an option to configure?
I had to do

Code: Select all

export PATH="/usr/local/opt/libxml2/bin:$PATH" export PERL5LIB=$HOME/perl5/lib/perl5:$HOME/perl5${PERL5LIB+:$PERL5LIB}
but that's still in my .zshrc.
Have you set any additional include/library paths in the shell config (usually $HOME/.bash_profile)?
No.
can you run polymake-config separately (with the various options it tells you when runnig it without any) and post the output?

Code: Select all

JSchmitt:polymake/bin$ ./polymake-config --cc g++ JSchmitt:polymake/bin$ ./polymake-config --cflags -DPOLYMAKE_VERSION=304 -fPIC -pipe -std=c++14 -Wno-logical-op-parentheses -Wno-shift-op-parentheses -Wno-mismatched-tags -Wno-unused-local-typedef -Wno-error=unneeded-internal-declaration -Wshadow -O3 -DPOLYMAKE_DEBUG=0 JSchmitt:polymake/bin$ ./polymake-config --includes -I/Users/JSchmitt/Documents/polymake/include -I/Users/JSchmitt/Documents/polymake/include/polymake/external JSchmitt:polymake/bin$ ./polymake-config --ldflags -L/Users/JSchmitt/Documents/polymake/lib -L/usr/local/opt/libxml2/lib -flat_namespace JSchmitt:polymake/bin$ ./polymake-config --libs -lpolymake -lpolymake-apps -lmpfr -lgmp -lpthread -lc++ -L/usr/local/Cellar/libxml2/2.9.9_2/lib -lxml2 -lz -lpthread -liconv -lm
To be honest, I'm not quite sure what exactly I did during compiling (and somehow my shell history is incomplete). I guess I'm going to compile it again this evening to be sure.

Johannes

schmitt
Posts: 4
Joined: 17 Jul 2019, 12:05

Re: Installing the Julia-package on macOS 10.14.5

Postby schmitt » 19 Jul 2019, 19:35

I just compiled Polymake again and started Julia in the same shell (so the same environment), but still get the error.
However, I now have to amend/correct my first reply:
  • I set the JAVA_HOME environment variable.
  • configure tells me that it cannot find bliss, javaview, scip, singular and soplex. Does one need these for the Julia-package?
  • Adding libxml2 to PATH (as I wrote above) was apparently unnecessary. This did change the output of polymake-config:

    Code: Select all

    JSchmitt:~$ $POLYMAKE_CONFIG --cc g++ JSchmitt:~$ $POLYMAKE_CONFIG --cflags -DPOLYMAKE_VERSION=304 -fPIC -pipe -std=c++14 -Wno-logical-op-parentheses -Wno-shift-op-parentheses -Wno-mismatched-tags -Wno-unused-local-typedef -Wno-error=unneeded-internal-declaration -Wshadow -O3 -DPOLYMAKE_DEBUG=0 JSchmitt:~$ $POLYMAKE_CONFIG --includes -I/Users/JSchmitt/Documents/polymake/include -I/Users/JSchmitt/Documents/polymake/include/polymake/external JSchmitt:~$ $POLYMAKE_CONFIG --ldflags -L/Users/JSchmitt/Documents/polymake/lib -flat_namespace JSchmitt:~$ $POLYMAKE_CONFIG --libs -lpolymake -lpolymake-apps -lmpfr -lgmp -lpthread -lc++ -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib -lxml2 -lz -lpthread -licucore -lm
Johannes

paffenholz
Developer
Posts: 211
Joined: 24 Dec 2010, 13:47

Re: Installing the Julia-package on macOS 10.14.5

Postby paffenholz » 19 Jul 2019, 22:12

No, you don't need any of the packages that failed during the configure step. All java stuff doesn't work properly on mac os anyway. Scip ist for optimization, bliss is a replacement for nauty, singular is for computations with ideals. The output of polymake-config looks good. With my question for additional paths I was aiming for something nonstandard that would provide a gmp.

Currently I don't have a good idea what goes wrong. Maybe there is also some difference between 10.14.3 and 10.14.5 (I know that they updated perl, but that shouldn't be a problem here). Things one might try:
- compile some simple program like

Code: Select all

#include <gmp.h> int main () { return 1; }
with

Code: Select all

clang++ <file>

to check that gmp.h is really found
- provide /usr/local/include via an envirnoment variable

Code: Select all

export CPLUS_INCLUDE_PATH=/user/local/include export CPPFLAGS=-I/user/local/include
in the terminal you call julia. I will discuss this with other developers.

Andreas

schmitt
Posts: 4
Joined: 17 Jul 2019, 12:05

Re: Installing the Julia-package on macOS 10.14.5

Postby schmitt » 19 Jul 2019, 23:14

Providing /usr/local/include as environment variable actually solved the problem (almost)!
I also had to do

Code: Select all

export LDFLAGS="-L/usr/local/Cellar/mpfr/4.0.2/lib -lmpfr -L/usr/local/Cellar/gmp/6.1.2_2/lib -lgmp"
because Julia threw this error:

Code: Select all

ld: library not found for -lmpfr │ clang: error: linker command failed with exit code 1 (use -v to see invocation) │ make[2]: *** [libpolymake.dylib] Error 1 │ make[1]: *** [CMakeFiles/polymake.dir/all] Error 2 │ make: *** [all] Error 2
Now everything works. Thank you for your help!

Johannes

paffenholz
Developer
Posts: 211
Joined: 24 Dec 2010, 13:47

Re: Installing the Julia-package on macOS 10.14.5

Postby paffenholz » 19 Jul 2019, 23:46

Congratulations. Enjoy!

Thanks for the notice and for reporting the solution. As polymake has found gmp and mpfr I would suspect that the include paths and linker flags somehow get lost in the Julia package installation. We will check this.

Andreas

paffenholz
Developer
Posts: 211
Joined: 24 Dec 2010, 13:47

Re: Installing the Julia-package on macOS 10.14.5

Postby paffenholz » 19 Jul 2019, 23:50

One more thing: polymake sometimes compiles new code at runtime and rebuilds some libraries (whenever you, or a package you use, uses a C++-template instance of a polymake class that did not occur before). So you should set the variables each time you use polymake in julia, or wrap the julia call in a small script together with the variables.


Return to “Installing polymake”