Problem when building sage on cygwin - Error building package python2-2.7.14.p2

178 views
Skip to first unread message

ערן אסף

unread,
Feb 6, 2018, 10:00:47 AM2/6/18
to sage-devel
Hi,
I have a 64-bit windows 10 Pro operating system running on a single (Intel) processor PC. 
In order to develop for sage on it, I have installed cygwin with all required packages - 
gcc, make, m4, perl, binutils, python, git, perl-ExtUtils-MakeMaker, openssl, openssl-devel, texlive, tk, tk-dev, openssh, lapack, lapack-devel

Then I cloned the source code, checked out, and ran the make command.
When building python, I got the following error message:
Python build finished, but the necessary bits to build these modules were not found:
_bsddb                               _curses                                  _curses_panel
_tkinter                              bsddb185                               dl
imageop                            linuxaudiodev                         nis
ossaudiodev                      spwd                                      sunaudiodev
 To find the necessary bits, look in setup.py in detect_modules() for the module's name.
 Failed to build these modules:
crypt

and a request to post here the problem and the log file, which I do.

I have checked that from python shell, import crypt works, and the method crypt.crypt works well.

Any help will be appreciated,
Thank you,
Eran
python2-2.7.14.p2.log

Dima Pasechnik

unread,
Feb 6, 2018, 11:59:21 AM2/6/18
to sage-devel
the error is certainly here:

building 'crypt' extension
...
gcc -shared -Wl,--enable-auto-image-base -L. -L/home/Erana/sage/local/lib -Wl,-rpath,/home/Erana/sage/local/lib -L. -L/home/Erana/sage/local/lib -Wl,-rpath,/home/Erana/sage/local/lib build/temp.cygwin-2.10.0-x86_64-2.7/home/Erana/sage/local/var/tmp/sage/build/python2-2.7.14.p2/src/Modules/cryptmodule.o -L/home/Erana/sage/local/lib -L/usr/local/lib -L. -L. -lpython2.7 -o build/lib.cygwin-2.10.0-x86_64-2.7/crypt.dll
build/temp.cygwin-2.10.0-x86_64-2.7/home/Erana/sage/local/var/tmp/sage/build/python2-2.7.14.p2/src/Modules/cryptmodule.o: In function `crypt_crypt':
/home/Erana/sage/local/var/tmp/sage/build/python2-2.7.14.p2/src/Modules/cryptmodule.c:27: undefined reference to `crypt'
/home/Erana/sage/local/var/tmp/sage/build/python2-2.7.14.p2/src/Modules/cryptmodule.c:27:(.text+0x30): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `crypt'
collect2: error: ld returned 1 exit status


Comparing with the log for Linux:

gcc -pthread -shared -L. -L/home/dima/Sage/sage-dev/local/lib -Wl,-rpath,/home/dima/Sage/sage-dev/local/lib -L. -L/home/dima/Sage/sage-dev/local/lib -Wl,-rpath
,/home/dima/Sage/sage-dev/local/lib build/temp.linux-x86_64-2.7/home/dima/Sage/sage-dev/local/var/tmp/sage/build/python2-2.7.14.p2/src/Modules/cryptmodule.o -L
/home/dima/Sage/sage-dev/local/lib -L/usr/local/lib -L. -lcrypt -lpython2.7 -o build/lib.linux-x86_64-2.7/crypt.so

I see that -lcrypt is missing in your case. I don't know why...

Samuel Lelievre

unread,
Feb 6, 2018, 6:32:41 PM2/6/18
to sage-devel
Hi Eran,

Sage's Trac has a wiki page about building SageMath in 64-bit Cygwin:


(maybe you knew that already).

Another way to go about building SageMath under Windows 10
is to activate the "Windows Subsystem for Linux" (you need to
go to advanced preferences for that), which lets you install any
of a selection of flavours of Linux right inside Windows.

If you choose to install Ubuntu this way inside your Windows,
you can then apt-get install lots of things (including SageMath).

No report of successfully *buildling* SageMath in that environment
has come to my eyes so far, but it would be good news if it works.

Samuel

Erik Bray

unread,
Feb 7, 2018, 1:37:24 PM2/7/18
to sage-devel
On Tue, Feb 6, 2018 at 3:50 PM, ערן אסף <assa...@gmail.com> wrote:
> Hi,
> I have a 64-bit windows 10 Pro operating system running on a single (Intel)
> processor PC.
> In order to develop for sage on it, I have installed cygwin with all
> required packages -
> gcc, make, m4, perl, binutils, python, git, perl-ExtUtils-MakeMaker,
> openssl, openssl-devel, texlive, tk, tk-dev, openssh, lapack, lapack-devel
>
> Then I cloned the source code, checked out, and ran the make command.
> When building python, I got the following error message:
> Python build finished, but the necessary bits to build these modules were
> not found:
> _bsddb _curses
> _curses_panel
> _tkinter bsddb185
> dl
> imageop linuxaudiodev nis
> ossaudiodev spwd
> sunaudiodev
> To find the necessary bits, look in setup.py in detect_modules() for the
> module's name.
> Failed to build these modules:
> crypt

You need libcrypt-devel. See https://trac.sagemath.org/wiki/Cygwin64Port

Let me know if you run into any other problems.

Best,
E

ערן אסף

unread,
Feb 8, 2018, 7:55:19 AM2/8/18
to sage-devel
Hi,
I have looked in https://trac.sagemath.org/wiki/Cygwin64Port and also installed libcrypt-devel, and now have a problem with another library.
This happens on both the develop branch and on your develop-cygwin branch.
The error seems to be:
BoolePolyRing.cc:129:18: error: 'LINE_MAX' was not declared in this scope
                                                    char str_buf[LINE_MAX];
Thanks,
Eran


בתאריך יום רביעי, 7 בפברואר 2018 בשעה 20:37:24 UTC+2, מאת Erik Bray:
brial-1.0.1.p2.log

Erik Bray

unread,
Feb 12, 2018, 6:15:23 AM2/12/18
to sage-devel
On Thu, Feb 8, 2018 at 1:55 PM, ערן אסף <assa...@gmail.com> wrote:
> Hi,
> I have looked in https://trac.sagemath.org/wiki/Cygwin64Port and also
> installed libcrypt-devel, and now have a problem with another library.
> This happens on both the develop branch and on your develop-cygwin branch.
> The error seems to be:
> BoolePolyRing.cc:129:18: error: 'LINE_MAX' was not declared in this scope
> char str_buf[LINE_MAX];

I'm not sure... LINE_MAX is defined in limits.h, which you should
have (/usr/include/limits.h).
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+...@googlegroups.com.
> To post to this group, send email to sage-...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

ערן אסף

unread,
Feb 13, 2018, 2:46:31 AM2/13/18
to sage-...@googlegroups.com
Ok, I figured it out after some debugging.
It turns out that /usr/include/limits.h defines LINE_MAX only if __POSIX_VISIBLE is at least 2. 
In cygwin, when one compiles using the flag -std=c++XX (here XX is any number, in our case 11), __POSIX_VISIBLE is set to 0.
This is solved throughout most of the sage installation by using -std=gnu++11 (e.g. see setup.py).
However, in the brial library, the makefile explicitly adds -std=c++11, which causes this error.

Thank you very much for your assistance,
Eran


> To post to this group, send email to sage-...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/iMN3N7pqrq8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+unsubscribe@googlegroups.com.

Erik Bray

unread,
Feb 27, 2018, 11:44:58 AM2/27/18
to sage-devel
On Tue, Feb 13, 2018 at 8:46 AM, ערן אסף <assa...@gmail.com> wrote:
> Ok, I figured it out after some debugging.
> It turns out that /usr/include/limits.h defines LINE_MAX only if
> __POSIX_VISIBLE is at least 2.
> In cygwin, when one compiles using the flag -std=c++XX (here XX is any
> number, in our case 11), __POSIX_VISIBLE is set to 0.
> This is solved throughout most of the sage installation by using
> -std=gnu++11 (e.g. see setup.py).
> However, in the brial library, the makefile explicitly adds -std=c++11,
> which causes this error.
>
> Thank you very much for your assistance,

Thanks for the update on that. As you noted, this problem has come up
before and most modules are compiled on Cygwin using -std=gnu++XX
where applicable. But clearly Brial is not. It's strange though
because I should be able to reproduce the problem, but I can't. Maybe
I'm using a newer Cygwin (or an older one?) that doesn't happen to run
into this specific problem. Nevertheless this should probably be
fixed...
>> > email to sage-devel+...@googlegroups.com.
>> > To post to this group, send email to sage-...@googlegroups.com.
>> > Visit this group at https://groups.google.com/group/sage-devel.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "sage-devel" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/sage-devel/iMN3N7pqrq8/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> sage-devel+...@googlegroups.com.
>> To post to this group, send email to sage-...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/sage-devel.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+...@googlegroups.com.

Erik Bray

unread,
Feb 27, 2018, 12:11:21 PM2/27/18
to sage-devel
On Tue, Feb 27, 2018 at 5:44 PM, Erik Bray <erik....@gmail.com> wrote:
> On Tue, Feb 13, 2018 at 8:46 AM, ערן אסף <assa...@gmail.com> wrote:
>> Ok, I figured it out after some debugging.
>> It turns out that /usr/include/limits.h defines LINE_MAX only if
>> __POSIX_VISIBLE is at least 2.
>> In cygwin, when one compiles using the flag -std=c++XX (here XX is any
>> number, in our case 11), __POSIX_VISIBLE is set to 0.
>> This is solved throughout most of the sage installation by using
>> -std=gnu++11 (e.g. see setup.py).
>> However, in the brial library, the makefile explicitly adds -std=c++11,
>> which causes this error.
>>
>> Thank you very much for your assistance,
>
> Thanks for the update on that. As you noted, this problem has come up
> before and most modules are compiled on Cygwin using -std=gnu++XX
> where applicable. But clearly Brial is not. It's strange though
> because I should be able to reproduce the problem, but I can't. Maybe
> I'm using a newer Cygwin (or an older one?) that doesn't happen to run
> into this specific problem. Nevertheless this should probably be
> fixed...

From the look of things this feature test was added to the limits.h
header relatively recently (November 2017) so indeed, I don't even
have that update yet on my Cygwin install. Since this is the case in
newer versions we should definitely fix it.

ערן אסף

unread,
Feb 27, 2018, 4:10:25 PM2/27/18
to sage-...@googlegroups.com
Great. Glad that I could be of assistance.
Should I open a ticket for this bug somewhere?


>>> > To post to this group, send email to sage-...@googlegroups.com.
>>> > Visit this group at https://groups.google.com/group/sage-devel.
>>> > For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "sage-devel" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/sage-devel/iMN3N7pqrq8/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to

>>> To post to this group, send email to sage-...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/sage-devel.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sage-devel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an

>> To post to this group, send email to sage-...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/sage-devel.
>> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "sage-devel" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-devel/iMN3N7pqrq8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-devel+unsubscribe@googlegroups.com.

Erik Bray

unread,
Mar 2, 2018, 6:18:49 AM3/2/18
to sage-devel
Reply all
Reply to author
Forward
0 new messages