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

Compiling in windows #33

Closed
WestleyArgentum opened this issue Sep 27, 2012 · 12 comments
Closed

Compiling in windows #33

WestleyArgentum opened this issue Sep 27, 2012 · 12 comments

Comments

@WestleyArgentum
Copy link

I'm having trouble compiling on windows 7. I've tried three environments:

MinGW
I have an install of MinGW that includes all the compilers it optionally installs (including fortran). From the MingGW32 terminal I make (my make was part of a cygwin install) Julia and get these warnings / errors:

Junction created for C:\MinGW\msys\1.0\home\user\julia\usr\lib\julia\extras <<===>> C:\MinGW\msys\1.0\home\user\julia\extras
Junction created for C:\MinGW\msys\1.0\home\user\julia\usr\lib\julia\base <<===>> C:\MinGW\msys\1.0\home\user\julia\base
Junction created for C:\MinGW\msys\1.0\home\user\julia\usr\lib\julia\ui <<===>> C:\MinGW\msys\1.0\home\user\julia\ui
...
e_scalbf.c: In function 'scalbf':
e_scalbf.c:32:7: warning: incompatible implicit declaration of built-in function 'finitef' [enabled by default]
s_significandf.c: in function 'significandf':
s_significandf.c:22:9: warning: incompatible implicit declaration of built-in function 'scalbf'
e_jnf.c: in function 'jnf':
e_jnf.c:44:18: warning: incompatible implicit declaration of built-in function 'j0f'
e_jnf.c:45:18: warning: incompatible implicit declaration of built-in function 'j1f'
e_jnf.c: in function 'ynf:
e_jnf.c:176:18: warning: incompatible implicit declaration of built-in function 'y1f'
e_jnf.c:177:23: warning: incompatible implicit declaration of built-in function 'y1f'
make[2]: *** [random/dsfmt-2.1.tar.gz] Error 1
make[1]: *** [julia-release] Error 2
make: *** [release] Error 2

Cygwin
I have an install of cygwin which (I think) includes everything I need... Unless it didn't come with gfortran, in which case I installed that separately. From the cygwin terminal I make Julia and get these warnings/ errors:

k_standard.c:1:0: warning: -fPIC ignored for target (all code is position independent)
In file included from /usr/include/cygwin/types.h:21:0,
                 from /usr/include/sys/types.h:455,
                 from /usr/include/stdio.h:46,
                 from k_standard.c:19:
/usr/include/endian.h:24:18: error: operator '==' has no left operand
/usr/include/endian.h:26:20: error: operator '==' has no left operand
In file included from /usr/include/cygwin/types.h:21:0,
                 from /usr/include/sys/types.h:455,
                 from /usr/include/stdio.h:46,
                 from k_standard.c:19:
/usr/include/endian.h:34:18: error: operator '==' has no left operand
/usr/include/endian.h:54:18: error: operator '==' has no left operand
<builtin>: recipe for target `k_standard.o' failed
make[3]: *** [k_standard.o] Error 1
Makefile:400: recipe for target `fdlibm/libfdm.' failed
make[2]: *** [fdlibm/libfdm.] Error 2
Makefile:20: recipe for target `julia-release' failed
make[1]: *** [julia-release] Error 2
Makefile:16: recipe for target `release' failed
make: *** [release] Error 2

Cygwin and MinGW
I tried running make in the Julia directory from the windows terminal (with MinGW/bin before cygwin/bin, as advised by the MingGW FAQ) and saw:

Hundreds of warnings of the form some_file: line:char: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
Example: e_hypotf.c:1:0: warning -fPIC ignored for target (all code is position independent) [enabled by default]

The same "Incompatible implicit declaration of built in function" warnings that MinGW generated

Then:

cp: cannot stat `fdlibm/libfdm.': No such file or directory
Makefile:404: recipe for target `/home/user/julia/usr/lib/libfdm.' failed
make[2]: *** [/home/user/julia/usr/lib/libfdm.] Error 1
Makefile:20: recipe for target `julia-release' failed
make[1]: *** [julia-release] Error 2
Makefile:16: recipe for target `release' failed
make: *** [release] Error 2

Does anyone spot anything right off that I'm doing wrong or missing? Also, I notice that some of these warnings seem to have come up before here: JuliaLang#717

@vtjnash
Copy link
Collaborator

vtjnash commented Sep 27, 2012

Can you try make OS=WINNT with MinGW compilers on cygwin? Make.inc is not coded to detect the output of uname as Windows on Cygwin. A test for this should probably be added.

I guess fdlibm cannot be built on cygwin, but that dependency will be going away.

The warnings about -fPIC are unimportant (except that there will be fewer once it is detecting the OS correctly)

I don't see an error message for MinGW, was there something more before that, or if you run make again?

@WestleyArgentum
Copy link
Author

Specifying OS=WINNT gets me a little further but not all the way.

We can come back to the other ways of building if we need but I think I'm really close with my 3rd environment (MingGW and cygwin in the path, make from plain windows command prompt).

I've pulled in a few more cygwin packages and things are smoother, but I get stuck here:

    LINK deps/Rmath/src/libRmath.dll
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lrandom
collect2: ld returned 1 exit status
Makefile:44: recipe for target `libRmath.dll' failed
make[3]: *** [libRmath.dll] Error 1
Makefile:421: recipe for target `Rmath/src/libRmath.dll' failed
make[2]: *** [Rmath/src/libRmath.dll] Error 2
Makefile:20: recipe for target `julia-release' failed
make[1]: *** [julia-release] Error 2
Makefile:16: recipe for target `release' failed
make: *** [release] Error 2

I've tried several things. Looking online the consensus seems to be that somewhere a path containing 's needs to be converted to /'s (or vice versa) and so I've tried hard-coding $(USRLIB) in a couple different places... I also started to think that name random was wrong and that it meant librandom.dll (which is inside the USRLIB directory) so I played with that as well.

So far, no love... any ideas?

@vtjnash
Copy link
Collaborator

vtjnash commented Sep 28, 2012

Try adding USE_QUIET=0 to the make invocation to get a better idea about what is being called (and/or execute the make command from inside the deps folder). -lrandom should search for librandom.dll in various places (including USRLIB)

What additional packages were required? (for if someone else wanted to follow your work)

@WestleyArgentum
Copy link
Author

Alas, that doesn't give me much more to report. It outputs a list of the object files and clarifies what directories it's stepping into, but it doesn't tell me where it's looking for -lrandom:

cd Rmath/src && \
make CC="gcc" && \
true -ignorelibRmath.dll libRmath.dll
make[1]: Entering directory `/home/user/julia/deps/Rmath/src'
rm -rf libRmath.dll
gcc -shared -o libRmath.dll bd0.o dnbeta.o i1mach.o pnbinom.o qlnorm.o rgeom.o bessel_i.o dnbinom.o imax2.o pnchisq.o qlogis.o rhyper.o bessel_j.o dnchisq.o imin2.o pnf.o qnbeta.o rlnorm.o bessel_k.o dnf.o lbeta.o pnorm.o qnbinom.o rlogis.o bessel_y.o dnorm.o lgamma.o pnt.o qnchisq.o rmultinom.o beta.o dnt.o lgammacor.o polygamma.o qnf.o rnbinom.o chebyshev.o dpois.o log1p.o ppois.o qnorm.o rnchisq.o choose.o dt.o mlutils.o pt.o qnt.o rnorm.o d1mach.o dunif.o pbeta.o ptukey.o qpois.o rpois.o dbeta.o dweibull.o pbinom.o punif.o qt.o rt.o dbinom.o expm1.o pcauchy.o pweibull.o qtukey.o runif.o dcauchy.o fmax2.o pchisq.o qbeta.o qunif.o rweibull.o dchisq.o fmin2.o pexp.o qbinom.o qweibull.o sexp.o dexp.o fprec.o pf.o qcauchy.o rbeta.o sign.o df.o fround.o pgamma.o qchisq.o rbinom.o signrank.o dgamma.o fsign.o pgeom.o qexp.o rcauchy.o snorm.o dgeom.o ftrunc.o phyper.o qf.o rchisq.o stirlerr.o dhyper.o gamma.o plnorm.o qgamma.o rexp.o toms708.o dlnorm.o gamma_cody.o plogis.o qgeom.o rf.o wilcox.o dlogis.o gammalims.o pnbeta.o qhyper.o rgamma.o sunif.o -L/home/user/julia/usr/lib -lrandom
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lrandom
collect2: ld returned 1 exit status
Makefile:44: recipe for target `libRmath.dll' failed
make[1]: *** [libRmath.dll] Error 1
make[1]: Leaving directory `/home/user/julia/deps/Rmath/src'
Makefile:421: recipe for target `Rmath/src/libRmath.dll' failed
make: *** [Rmath/src/libRmath.dll] Error 2

It does seem to include the USRLIB directory... are you sure that "-lrandom" will pick up "librandom.dll"? Or, do you know where all it will look (current folder, path, etc)?

As for additional packages... unfortunately I was far from scientific in my installing. Also, because there are a million choices of cygwin packages to install everyone is going to have different requirements. Later I'll probably have to build on a different windows machine, what I'll do is start with a bare bones cygwin install and then include packages one by one (then post somewhere).

@vtjnash
Copy link
Collaborator

vtjnash commented Sep 28, 2012

Yes, -lxxx is supposed to search for libxxx.dll. There's no way AFAIK to get the compiler to spew a list of its search directories. However, the -L flag is adding the proper directory to the search path.

If you do nm librandom.dll in the USRLIB directory, you can see if that dll is broken or empty (sometimes happens if the build got interrupted in the wrong place). It should spew a bunch of symbol names and addresses.

(note: if you enclose code in triple back ticks (the key to the left of the 1) followed by a newline, you can make code output more readable)

@WestleyArgentum
Copy link
Author

I didn't know about nm, that's pretty cool.

So, I thought I had but I guess I forgot to test changing:

-L$(USRLIB)

To:

-L"C:/cygwin/home/user/julia/usr/lib"

Now I get:

cd Rmath/src && \
make CC="gcc" && \
true -ignorelibRmath.dll libRmath.dll
make[1]: Entering directory `/home/user/julia/deps/Rmath/src'
make[1]: Nothing to be done for `default'.
make[1]: Leaving directory `/home/user/julia/deps/Rmath/src'
make -C openlibm ARCH=i386
make[1]: Entering directory `/home/user/julia/deps/openlibm'
    CC src/e_acos.c.o
src/e_acos.c:14:26: fatal error: cdefs-compat.h: No such file or directory
compilation terminated.
Make.inc:9: recipe for target `src/e_acos.c.o' failed
make[1]: *** [src/e_acos.c.o] Error 1
make[1]: Leaving directory `/home/user/julia/deps/openlibm'
Makefile:292: recipe for target `openlibm/libopenlibm.dll' failed
make: *** [openlibm/libopenlibm.dll] Error 2

So... even closer, but still not quite :/
This error seems to simply be another problem with finding files... maybe even another / \ thing. I don't see cdefs-compat.h in the openlibm dir right off... I'll look more in the morning, thanks for your help so far.

@WestleyArgentum
Copy link
Author

Hey! I'm now very close.

Several errors have just been variations of a problem where calls to "abspath" in a windows command prompt return paths with 's and need to be converted to /'s. I've patched over the problems by hard-coding the paths but I'm sure there's a way to conditionally calling some alternative to "abspath" that will contain /'s. I'll look more at that when I've got this working.

Right now I'm down to the "make extras" step in the root makefile (almost done). The problem I'm having is strange...

The commands of interest are in the makefile inside julia/deps/glpk-4.47/src

The output is simply:

.deps/adler32.Plo:1: *** multiple target patterns.  Stop.

No matter what I do... I can't even "make clean" because it thinks there are multiple targets...
Online I've seen people suggest that the problem has to do with :'s getting in either via windows paths or errors in the output. I think that perhaps that is part of the problem because I just fixed a problem with a pearl script run by julia/extras/Makefile that was dumping things with :'s (the problem was that GLPK_PREFIX was being set to a path relative to a cygwin or mingw terminal root and not c:/)... but I'm not sure what else to change on that front.

The other thing that I've seen is the suggestion that the wrong "link" is being executed so I've also tried putting mingw and cygwin ahead of window's stuff in the path...

Do you see anything in that Makefile? And is that something I should be changing anyway (is it a packaged part of glpk)?

@vtjnash
Copy link
Collaborator

vtjnash commented Sep 28, 2012

OK, I did a little more searching and I don't think / vs \ shouldn't matter, but C:/cygwin/home vs /home apparently does.

That include file is in deps/openlibm/include and should be included with -I (upper case i)

You may have success adding in adding -W to invocations of pwd, I'm not sure what the analog for abspath would be though

I can take a look into GLPK when I have more time later.

@WestleyArgentum
Copy link
Author

Have you guys made changes to GLPK? What would happen if I just used their binaries?

@vtjnash
Copy link
Collaborator

vtjnash commented Sep 30, 2012

You can just use their binaries. Setting USE_SYSTEM_GLPK=1 in make will prevent julia from building its own. (this is actually true of most of the items in deps -- the complete list can be found in Make.inc)

@vtjnash
Copy link
Collaborator

vtjnash commented Oct 15, 2012

Do you have any updates, or can I close this issue so that it can be recreated later given more specific build errors?

@Keno
Copy link
Owner

Keno commented Jan 8, 2013

Works for me!

@Keno Keno closed this as completed Jan 8, 2013
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

No branches or pull requests

3 participants