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

Undefined References to rand_r while installing #914

Closed
ghost opened this issue May 19, 2014 · 9 comments
Closed

Undefined References to rand_r while installing #914

ghost opened this issue May 19, 2014 · 9 comments

Comments

@ghost
Copy link

ghost commented May 19, 2014

Hi,
I am trying to install pylearn2 in windows (Anaconda community edition precisely). The installation breaks while running setup.py develop stating reason as undefined references to rand_r . Is this a known issue with windows/Anaconda or some bug ?
Here is the stacktrace :
C:\mywares\Anaconda\MinGW\bin\gcc.exe -DMS_WIN64 -shared -s build\temp.win-amd64-2.7\Release\pylearn2\utils_window_flip.o build\temp.win-amd64-2.7\Release\pylearn2\utils_window_flip.def -LC:\mywares\Anaconda\libs -LC:\mywares\Anaconda\PCbuild\amd64 -lpython27 -lmsvcr90 -o C:\Users\sony\Downloads\pylearn2-master\pylearn2-master\pylearn2\utils_window_flip.pyd
build\temp.win-amd64-2.7\Release\pylearn2\utils_window_flip.o:_window_flip.c:(.
text+0x598a): undefined reference to rand_r' build\temp.win-amd64-2.7\Release\pylearn2\utils\_window_flip.o:_window_flip.c:(. text+0x59ae): undefined reference torand_r'
build\temp.win-amd64-2.7\Release\pylearn2\utils_window_flip.o:_window_flip.c:(.
text+0x59d4): undefined reference to rand_r' build\temp.win-amd64-2.7\Release\pylearn2\utils\_window_flip.o:_window_flip.c:(. text+0x77a7): undefined reference torand_r'
build\temp.win-amd64-2.7\Release\pylearn2\utils_window_flip.o:_window_flip.c:(.
text+0x77d4): undefined reference to rand_r' build\temp.win-amd64-2.7\Release\pylearn2\utils\_window_flip.o:_window_flip.c:(. text+0x77fc): more undefined references torand_r' follow
collect2.exe: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

@dwf
Copy link
Contributor

dwf commented May 19, 2014

Looks like rand_r isn't supported on Windows, because Microsoft views
standards as gentle suggestions.
On May 19, 2014 12:51 AM, "muktabhmayank" [email protected] wrote:

Hi,
I am trying to install pylearn2 in windows (Anaconda community edition
precisely). The installation breaks while running setup.py develop stating
reason as undefined references to rand_r . Is this a known issue with
windows/Anaconda or some bug ?
Here is the stacktrace :
C:\mywares\Anaconda\MinGW\bin\gcc.exe -DMS_WIN64 -shared -s
build\temp.win-amd64-2.7\Release\pylearn2\utils_window_flip.o
build\temp.win-amd64-2.7\Release\pylearn2\utils_window_flip.def
-LC:\mywares\Anaconda\libs -LC:\mywares\Anaconda\PCbuild\amd64 -lpython27
-lmsvcr90 -o
C:\Users\sony\Downloads\pylearn2-master\pylearn2-master\pylearn2\utils_window_flip.pyd

build\temp.win-amd64-2.7\Release\pylearn2\utils_window_flip.o:_window_flip.c:(.
text+0x598a): undefined reference to rand_r'

build\temp.win-amd64-2.7\Release\pylearn2\utils_window_flip.o:_window_flip.c:(.
text+0x59ae): undefined reference torand_r'

build\temp.win-amd64-2.7\Release\pylearn2\utils_window_flip.o:_window_flip.c:(.
text+0x59d4): undefined reference to rand_r'

build\temp.win-amd64-2.7\Release\pylearn2\utils_window_flip.o:_window_flip.c:(.
text+0x77a7): undefined reference torand_r'

build\temp.win-amd64-2.7\Release\pylearn2\utils_window_flip.o:_window_flip.c:(.
text+0x77d4): undefined reference to rand_r'

build\temp.win-amd64-2.7\Release\pylearn2\utils_window_flip.o:_window_flip.c:(.
text+0x77fc): more undefined references torand_r' follow
collect2.exe: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1


Reply to this email directly or view it on GitHubhttps://github.com//issues/914
.

@lamblin
Copy link
Member

lamblin commented Aug 27, 2014

If someone is willing to implement one of the solutions in http://stackoverflow.com/questions/18454814/rand-r-not-in-scope-gcc-mingw-under-cygwin-on-windows for instance, please submit a PR or re-open this ticket.

@lamblin lamblin closed this as completed Aug 27, 2014
@nouiz
Copy link
Member

nouiz commented Aug 27, 2014

This was done at the top of this file:

pylearn2/utils/_window_flip.pyx

On Wed, Aug 27, 2014 at 2:42 PM, Pascal Lamblin [email protected]
wrote:

Closed #914 #914.


Reply to this email directly or view it on GitHub
#914 (comment).

@dwf
Copy link
Contributor

dwf commented Aug 27, 2014

If I recall correctly it now builds on Windows, and uses rand(). So,
Windows users get something that works but isn't deterministic, and are
warned of this fact.

@nouiz
Copy link
Member

nouiz commented Aug 27, 2014

You are correct. I check the code before doing my comment and this is what
happen.

On Wed, Aug 27, 2014 at 2:46 PM, David Warde-Farley <
[email protected]> wrote:

If I recall correctly it now builds on Windows, and uses rand(). So,
Windows users get something that works but isn't deterministic, and are
warned of this fact.


Reply to this email directly or view it on GitHub
#914 (comment).

@lamblin
Copy link
Member

lamblin commented Aug 28, 2014

OK, great!

@icoxfog417
Copy link
Contributor

On Python3, we need to add 'u'.

  • Fail(cause rand_r is missing error).
IF UNAME_SYSNAME == "Windows":
  • Success
IF UNAME_SYSNAME == u"Windows":

see also Python 3.3 + Cython 20.1 build failure and Pull #949

@eyaler
Copy link

eyaler commented Apr 9, 2015

I just ran in to this issue with python 3 and needed to apply the fix in the above comment. should we open a new issue for this?

@lamblin
Copy link
Member

lamblin commented Apr 9, 2015

Yes, a new issue would be a good idea.
Or, if that solution also works on Python 2.6, then a pull request implementing that would be even better :)

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

5 participants