Subject: mailing-list for TeXmacs Users
List archive
From : Madhusudan Singh <address@hidden>- To: address@hidden
- Subject: Re: [TeXmacs] TeXmacs Mathematica plugin HowTo
- Date: Thu, 17 Feb 2011 17:08:18 -0600
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=wHecA7HKOOnclckNOxq1YYd4+g2RrhuPzoFoIcWEmDeQ3E+gUGsIs+9QuOj1Ynjvrz m1WY+nQa0s0TDnN0tY7xdQVLPxc/SKbe9N5fVtC2/LiiO93r8PaokzICXVSdZHzeGZ0E B308fPJ2wfqQ3Iy3gZ0sul4AugAmbba7P2Ejk=
Responding to my own post.
Changed the shell script to:
#! /bin/bash
#first define paths
#here we use the texmacs installed files, but can also be the downloaded source
Texmacs_math_plugin_files=/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/plugins/mathematica
#Mathematica files from your installation
Mathlink_Path="/Applications/Mathematica.app/SystemFiles/Links/MathLink/DeveloperKit/CompilerAdditions/"
#In this directory we'll use the header mathlink.h and a shared library
#libMLxxx.so where xxx depends on the architecture
#for me, the library is "libML64i3.so" :
lib_name=libMLi3.a
#for Linux, normally no editting needed below this line
Texmacs_home=$HOME"/.TeXmacs"
#lib_option=${lib_name:3:${#lib_name}-6} #strip "lib" and ".so"
lib_option=MLi3
#make the dynamic library accessible at runtime in the usual system library
#path (needs admin rights):
sudo ln -s $Mathlink_Path/$lib_name /usr/lib/$lib_name
#make temporary writable copy of souce and use as working directory:
cp -rf $Texmacs_math_plugin_files/src.lazy /tmp/mathem
cd /tmp/mathem
#copy necessary header
cp $Mathlink_Path/mathlink.h mathlink.h
#compile
gcc -o tm_mathematica.bin tm_mathematica.c -I $Mathlink_Path -L$Mathlink_Path -l$lib_option -lstdc++ -framework Foundation -lm -lpthread
#finally install executable
cp tm_mathematica.bin $Texmacs_home/bin/tm_mathematica.bin
This now chokes on getline (which is not a standard part of Mac OSX libc (FreeBSD based):
tm_mathematica.c: In function ‘command’:
tm_mathematica.c:146: warning: passing argument 2 of ‘MLGetString’ from incompatible pointer type
tm_mathematica.c:154: warning: passing argument 2 of ‘MLGetString’ from incompatible pointer type
tm_mathematica.c:161: warning: passing argument 2 of ‘MLGetString’ from incompatible pointer type
tm_mathematica.c:168: warning: passing argument 2 of ‘MLGetString’ from incompatible pointer type
tm_mathematica.c:185: warning: passing argument 2 of ‘MLGetSymbol’ from incompatible pointer type
tm_mathematica.c:186: warning: passing argument 2 of ‘MLGetString’ from incompatible pointer type
tm_mathematica.c:195: warning: passing argument 2 of ‘MLGetString’ from incompatible pointer type
tm_mathematica.c:210: warning: passing argument 2 of ‘MLGetString’ from incompatible pointer type
tm_mathematica.c:224: warning: passing argument 2 of ‘MLGetString’ from incompatible pointer type
tm_mathematica.c:252: warning: format ‘%1d’ expects type ‘int’, but argument 2 has type ‘long int’
tm_mathematica.c: In function ‘main’:
tm_mathematica.c:282: warning: passing argument 3 of ‘MLOpenString’ from incompatible pointer type
tm_mathematica.c:293: warning: format ‘%1d’ expects type ‘int’, but argument 2 has type ‘size_t’
Undefined symbols:
"_getline", referenced from:
_command in ccCetxkE.o
_main in ccCetxkE.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
cp: tm_mathematica.bin: No such file or directory
I have not found a workaround for this. Everywhere I read suggests the use of fgets() instead of getline(). Since my C coding skills have at least 10 years of rust, I am kind of stuck here.
On Thu, Feb 17, 2011 at 4:21 PM, Madhusudan Singh <address@hidden> wrote:
I am trying to do this for Mathematica 7.0 on Snow Leopard (10.6.6).I modified the script above:#! /bin/bash#first define paths#here we use the texmacs installed files, but can also be the downloaded sourceTexmacs_math_plugin_files=/Applications/TeXmacs.app/Contents/Resources/share/TeXmacs/plugins/mathematica#Mathematica files from your installationMathlink_Path="/Applications/Mathematica.app/SystemFiles/Links/MathLink/DeveloperKit/CompilerAdditions/"#In this directory we'll use the header mathlink.h and a shared library#libMLxxx.so where xxx depends on the architecture#for me, the library is "libML64i3.so" :lib_name=libMLi3.a#for Linux, normally no editting needed below this lineTexmacs_home=$HOME"/.TeXmacs"#lib_option=${lib_name:3:${#lib_name}-6} #strip "lib" and ".so"lib_option=M#make the dynamic library accessible at runtime in the usual system library#path (needs admin rights):sudo ln -s $Mathlink_Path/$lib_name /usr/lib/$lib_name#make temporary writable copy of souce and use as working directory:cp -rf $Texmacs_math_plugin_files/src.lazy /tmp/mathemcd /tmp/mathem#copy necessary headercp $Mathlink_Path/mathlink.h mathlink.h#compilegcc -o tm_mathematica.bin tm_mathematica.c -l$lib_option -lm -lpthread -lrt#finally install executablecp tm_mathematica.bin $Texmacs_home/bin/tm_mathematica.bin----I get the following errors:
tm_mathematica.c: In function ‘command’:tm_mathematica.c:146: warning: passing argument 2 of ‘MLGetString’ from incompatible pointer typetm_mathematica.c:154: warning: passing argument 2 of ‘MLGetString’ from incompatible pointer typetm_mathematica.c:161: warning: passing argument 2 of ‘MLGetString’ from incompatible pointer typetm_mathematica.c:168: warning: passing argument 2 of ‘MLGetString’ from incompatible pointer typetm_mathematica.c:185: warning: passing argument 2 of ‘MLGetSymbol’ from incompatible pointer typetm_mathematica.c:186: warning: passing argument 2 of ‘MLGetString’ from incompatible pointer typetm_mathematica.c:195: warning: passing argument 2 of ‘MLGetString’ from incompatible pointer typetm_mathematica.c:210: warning: passing argument 2 of ‘MLGetString’ from incompatible pointer typetm_mathematica.c:224: warning: passing argument 2 of ‘MLGetString’ from incompatible pointer typetm_mathematica.c:252: warning: format ‘%1d’ expects type ‘int’, but argument 2 has type ‘long int’tm_mathematica.c: In function ‘main’:tm_mathematica.c:282: warning: passing argument 3 of ‘MLOpenString’ from incompatible pointer typetm_mathematica.c:293: warning: format ‘%1d’ expects type ‘int’, but argument 2 has type ‘size_t’ld: library not found for -lrtcollect2: ld returned 1 exit statuscp: tm_mathematica.bin: No such file or directoryWhat library does -lrt linker directive point to ?On Wed, Feb 16, 2011 at 5:25 AM, Youjun Hu <address@hidden> wrote:
> Final note: in recent mathematica versions the default graphics output is notI checked this, yes, it does.
> postscript anymore, which is what TeXmacs needs. However you can correct the
> problem easily by evaluating (once per mathematica session):
>
> Get["Version5`Graphics`"]
>
> Hope it helps,
>
> Philippe
- [TeXmacs] TeXmacs Mathematica plugin HowTo, Philippe Joyez, 02/15/2011
- Re: [TeXmacs] TeXmacs Mathematica plugin HowTo, Youjun Hu, 02/16/2011
- Re: [TeXmacs] TeXmacs Mathematica plugin HowTo, Youjun Hu, 02/16/2011
- Re: [TeXmacs] TeXmacs Mathematica plugin HowTo, Madhusudan Singh, 02/17/2011
- Re: [TeXmacs] TeXmacs Mathematica plugin HowTo, Madhusudan Singh, 02/18/2011
- Re: [TeXmacs] TeXmacs Mathematica plugin HowTo, Madhusudan Singh, 02/22/2011
- Re: [TeXmacs] TeXmacs Mathematica plugin HowTo, Madhusudan Singh, 02/18/2011
- Re: [TeXmacs] TeXmacs Mathematica plugin HowTo, Madhusudan Singh, 02/17/2011
Archive powered by MHonArc 2.6.19.