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

Makefile complie errors #2

Open
mbeltagy opened this issue Apr 23, 2018 · 6 comments · May be fixed by #3
Open

Makefile complie errors #2

mbeltagy opened this issue Apr 23, 2018 · 6 comments · May be fixed by #3

Comments

@mbeltagy
Copy link

The Makefile does not seem to make use of JULIA_DIR.

I get compilation errors related ton including julia.h. Looking at the Makefile is seems that the include is hard-coded for a standard julia 0.5 OSx install.

@rcqls
Copy link
Owner

rcqls commented Apr 25, 2018

@mbeltagy JULIA_DìR is used in jl4rb/lib/jl4rb/jl2rb_init.rb and in jl4rb/ext/extconf.rb. On my computer JULIA_DIR=/Applications/Julia-0.6.app/Contents/Resources/julia .
Be careful, theMakefile is automatically generated from the extconf.rb at installation.

@mbeltagy
Copy link
Author

mbeltagy commented Apr 25, 2018

In the Makefile there are several static directory references, which would make it impossible to compile on anything other than Julia 0.5 on OS X.
See for example

topdir = /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0

arch_hdrdir = /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin16

ldflags = -Wl,-rpath,/Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia -L/Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia -Wl,-rpath,/Applications/Julia-0.5.app/Contents/Resources/julia/lib -L/Applications/Julia-0.5.app/Contents/Resources/julia/lib

CFLAGS = $(CCDLFLAGS) -I/Applications/Julia-0.5.app/Contents/Resources/julia/include/julia -I. $(ARCH_FLAG)

@rcqls
Copy link
Owner

rcqls commented Apr 25, 2018

As I told you when you install this gem gem install jl4rb the Makefile has to be regenerated. So the Makefile in this repo is not considered since the Makefile is not embedded in the jl4rb.gem.

@mbeltagy
Copy link
Author

mbeltagy commented May 1, 2018

I tried many times and failed and I can not figure out what the problem is
When I run
gem install jl4rb

I get

Building native extensions.  This could take a while...
ERROR:  Error installing jl4rb:
	ERROR: Failed to build gem native extension.

    current directory: /home/usr/.rvm/gems/ruby-2.3.0/gems/jl4rb-0.0.10/ext/jl4rb
/home/usr/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20180501-10439-1f6ipst.rb extconf.rb
creating Makefile

current directory: /home/usr/.rvm/gems/ruby-2.3.0/gems/jl4rb-0.0.10/ext/jl4rb
make "DESTDIR=" clean

current directory: /home/usr/.rvm/gems/ruby-2.3.0/gems/jl4rb-0.0.10/ext/jl4rb
make "DESTDIR="
compiling jl4rb.c
jl4rb.c:7:19: fatal error: julia.h: No such file or directory
 #include "julia.h"
                   ^
compilation terminated.
make: *** [jl4rb.o] Error 1

make failed, exit code 2

The makefile generated at
/home/usr/.rvm/gems/ruby-2.3.0/gems/jl4rb-0.0.10/ext/jl4rb/Makefile has no references to JULIA_DIR or its contents.

After a bit of digging, I noticed that

if RUBY_PLATFORM =~ /linux/
$prefix_include << "/usr/include/"+RUBY_PLATFORM+"/julia" if File.exists? "/usr/include/"+RUBY_PLATFORM+"/julia"
$prefix_include << "/usr/include/julia" if File.exists? "/usr/include/julia"
$prefix_lib << "/usr/lib/"+RUBY_PLATFORM+"/julia" if File.exists? "/usr/lib/"+RUBY_PLATFORM+"/julia"

Makes no references to JULIA_DIR. Only if you are on none linux platform would this used.
There is an assumption of fixed install location for Julia, which is not true in my case.

@rcqls
Copy link
Owner

rcqls commented May 1, 2018

Could you check where is located the include julia dir and the lib julia dir on your computer ?
In my install, I only assume /usr/include/RUBY_PLATFORM/julia and /usr/lib/RUBY_PLATFORM/julia which could not be valid anymore with last linux build....

@mbeltagy mbeltagy linked a pull request May 1, 2018 that will close this issue
@mbeltagy
Copy link
Author

mbeltagy commented May 1, 2018

On my machine it is at required headers are at JULIA_DIR/src/
I happen to like to build my julia from source. But the file structure also holds for other binary installs.
In the pull request, I have taken out the linux specific bits and it seems to work just fine now.
Also I ran into compile errors with jl_init taking arguments, so I had to excise bit that do that.
It now work fine my linux machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants