Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#45152 closed submission (fixed)

pure-reduce @0.4: new port submission

Reported by: agraef (Albert Graef) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.3.1
Keywords: Cc: jacobsonclas@…
Port: pure-reduce

Description

Another Pure module that isn't in MacPorts yet. This one integrates Pure with the Reduce computer algebra system.

Attachments (4)

Portfile (1.5 KB) - added by agraef (Albert Graef) 10 years ago.
pure-reduce Portfile
make.diff (1.8 KB) - added by agraef (Albert Graef) 10 years ago.
Makefile patch
Portfile.2 (1.5 KB) - added by ryandesign (Ryan Carsten Schmidt) 10 years ago.
main.2.log (62.8 KB) - added by ryandesign (Ryan Carsten Schmidt) 10 years ago.

Download all attachments as: .zip

Change History (21)

Changed 10 years ago by agraef (Albert Graef)

Attachment: Portfile added

pure-reduce Portfile

Changed 10 years ago by agraef (Albert Graef)

Attachment: make.diff added

Makefile patch

comment:1 Changed 10 years ago by agraef (Albert Graef)

Ryan, it would be nice if you could have a look at whether I handled the multiple distribution tarballs correctly. pure-reduce.tar.gz is the primary source, reduce-algebra-csl-r2204.tar.bz2 is a trimmed-down snapshot from the Reduce repository I provide at the Pure website. The latter extracts into reduce-algebra which needs to be linked into the pure-reduce folder. Since I couldn't find any specific capability in MacPorts for that, I simply added the command ln -sf ../reduce-algebra . to the build.cmd, but maybe there's a better way to do that?

comment:2 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… removed
Owner: changed from macports-tickets@… to ryandesign@…
Status: newassigned

Can pure-reduce not use the existing reduce-algebra port already in MacPorts?

Is there a reason why you're specifying configure.cflags-append -O2? Does the -Os optimization level MacPorts uses by default not work for this port?

Last edited 10 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:3 in reply to:  2 ; Changed 10 years ago by agraef (Albert Graef)

Replying to ryandesign@…:

Can pure-reduce not use the existing reduce-algebra port already in MacPorts?

No, it uses a much newer revision of reduce-algebra, and a variant based on CSL rather than PSL. That's the combination that I found works best for the purposes of the pure-reduce module. In fact, I'm using this specific revision r2204 of reduce-algebra since I found that later versions failed to compile or were broken in some other ways.

Also, I need to build reduce-algebra as a dynamic library so that I can link it into the pure-reduce module. I use a custom build process for that which requires the relevant parts of the reduce-algebra sources (basically the "embedded" CSL version of Reduce and its "procedural interface") to be available during the build. The reduce-algebra module doesn't provide this, it only offers an executable.

BTW, I can't even make the reduce-algebra port to run. This is all that I get:

$ redpsl
Failed to find a version of bpsl that you have built
try ./configure --with-psl; make to build one.

Is there a reason why you're specifying configure.cflags-append -O2? Does the -Os optimization level MacPorts uses by default not work for this port?

No, -Os will probably work fine with clang. That port was done before I actually measured the performance of clang-generated code with -Os.

comment:4 in reply to:  3 Changed 10 years ago by agraef (Albert Graef)

Replying to aggraef@…:

BTW, I can't even make the reduce-algebra port to run. This is all that I get:

As an aside, a full Reduce build is really a pita if you don't know what to build and where. I actually installed it once from source, including the graphical interface. Reduce is showing its age, but it's very powerful and works fine with a modern interface like pure-reduce+pure-texmacs slapped onto it. In fact I'd say that the pure-reduce+pure-texmacs combo offers a much nicer interface to Reduce than Reduce itself. ;-) See a screenshot here: https://bitbucket.org/purelang/pure-lang/wiki/TeXmacs

Last edited 10 years ago by agraef (Albert Graef) (previous) (diff)

comment:5 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Ok. Then to the remaining issues:

MacPorts does provide an ln procedure which works similarly to the shell command of the same name. In this case, invoking it in a post-extract block would be reasonable.

The other problem is that you've specified both a tar.gz distfile and a tar.bz2 distfile. MacPorts is currently not designed to be able to extract multiple distfiles unless they are all of the same type. So the fact that this is getting past the extract phase at all is surprising, and seems to indicate that /usr/bin/gzip at some point gained the ability to understand bz2 files. I'm not sure in which version of OS X gzip gained that ability, but we should handle this as if gzip only understood gz files, and manually extract the reduce tarball in a post-extract block. That would also give us the opportunity to extract it directly into the pure directory, avoiding the need to make a symlink.

I'll work on this.

Last edited 10 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:6 in reply to:  5 Changed 10 years ago by agraef (Albert Graef)

Replying to ryandesign@…:

MacPorts does provide an ln procedure which works similarly to the shell command of the same name. In this case, invoking it in a post-extract block would be reasonable.

Great. I imagined that there must be some official way to do this but couldn't find it in the docs.

I'm not sure in which version of OS X gzip gained that ability, but we should handle this as if gzip only understood gz files, and manually extract the reduce tarball in a post-extract block. That would also give us the opportunity to extract it directly into the pure directory, avoiding the need to make a symlink.

Seems like a good idea! But I can also repackage the tarball as a .tar.gz and upload that if it makes things easier. Just let me know.

comment:7 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Oh no, I prefer smaller distfiles, and it's no problem to manually extract it.

comment:8 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

The build fails:

gcc -Os -arch x86_64 -c -o arith01.o ../../cslbase/arith01.c
In file included from ../../cslbase/arith01.c:45:
In file included from ../../cslbase/headers.h:120:
../../cslbase/tags.h:54:2: error: This system needs a 32-bit integer type.
#error This system needs a 32-bit integer type.
 ^
1 error generated.

Also, it's using a hardcoded gcc for the compiler instead of UsingTheRightCompiler. That can be fixed by adding:

build.args                      CC="${configure.cc}"

but it doesn't change the error.

I'll attach my Portfile in progress.

Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: Portfile.2 added

comment:9 Changed 10 years ago by agraef (Albert Graef)

Replying to aggraef@…:

In fact I'd say that the pure-reduce+pure-texmacs combo offers a much nicer interface to Reduce than Reduce itself. ;-) See a screenshot here: https://bitbucket.org/purelang/pure-lang/wiki/TeXmacs

NB: We should really see whether we can make the latest TeXmacs work in MacPorts and then add the Pure TeXmacs plugin to the Pure port. It's very nice and is being used a lot by engineers. I actually have this working on my MacBook here, but it uses a recent binary TeXmacs package available from http://www.texmacs.org. The TeXmacs version currently in MacPorts is ancient and doesn't work for that (it lacks plugin support IIRC).

comment:10 in reply to:  8 Changed 10 years ago by agraef (Albert Graef)

Replying to ryandesign@…:

The build fails:

gcc -Os -arch x86_64 -c -o arith01.o ../../cslbase/arith01.c
In file included from ../../cslbase/arith01.c:45:
In file included from ../../cslbase/headers.h:120:
../../cslbase/tags.h:54:2: error: This system needs a 32-bit integer type.
#error This system needs a 32-bit integer type.
 ^
1 error generated.

I'm pretty sure that I had that fixed. Are you sure that you applied the patch that I attached?

comment:11 Changed 10 years ago by agraef (Albert Graef)

No, I think you missed that line in your portfile:

patchfiles-append               make.diff

comment:12 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Sorry, I omitted the patch because I thought it only dealt with supplying extra CFLAGS, which we decided above we didn't need to do. I'll look at it again.

comment:13 Changed 10 years ago by agraef (Albert Graef)

Yes, it's definitely needed because the original Makefile doesn't separate the EXTRA_CFLAGS. Without those the Reduce stuff doesn't compile at all.

Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: main.2.log added

comment:14 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: assignedclosed

Ok, I see the patch makes the Makefile honor CFLAGS passed to it, which is needed here. So that works.

I'm getting an intermittent build failure, which I think is a parallel build problem caused by inaccurate dependencies in the Makefile. I committed the port in r125733 with parallel building turned off for now.

I've attached a log of the failure. The error is:

:info:build ld: can't write output file: reduce for architecture x86_64
:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)

The log shows multiple occurrences of this line:

cp ../reduce.img .

including some after the failure. In fact, when I built with 14 parallel jobs, the log contained 14 invocations of that command.

I'm assuming that the build needs that file, and that at the moment when the failure occurs, it has just begun replacing the file again, resulting in it not being there at just the moment when it's needed.

comment:15 Changed 10 years ago by agraef (Albert Graef)

Yes, despite my best efforts I couldn't make the parallel build work either. It happens to work over here, but I've seen it failing. I don't really understand why, but the failures are in the Reduce/CSL Makefiles, and I'd rather not touch those. So turning off the parallel build seems the best option.

Thanks for committing the port! Can you please have a look at faust2pd et al (#45141) as well? That are basically the only missing pieces right now. (Well, there's also pure-lv2 and pure-lilv, but for that I need to port LV2 (3rd party software) first. I'll work on that asap.)

comment:16 in reply to:  15 ; Changed 9 years ago by jacobsonclas@…

Replying to aggraef@…:

Yes, despite my best efforts I couldn't make the parallel build work either. It happens to work over here, but I've seen it failing. I don't really understand why, but the failures are in the Reduce/CSL Makefiles, and I'd rather not touch those. So turning off the parallel build seems the best option.

Thanks for committing the port! Can you please have a look at faust2pd et al (#45141) as well? That are basically the only missing pieces right now. (Well, there's also pure-lv2 and pure-lilv, but for that I need to port LV2 (3rd party software) first. I'll work on that asap.)


This is not working for me - not sure why?

I installed reduce-pure and it worked fine.

I was following the notes on https://bitbucket.org/purelang/pure-lang/wiki/PureOnMacOSX#markdown-header-pure-and-texmacs

and did the first step fine - I can run Texmacs.

I did the second step - but here I put the two directories where I thought they should go - I put folder pure under plugins and the folder packages under contents.

Also thought pure is at

Class-MBP:~ clasajacobson$ which pure
/opt/local/bin/pure

a different location than on this page.

Then when I start up Texmacs there is no pure under session...

Something seems to be lost here or the pointers are wrong - some help?

Last edited 9 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:17 in reply to:  16 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: jacobsonclas@… added

Replying to jacobsonclas@…:

This is not working for me - not sure why?

This ticket is closed. For assistance using pure, you should write to the pure mailing list.

Note: See TracTickets for help on using tickets.