Coder Social home page Coder Social logo

agraef / pure-lang Goto Github PK

View Code? Open in Web Editor NEW
310.0 14.0 20.0 22.21 MB

Pure programming language

Home Page: https://agraef.github.io/pure-lang/

Makefile 4.10% C++ 33.05% C 28.84% Emacs Lisp 2.10% Shell 0.62% Awk 0.92% Haskell 6.70% Roff 0.46% Tcl 19.63% HTML 0.58% XSLT 0.03% M4 0.91% Python 0.62% ATS 0.19% Fortran 0.03% TypeScript 0.08% Scheme 0.59% Clarion 0.29% CSS 0.21% TeX 0.06%
functional-programming term-rewriting scripting-language llvm jit-compiler

pure-lang's Introduction

The Pure Programming Language

Pure is a modern-style functional programming language based on term rewriting. It offers equational definitions with pattern matching, full symbolic rewriting capabilities, dynamic typing, eager and lazy evaluation, lexical closures, built-in list and matrix support and an easy-to-use C interface. The interpreter uses LLVM as a backend to JIT-compile Pure programs to fast native code.

Please check our Github website for more information. The Pure Language and Library Documentation is available in html and pdf format. A very complete and up-to-date collection of packages for Arch Linux are available from the Arch User Repositories, please also check our Pure on Arch Linux wiki page for details. We also offer a reasonably complete set of Ubuntu packages at Launchpad. Instructions for installing Pure on the Mac and Windows can be found on the Pure on Mac OS X and Pure on Windows wiki pages. Source packages can be found on the Download page. Please also have a look at our mailing list / Google group and IRC chat (#pure-lang on freenode) if you need any help or if you want to discuss Pure.

Please also check my personal Github site for some fun side projects that I've written in or for Pure (mostly about computer music and multimedia).

Albert Gräf [email protected]

Enjoy. :)

pure-lang's People

Contributors

agraef avatar asppsa avatar eddierucker avatar jspitz-git avatar liborty avatar roman-neuhauser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pure-lang's Issues

The printed output of exp(1e-15) does not correspond to the actual value

I did the following experiments in the CLI (version 0.68 running on Linux):

> using math;
> exp(1e-14);
1.00000000000001
> exp(1e-15);
1.0
> exp(1e-15) - 1;
1.11022302462516e-15
> 1.000000000000001-1;
1.11022302462516e-15
> exp(1e-16) - 1;
0.0

As can be seen, exp(1e-15) prints 1.0, but in reality the value returned is 1.000000000000001. This is important because 1.0 means that the argument of the exponential is less than or equal to the machine epsilon. The rounding results from using floating-point arithmetic with 64 bits. The spurious rounding shown above is misleading.

Suggestion: distribute fully-dockerized builds

I gave a couple of hours to trying to build (failed due to syntax error in configure after autoconf configure.ac), then trying to install (failed due to 'broken packages held; see issue #26). I had to give up, as either of these ways to get pure-lang are now blocked for me. I was motivated by looking for a free alternative to Mathematica, but only had a couple of hours to try to get it going.

It occurred to me that others may experience the same problems, and that a solution would be a fully self-contained docker container that can run on any operating system. It might also be less work for you because you'll only have to support one build!

Highlight advantages over other functional programming languages

Having experience with Mathematica, I can completely understand why term rewriting rocks for computer algebra systems. But for mundane programming tasks, like JSON or CSV data processing, why would one choose Pure over e.g. Haskell, OCaml or Ruby/Python/JavaScript? I think if you clearly explain somewhere in README why programming in Pure can be more fun than in most other languages due to term rewriting, with examples, you'll get a lot more interest in your project.

I didn't check all of the examples you have. Maybe you can point to ones where term rewriting allows for the most expressive code?

Problem installing LV2 package

I'm trying to follow the instructions on https://agraef.github.io/pure-docs/pure-lv2.html

To install the library for building LV2 plugins.

But I'm getting this error :

Perhaps you should add the directory containing `pure.pc' to the PKG_CONFIG_PATH environment variable
No package 'pure' found`

repeated several times.

The archive at https://bitbucket.org/purelang/pure-lang/downloads/pure-lv2-0.2.tar.gz doesn't seemt to contain a file pure.pc.

I'm on Ubuntu and installed Pure using the .deb package as instructed here : https://github.com/agraef/pure-lang/wiki/PureOnDebian

I'm guessing the debian package doesn't contain some build dependencies for the LV2 plugins? Am I basically right but missing something? Or should I do this a completely different way?

cabal: unrecognised command: v1-update, Maybe you meant `v2-update`?

I'm trying to update pure-gen in MacPorts from 0.21 to 0.25. Since the last time I touched the pure-gen port, the ghc situation in MacPorts has completely changed so I'm trying to adapt the Portfile as needed. The ghc version in MacPorts is 9.2.1 and the cabal version is 3.6.2.0. The error I get when building pure-gen is:

cabal: unrecognised command: v1-update (try --help)
Maybe you meant `v2-update`?

I don't know anything about cabal so I don't know if I can simply replace v1-update with v2-update. Presumably they are not completely compatible with one another else they would not have renamed the command.

Can turn off JIT?

Is there any way to completely prevent JIT compilation and only run Pure programs in interpreter/virtual machine mode?

Extend the hello world examples in the manual

As pointed out by Brian Tiffin on the mailing list, the "Hello, world" section of the manual should have some information about how to use puts (or printf) and str to print arbitrary Pure data in scripts running in batch mode, which is a rather common scenario for beginners coming from compiled languages such as C.

TeXmacs (option/plugin)

The '--texmacs' option does not work, and consequently the plugin doesn't either. Moreover,
the TeXmacs *.deb packages (https://texmacs.org/tmweb/download/linux-packages.en.html#ubuntu) now install to '/usr/local/share/TeXmacs/', whereas the plugin goes to
'/usr/share/texmacs/TeXmacs/'. When asked, I recommended to compile/install both, Pure as well as TeXmacs, by hand ;)

kfp@sirius:~$ apt show pure
Package: pure
Version: 0.68-2
Priority: extra
Section: devel
Maintainer: Albert Graef [email protected]
Installed-Size: 568 kB
Depends: libpure8 (= 0.68-2), libc6 (>= 2.33), libgcc-s1 (>= 3.0), libllvm3.5v5, libreadline8 (>= 6.0), libstdc++6 (>= 5.2)
Suggests: pure-dev, pure-elisp, pure-docs
Homepage: https://agraef.github.io/pure-lang
Download-Size: 162 kB
APT-Manual-Installed: yes
APT-Sources: http://download.opensuse.org/repositories/home:aggraef:pure/xUbuntu_21.04 Packages

kfp@sirius:~$ apt show pure-texmacs
Package: pure-texmacs
Version: 0.68-2
Priority: extra
Section: devel
Source: pure
Maintainer: Albert Graef [email protected]
Installed-Size: 1’274 kB
Depends: pure (>= 0.68-2)
Homepage: https://agraef.github.io/pure-lang
Download-Size: 82.3 kB
APT-Manual-Installed: yes
APT-Sources: http://download.opensuse.org/repositories/home:aggraef:pure/xUbuntu_21.04 Packages

pure-lang gnumeric package.

The pure-gnumeric library fails to compile with the following error:
pure-loader/pure-gnumeric.c:1589:26: error: ‘GocGroup’ {aka ‘struct _GocGroup’} has no member named ‘children’; did you mean ‘Xchildren’?
1589 | return GOC_ITEM(group->children->data);

I had used the following make command:
make --include-dir=-I/usr/lib/gnumeric/1.12.51 all
There doesnot seem to be any place where the GocGroup structure is defined. May be a mistake on my part. But any suggestion will be appreciated.

pure-gen build breaks with language-c-0.6.1

Work around was cabal install 'language-c < 0.5.1' (to get 0.5.0) and a ghc-pkg unregister --force language-c-0.6.1

After that, make inside pure-gen completed without issue.

Port Pure to the MCJIT in order to support LLVM 3.6+

We have to do this some time real soon now, as Linux distributions are beginning to phase out LLVM 3.5. Also, clang 3.5 isn't supported by MacPorts on current macOS systems any more, while LLVM 3.5 still is.

The main problem here are the dynamic features of the Pure language, which allow a global function definition to be refined at any time. Last time I looked, MCJIT didn't allow to recompile individual functions on the fly, only modules. If it is still that way, it will require a substantial rewrite of the compiler backend (basically, every global Pure function will have to go into its own module and these will then have to be linked together; right now the entire Pure program is just a single LLVM module).

(Originally submitted 2015-02-28 by David Slate as BB #36.)

pure-gen compilation troubles

As discussed on the mailing list, this example from the pure-gen manual has stopped working:

rm -f mygsl.pure mygsl.c
DEFS=-DGSL_DISABLE_DEPRECATED
for x in /usr/include/gsl/gsl_*.h; do
  pure-gen $DEFS -N -fc-auto -s "$x::" $x -o mygsl.pure -c mygsl.c
done
gcc $DEFS -shared -o mygsl.so mygsl.c -lgsl

dump-ast generates a bunch of empty output warnings, and errors like:

dump-ast: /usr/include/bits/mathcalls-helper-functions.h:21: (column 40) [ERROR]  >>> Syntax Error !
  Syntax error !
  The symbol `__value' does not fit here.

CallStack (from HasCallStack):
  error, called at dump-ast.hs:27:17 in main:Main

It's always the same kind of error message, followed by a Haskell exception. Having the parser crash with a Haskell exception is not a good thing. ;-) That might also explain why so many empty output files are created.

The resulting code is also partially broken, apparently pure-gen mistakes long double* for double *:

$ gcc $DEFS -shared -o mygsl.so mygsl.c -lgsl
mygsl.c: In function ‘Pure_gsl_matrix_complex_long_double_const_view_array’:
mygsl.c:1181:57: warning: passing argument 1 of ‘gsl_matrix_complex_long_double_const_view_array’ from incompatible pointer type [-Wincompatible-pointer-types]
 1181 |   ret = gsl_matrix_complex_long_double_const_view_array(arg0, arg1, arg2); return &ret;
      |                                                         ^~~~
      |                                                         |
      |                                                         const double *

Always the same error again.

pure-docs mispackaging on Arch

The pure-docs Arch package from OBS installs the docs under /usr/local rather than /usr, so it looks like the installation prefix is not set properly in the PKGBUILD.

Faust bitcode interface broken

Symptom:

$ cd pure/examples/bitcode/
$ pure faust_examp.pure 
Segmentation fault (core dumped)

Segfault happens at line 52 in faust_examp.pure when calling the info method:

using faustui;
let k,l,ui = test::info dsp;

Looks like recent breakage in the Faust LLVM bitcode ABI, or maybe some change in the global meta data.

segfaults when trying to run pd-faust examples

Managed to compile & run the pd-faust/examples/synth.pd patch. However segfaults immediately after loading what_a_friend.pd or bouree.pd. Also segfault when attempting to change [faust~ organ] to [faust~ bass] in the synth.pd patch.

Are these known bugs or some problem with my toolchain/setup? the problems are observed on arch linux 64 bit intel cpu, with pd vanilla & faust.

Tried many combinations/permutations of compiling from source, aur packages w/ yaourt, but couldn't get examples fully working. Currently have my machine in a state where faust, pd, all the pure stuff including pd-faust installed from aur (since that seems like the most repeatable setup)

pure-reduce: add mpfr support

Extended precision values in Reduce should be converted to mpfr values in Pure land if the pure-mpfr module is installed.

(Originally submitted 2013-02-11 as BB #1.)

pure-mode for emacs?

Pure-mode for emacs is no longer available on marmalade or melpa. Maybe you could host it here?

pure-octave: clang: error: invalid argument '-bundle' not allowed with '-dynamiclib'

pure-octave 0.13 is failing to build in MacPorts at the moment, at least with octave 7.3.0 and pure 0.68 on macOS 12.3.1 and macOS 13.0.1, both on x86_64; here is a log from the latter:

https://build.macports.org/builders/ports-13_x86_64-builder/builds/18585/steps/install-port/logs/stdio

rm -f embed.o
mkoctfile -v -DOCTAVE_MAJOR=7 -DOCTAVE_MINOR=3 -o embed.o -c embed.cc
/usr/bin/clang++ -std=gnu++11 -c -I/opt/local/include -fPIC -I/opt/local/include/octave-7.3.0/octave/.. -I/opt/local/include/octave-7.3.0/octave -I/opt/local/include  -pthread -Os -stdlib=libc++ -arch x86_64    -DOCTAVE_MAJOR=7 -DOCTAVE_MINOR=3 embed.cc -o embed.o
mkoctfile: warning: LFLAGS is deprecated and will be removed in a future version of Octave, use LDFLAGS instead
mkoctfile: unknown variable 'RLD_FLAG'
rm -f octave_embed.dylib
/usr/bin/clang++ -std=gnu++11 -dynamiclib -install_name "/opt/local/lib/pure/octave_embed.dylib" -o octave_embed.dylib embed.o -L/opt/local/lib/octave/7.3.0 -L/opt/local/lib -bundle -undefined dynamic_lookup -bind_at_load -bundle_loader /opt/local/bin/octave-7.3.0 -loctinterp -loctave  -L/opt/local/lib/octave/7.3.0 -L/opt/local/lib -bundle -undefined dynamic_lookup -bind_at_load -bundle_loader /opt/local/bin/octave-7.3.0 -lpure 
clang: error: invalid argument '-bundle' not allowed with '-dynamiclib'
make: *** [octave_embed.dylib] Error 1

Indeed, you only want to use one of -bundle—which the comments in the pure-octave Makefile say you do not want:

# OS X quirk: mkoctfile wants to create a bundle, but we want just a
# dylib which can be linked into other modules.

—or -dynamiclib. The flags are coming from mkoctfile commands that the pure-octave Makefile is running:

  • -bundle is coming from:
% mkoctfile -p LFLAGS
mkoctfile: warning: LFLAGS is deprecated and will be removed in a future version of Octave, use LDFLAGS instead
-L/opt/local/lib/octave/7.3.0 -L/opt/local/lib -bundle -undefined dynamic_lookup -bind_at_load -bundle_loader /opt/local/bin/octave-7.3.0
  • -dynamiclib is coming from:
% pkg-config pure --variable shared   
-dynamiclib

Exception handling segfaults in the msys2/mingw64 build on Windows

msys2/mingw32 works all right. Failed tests with the mingw64 build:

$ make recheck
./run-tests -f
Running tests.
test011.pure: FAILED
test015.pure: FAILED
test020.pure: FAILED
test046.pure: FAILED
test058.pure: FAILED
test060.pure: FAILED
test072.pure: FAILED
test092.pure: FAILED
make: *** [Makefile:578: recheck] Error 1

These tests all seem to involve unhandled exceptions in some way, which then makes the interpreter crash and burn with a segfault. E.g., test011.pure is expected to throw an exception at line 2:

> using system;
> sscanf "this" "%d";
<stdin>, line 2: unhandled exception 'scanf_error ()' while evaluating 'sscanf "this" "%d"'

But instead it segfaults there. So it seems that our way of implementing exceptions using longjmp doesn't fly with mingw64. It works everywhere else, so this is likely some peculiarity in the 64 bit Windows ABI.

Can't install from apt

Following these instructions: https://launchpad.net/~dr-graef/+archive/ubuntu/pure-lang.bionic on a machine that's never had pure-lang on it.

I get a failed install. It says "I have held broken packages," but I don't know what that means, let alone how to fix it. Because this machine has never had pure-lang on it, I do not know how I could possibly have 'held broken packages.' I don't know what tools to use to find out what 'held packages' I have, let alone any 'broken held packages.' I suppose I could Google around to find out such tools and start digging around, but I'll bet there is something else wrong and that the fix is probably really easy for persons who know what they're doing. Here is a transcript:

$ sudo add-apt-repository ppa:dr-graef/pure-lang.bionic
 Ubuntu Bionic (18.04) packages for the Pure programming language

The PPA offers a complete collection of packages for Pure, the modern-style functional programming language based on term rewriting. This also includes various addon packages for scientific, web, database, GUI, graphics and multimedia programming. The following metapackages are provided to ease installation of the various collections: pure-base, pure-graphics, pure-math, pure-multimedia, pure-util, pure-web. You can also just install the pure-complete package to get the entire shebang. Moreover, the PPA also contains packages for Faust, Grame's functional signal processing language, which is needed for Pure's Faust interface and some of the multimedia modules.

Please check the Pure website for more information:

https://agraef.github.io/pure-lang/

To add this PPA to your system:

sudo add-apt-repository ppa:dr-graef/pure-lang.bionic
 More info: https://launchpad.net/~dr-graef/+archive/ubuntu/pure-lang.bionic
Press [ENTER] to continue or Ctrl-c to cancel adding it.

Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://apt.pop-os.org/proprietary bionic InRelease                                     
Hit:3 http://packages.microsoft.com/repos/vscode stable InRelease                            
Hit:4 http://dl.google.com/linux/chrome/deb stable Release                                   
Get:5 https://nvidia.github.io/libnvidia-container/ubuntu18.04/amd64  InRelease [1,139 B]    
Hit:6 https://download.docker.com/linux/ubuntu bionic InRelease                              
Hit:7 https://nvidia.github.io/nvidia-container-runtime/ubuntu18.04/amd64  InRelease         
Hit:8 http://us.archive.ubuntu.com/ubuntu bionic InRelease                                   
Hit:9 https://nvidia.github.io/nvidia-docker/ubuntu18.04/amd64  InRelease
Hit:10 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease      
Get:11 http://ppa.launchpad.net/dr-graef/pure-lang.bionic/ubuntu bionic InRelease [15.4 kB]
Hit:12 http://us.archive.ubuntu.com/ubuntu bionic-security InRelease                  
Hit:13 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease                        
Hit:14 http://ppa.launchpad.net/obsproject/obs-studio/ubuntu bionic InRelease                
Hit:16 http://ppa.launchpad.net/system76/pop/ubuntu bionic InRelease          
Get:17 http://ppa.launchpad.net/dr-graef/pure-lang.bionic/ubuntu bionic/main amd64 Packages [14.7 kB]
Get:18 http://ppa.launchpad.net/dr-graef/pure-lang.bionic/ubuntu bionic/main i386 Packages [14.7 kB]
Get:19 http://ppa.launchpad.net/dr-graef/pure-lang.bionic/ubuntu bionic/main Translation-en [10.4 kB]
Fetched 56.3 kB in 4s (13.0 kB/s)          
Reading package lists... Done

~/Documents/GitHub ⌚ 6:54:43
$ sudo apt update                                      
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://apt.pop-os.org/proprietary bionic InRelease                                     
Hit:3 http://dl.google.com/linux/chrome/deb stable Release                                   
Get:4 https://nvidia.github.io/libnvidia-container/ubuntu18.04/amd64  InRelease [1,139 B]    
Hit:5 http://packages.microsoft.com/repos/vscode stable InRelease                            
Hit:6 https://download.docker.com/linux/ubuntu bionic InRelease                              
Hit:7 https://nvidia.github.io/nvidia-container-runtime/ubuntu18.04/amd64  InRelease         
Hit:8 https://nvidia.github.io/nvidia-docker/ubuntu18.04/amd64  InRelease                    
Hit:9 http://us.archive.ubuntu.com/ubuntu bionic InRelease                                   
Hit:10 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease      
Hit:12 http://ppa.launchpad.net/dr-graef/pure-lang.bionic/ubuntu bionic InRelease
Hit:13 http://us.archive.ubuntu.com/ubuntu bionic-security InRelease                         
Hit:14 http://us.archive.ubuntu.com/ubuntu bionic-backports InRelease                        
Hit:15 http://ppa.launchpad.net/obsproject/obs-studio/ubuntu bionic InRelease 
Hit:16 http://ppa.launchpad.net/system76/pop/ubuntu bionic InRelease          
Fetched 1,139 B in 3s (395 B/s)                    
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.

$ sudo apt install pure-complete                       
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 pure-complete : Depends: pure-math but it is not going to be installed
                 Depends: pure-web but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Please make pure-lang available on Homebrew on macOS.

I am interested in using purelang and also faust2pd but I'm not interested in also installing Macports since I already use Homebrew and they don't work nicely together.

Incidentally, I've already tried this (installed LLVM via Homebrew and got past ./configure), but could not build. Having pure available on both popular packaging platforms would be great.

Thanks.

Get rid of `echo -n` in shell scripts

As Ryan Schmidt pointed out, echo -n isn't standard, so we should replace instances of it in shell scripts by printf for better (POSIX) compatibility.

(Originally submitted 2015-10-28 as BB #40.)

Move documentation files to /usr/share

As requested by Matt Gushee on the mailing list, documentation files (/usr/lib/pure/docs) should be moved to /usr/share. This entails the following changes:

  • Fix up make install and uninstall targets in pure/Makefile.

  • Fix up the file search logic in the help command (lexer.ll), as well as the Emacs and TeXmacs modes, so that the documentation search path is derived from the PURELIB prefix in an automatic fashion.

  • Add a datadir variable to pure.pc which points to the /usr/share/pure directory, so that addon packages can find the new install location for documentation and other platform-independent files.

(Originally submitted 2013-10-04 as BB #16.)

pure --check spurious syntax errors

E.g.:

$ pure --check faust_examp.pure 
faust_examp.pure, line 79: syntax error

No syntax error in sight anywhere, pure --etags works fine on the same file.

pure-pandoc: Add pandoc-crossref support

Currently pure-pandoc uses plain (Pandoc) Markdown to do all the cross-referencing, this might become easier and also give much nicer Markdown output (at least for in-document references) if we add support for the pandoc-crossref filter (https://github.com/lierdakil/pandoc-crossref). The downside is that the generated Markdown then needs pandoc and pandoc-crossref to be rendered correctly. OTOH, we're already using various Pandoc Markdown features which neither Bitbucket nor Github will render nicely, such as the line blocks (|) and the {.sourceCode .language} markup in fenced code blocks.

(Originally submitted 2017-03-07 as BB #47.)

pure-octave: /bin/sh: dynamiclib: command not found

pure-octave 0.13 fails to build for me on macOS 10.15.7 with octave 6.4.0. This happens when running make:

rm -f embed.o
mkoctfile -v -DOCTAVE_MAJOR=6 -DOCTAVE_MINOR=4 -o embed.o -c embed.cc
/usr/bin/clang++ -c -I/opt/local/include -fPIC -I/opt/local/include/octave-6.4.0/octave/.. -I/opt/local/include/octave-6.4.0/octave -I/opt/local/include  -D_THREAD_SAFE -pthread -Os -std=gnu++11 -stdlib=libc++ -arch x86_64    -DOCTAVE_MAJOR=6 -DOCTAVE_MINOR=4 embed.cc -o embed.o
warning: LFLAGS is deprecated and will be removed in a future version of Octave, use LDFLAGS instead
rm -f octave_embed.dylib
dynamiclib -install_name "/opt/local/lib/pure/octave_embed.dylib" -o octave_embed.dylib embed.o -L/opt/local/lib/octave/6.4.0 -L/opt/local/lib -loctinterp -loctave  -L/opt/local/lib -Wl,-headerpad_max_install_names -L/opt/local/libexec/qt5/lib -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64 -lpure
/bin/sh: dynamiclib: command not found
make: [octave_embed.dylib] Error 127 (ignored)

This is not detected as an error so make install is allowed to proceed, but of course it fails too:

cp gnuplot.pure octave.pure octave_embed.dylib "/path/to/destroot/opt/local/lib/pure"
cp: octave_embed.dylib: No such file or directory

Looks like Octave 6.4.0's mkoctfile at least does not know about LD_CXX anymore but it does have something called CXXLD:

$ mkoctfile -p LD_CXX

$ mkoctfile -p CXXLD
/usr/bin/clang++ -std=gnu++11

This fixes it for me:

--- Makefile.orig	2021-04-26 04:58:58.000000000 -0500
+++ Makefile	2022-01-14 23:39:34.000000000 -0600
@@ -52,7 +52,7 @@
 embed.o: embed.cc embed.h
 	rm -f $@
 	$(mkoctfile) -v $(octversionflag) -o $@ -c $<
-MKOCT_LDCXX = $(shell $(mkoctfile) -p LD_CXX)
+MKOCT_LDCXX = $(shell $(mkoctfile) -p CXXLD)
 MKOCT_LDFLAGS = $(shell $(mkoctfile) -p LFLAGS) $(shell $(mkoctfile) -p OCTAVE_LIBS) $(shell $(mkoctfile) -p LDFLAGS)
 octave_embed$(DLL): embed.o
 	rm -f $@

However, I expect that will make it incompatible with earlier versions of octave that used LD_CXX, so a more nuanced solution may be needed that detects and uses whatever the current version of octave needs.

As for the deprecation of LFLAGS, I'm not sure what to do. The suggestion to use LDFLAGS instead is curious to me. The pure-octave Makefile already uses both LFLAGS and LDFLAGS. And LDFLAGS doesn't contain all the flags LFLAGS does:

$ mkoctfile -p LFLAGS
warning: LFLAGS is deprecated and will be removed in a future version of Octave, use LDFLAGS instead
-L/opt/local/lib/octave/6.4.0 -L/opt/local/lib
$ mkoctfile -p LDFLAGS
-L/opt/local/lib -Wl,-headerpad_max_install_names -L/opt/local/libexec/qt5/lib -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -arch x86_64

Specifically, LDFLAGS is missing -L/opt/local/lib/octave/6.4.0. If I remove the LFLAGS, the build fails with:

ld: library not found for -loctinterp

If I keep LFLAGS and overlook the deprecation message it builds fine.

Inline code (invalid value)

Inline (C) code does not work anymore?? (Ubuntu/Cygwin/MinGW):

using inline;
inline.pure, line 1: inline.pure0.WGHnU9.bc: Invalid value

:: Example

kfp@euler:~/devel$ pure -i

 __ \  |   |  __| _ \    Pure 0.68 (x86_64-pc-linux-gnu)
 |   | |   | |    __/    Copyright (c) 2008-2018 by Albert Graef
 .__/ \__,_|_|  \___|    (Type 'help' for help, 'help copying'
_|                       for license information.)

Loaded prelude from /usr/lib/pure/prelude.pure.

> using inline;
inline.pure, line 1: inline.pure0.QmBufv.bc: Invalid value
> 
> clang --version
> quit
kfp@euler:~/devel$ clang --version
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
kfp@euler:~/devel$ 

kfp@euler:~/devel$ cat inline.pure
%<
int mygcd(int x, int y)
{
  if (y == 0)
    return x;
  else
    return mygcd(y, x%y);
}
%>	

Same on cygwin and MinGW:

kfp@NUC /cygdrive/c/Users/kfp/Desktop/work/pure
$ clang --version
clang version 5.0.1 (tags/RELEASE_501/final)
Target: x86_64-unknown-windows-cygnus
Thread model: posix
InstalledDir: /usr/bin

kfp@NUC MINGW32 /c/Users/kfp/Desktop
$ clang --version
clang version 3.8.0 (/repo/sources/clang 1d5b05f1ef9d1b9889ddb5ad946944f224a7ba88) (/repo/sources/llvm 2aebced35905eb3891eba484e4d1902cf7399558)
Target: x86_64-pc-msys
Thread model: posix
InstalledDir: /usr/bin

Wiki improvements

In particular, put the contents in the Addons page into XML so that we can generate both the Addons page and a better Download page from it.

compilation on Debian stretch fail.

Hello!

I'm trying to compile [lv2plugin~] object and for that I need to compile pure.

After read this page, I follow this way in debian:

install from debian stable repository

sudo apt install autoconf automake gcc make flex bison emacs libltdl-dev libgmp-dev libmpfr-dev libpcre++-dev libreadline-dev git fig2ps binfmt-support

and manually download and install llvm3.5-dev package, for that I installed in order:

after that I went to pure directory (cloned from this git) but compilation fail... :/

Some suggestion? or anyway some binaries for debian stretch?

follow the result of my compilation attempt:

esteban-deb@MacBookPro-Esteban:~/Modelos/pure-lang$ cd pure
esteban-deb@MacBookPro-Esteban:~/Modelos/pure-lang/pure$ autoreconf
esteban-deb@MacBookPro-Esteban:~/Modelos/pure-lang/pure$ ./configure --enable-release
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for bison... bison
checking for flex... flex
checking for emacs... /usr/bin/emacs
checking whether g++ supports C++11 features by default... yes
checking whether the linker accepts -l:libm.a... yes
checking for texmacs... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether byte ordering is bigendian... no
checking size of void *... 8
checking size of long... 8
checking size of size_t... 8
checking for __gmpz_init in -lgmp... yes
checking gmp.h usability... yes
checking gmp.h presence... yes
checking for gmp.h... yes
checking for mpfr_init in -lmpfr... yes
checking mpfr.h usability... yes
checking mpfr.h presence... yes
checking for mpfr.h... yes
checking for cos in -lm... yes
checking for libiconv in -liconv... no
checking for iconv in -liconv... no
checking for glob in -lglob... no
checking for regcomp in -lregex... no
checking for a readline compatible library... -lreadline
checking readline/readline.h usability... yes
checking readline/readline.h presence... yes
checking for readline/readline.h... yes
checking edit/readline/readline.h usability... no
checking edit/readline/readline.h presence... no
checking for edit/readline/readline.h... no
checking editline/readline.h usability... no
checking editline/readline.h presence... no
checking for editline/readline.h... no
checking whether readline supports history... yes
checking readline/history.h usability... yes
checking readline/history.h presence... yes
checking for readline/history.h... yes
checking edit/readline/history.h usability... no
checking edit/readline/history.h presence... no
checking for edit/readline/history.h... no
checking for history_set_history_state... yes
checking for a sed that does not truncate output... /bin/sed
checking whether gcc is Clang... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking whether more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking for iconv... yes
checking for iconv declaration... 
         extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
checking for nl_langinfo and CODESET... yes
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for ftime... yes
checking for gettimeofday... yes
checking for nanosleep... yes
checking for usleep... yes
checking whether time.h declares the daylight variable... yes
checking whether struct tm has tm_gmtoff member... yes
checking for strptime... yes
checking dirent.h usability... yes
checking dirent.h presence... yes
checking for dirent.h... yes
checking for readdir... yes
checking sys/fcntl.h usability... yes
checking sys/fcntl.h presence... yes
checking for sys/fcntl.h... yes
checking sys/wait.h usability... yes
checking sys/wait.h presence... yes
checking for sys/wait.h... yes
checking for mkstemp... yes
checking for fstat... yes
checking for _setjmp... yes
checking for _longjmp... yes
checking for struct stat.st_rdev... yes
checking return type of signal handlers... void
checking for type of signal functions... posix
checking if signal handlers must be reinstalled when invoked... no
checking for _Complex float... yes
checking for _Complex double... yes
checking for llvm-config... no
checking for llvm-config-3.5... llvm-config-3.5
checking for shared LLVM library... -L/usr/lib/llvm-3.5/lib -lLLVM-3.5.0
checking for new LLVM IRBuilder class (LLVM >= 3.3)... yes
checking for new llvm::raw_fd_ostream interface (LLVM >= 2.7)... no
checking for new llvm::raw_fd_ostream interface (LLVM >= 3.4)... yes
checking for new user_iterator class (LLVM >= 3.5)... yes
checking for llvm/Support/DynamicLibrary.h... yes
checking for llvm/Support/CallSite.h... no
checking how to run the C++ preprocessor... g++ -E
checking llvm/Support/raw_ostream.h usability... yes
checking llvm/Support/raw_ostream.h presence... yes
checking for llvm/Support/raw_ostream.h... yes
checking llvm/Support/raw_os_ostream.h usability... yes
checking llvm/Support/raw_os_ostream.h presence... yes
checking for llvm/Support/raw_os_ostream.h... yes
checking llvm/ModuleProvider.h usability... no
checking llvm/ModuleProvider.h presence... no
checking for llvm/ModuleProvider.h... no
checking llvm/TypeSymbolTable.h usability... no
checking llvm/TypeSymbolTable.h presence... no
checking for llvm/TypeSymbolTable.h... no
checking llvm/DataLayout.h usability... no
checking llvm/DataLayout.h presence... no
checking for llvm/DataLayout.h... no
checking llvm/IR/DataLayout.h usability... yes
checking llvm/IR/DataLayout.h presence... yes
checking for llvm/IR/DataLayout.h... yes
checking llvm/DerivedTypes.h usability... no
checking llvm/DerivedTypes.h presence... no
checking for llvm/DerivedTypes.h... no
checking llvm/IRBuilder.h usability... no
checking llvm/IRBuilder.h presence... no
checking for llvm/IRBuilder.h... no
checking llvm/IR/IRBuilder.h usability... yes
checking llvm/IR/IRBuilder.h presence... yes
checking for llvm/IR/IRBuilder.h... yes
checking llvm/IR/Verifier.h usability... yes
checking llvm/IR/Verifier.h presence... yes
checking for llvm/IR/Verifier.h... yes
checking llvm/IR/CallSite.h usability... yes
checking llvm/IR/CallSite.h presence... yes
checking for llvm/IR/CallSite.h... yes
checking llvm/Linker/Linker.h usability... yes
checking llvm/Linker/Linker.h presence... yes
checking for llvm/Linker/Linker.h... yes
checking llvm/Support/TargetSelect.h usability... yes
checking llvm/Support/TargetSelect.h presence... yes
checking for llvm/Support/TargetSelect.h... yes
checking whether llvm::PerformTailCallOpt is declared... no
checking whether llvm::GuaranteedTailCallOpt is declared... no
checking whether llvm::parseBitcodeFile is declared... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating examples/Makefile
config.status: creating pure.pc
config.status: creating run-test
config.status: creating run-tests
config.status: creating config.h

Pure 0.67 is now configured for LLVM 3.5.0 on x86_64-unknown-linux-gnu.

  Source directory:     .
  Installation prefix:  /usr/local
  Versioned install:    no
  C compiler:           gcc -g0 -O3  -DNDEBUG -DDEBUG=0
  C++ compiler:         g++ -g0 -O3  -DNDEBUG -DDEBUG=0
  Linker:               g++  -lm -lmpfr -lgmp 
  LLVM tool prefix:     
  Readline support:	-lreadline
  Perl regex support:	no (use --with-pcre to enable)
  POSIX threads:	-pthread 
  Build libpure:        yes
  fastcc/TCO support:   yes

Now run 'make' to build everything, and 'make install' to install this
software on your system. To remove the installed software at a later
time use the 'make uninstall' command.

esteban-deb@MacBookPro-Esteban:~/Modelos/pure-lang/pure$ make
bison -v -o ./parser.cc parser.yy
if test "`cat parser.cc | sed -n 1p | sed -e 's/^.*GNU Bison \([0-9][.][0-9]\).*$/\1/'`" = "3.0"; then echo "#define HAVE_BISON30 1" >> ./parser.hh; fi
g++ -g0 -O3 -DNDEBUG -DDEBUG=0 -I/usr/lib/llvm-3.5/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -pthread -I. -I. -DGITREVISION='"r5842.4e6e4514"' -DPURELIB='"/usr/local/lib/pure"' -c -o pure.o pure.cc
g++ -g0 -O3 -fPIC -DNDEBUG -DDEBUG=0 -I/usr/lib/llvm-3.5/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I. -I. -c -o expr.o expr.cc
g++ -g0 -O3 -fPIC -DNDEBUG -DDEBUG=0 -I/usr/lib/llvm-3.5/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -pthread  -I. -I. -DLIBDIR='"/usr/local/lib"' -DLIBPURE='"libpure.so.8"' -c -o interpreter.o interpreter.cc
g++ -g0 -O3 -fPIC -DNDEBUG -DDEBUG=0 -I/usr/lib/llvm-3.5/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I. -I. -c -o matcher.o matcher.cc
g++ -g0 -O3 -fPIC -DNDEBUG -DDEBUG=0 -I/usr/lib/llvm-3.5/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I. -I. -c -o printer.o printer.cc
g++ -g0 -O3 -fPIC -DNDEBUG -DDEBUG=0 -I/usr/lib/llvm-3.5/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -pthread  -I. -I. -DGITREVISION='"r5842.4e6e4514"' -DPURELIB='"/usr/local/lib/pure"' -c -o runtime.o runtime.cc
g++ -g0 -O3 -fPIC -DNDEBUG -DDEBUG=0 -I/usr/lib/llvm-3.5/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I. -I. -c -o symtable.o symtable.cc
g++ -g0 -O3 -fPIC -DNDEBUG -DDEBUG=0 -I/usr/lib/llvm-3.5/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I. -I. -c -o util.o util.cc
flex -o ./lexer.cc lexer.ll
g++ -g0 -O3 -fPIC -DNDEBUG -DDEBUG=0 -I/usr/lib/llvm-3.5/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I. -I. -c -o lexer.o lexer.cc
g++ -g0 -O3 -fPIC -DNDEBUG -DDEBUG=0 -I/usr/lib/llvm-3.5/include   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I. -I. -c -o parser.o parser.cc
g++ -shared -Wl,-soname,libpure.so.8 -o libpure.so.8.0  -pthread expr.o interpreter.o matcher.o printer.o runtime.o symtable.o util.o lexer.o parser.o   -L/usr/lib/llvm-3.5/lib -lLLVM-3.5.0 -L/usr/lib/llvm-3.5/lib  -lm -lmpfr -lgmp  
ln -sf libpure.so.8.0 libpure.so.8
ln -sf libpure.so.8.0 libpure.so
g++ -o pure -L.  -pthread pure.o -lpure  -L/usr/lib/llvm-3.5/lib -lLLVM-3.5.0 -L/usr/lib/llvm-3.5/lib  -lm -lmpfr -lgmp  -lreadline 
./libpure.so: undefined reference to `llvm::sys::DynamicLibrary::getPermanentLibrary(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
./libpure.so: undefined reference to `llvm::raw_fd_ostream::raw_fd_ostream(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, llvm::sys::fs::OpenFlags)'
./libpure.so: undefined reference to `llvm::DataLayout::getStringRepresentation[abi:cxx11]() const'
./libpure.so: undefined reference to `llvm::Linker::LinkModules(llvm::Module*, llvm::Module*, unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)'
collect2: error: ld returned 1 exit status
Makefile:259: recipe for target 'pure' failed
make: *** [pure] Error 1

Cheers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.