[sac-user] SAC2C: Questions about the C intermediate codes and their compilation
Stephan Herhut
s.a.herhut at herts.ac.uk
Thu Apr 5 10:22:02 BST 2007
Hi Shaoshan,
just calling gcc does not suffice, as we link certain libraries, etc..
You can see the actual call to gcc by adding -d cccall to the sac2c
commandline. This will generate an a.out.sh (or similar .sh file)
containing the call to gcc to compile and link a.out.c.
This approach will only work for programs that do not modules, though,
as these are precompiled. To make sure these are compiled with your
cross compiler, as well, have a look at the setup/sac2crc file. It
specifies which compiler with what flags sac2c will call to generate
libraries.
You should subscribe to sac-user and/or sac-devel and ask questions
there, as there are more people to answer.
I don't know how to get the libsac* libraries compiled correctly.
Maybe Clemens can help?
Hope that helps
Stephan
On 4/5/07, shaoshal at uci.edu <shaoshal at uci.edu> wrote:
> Hi, dear Stephan,
>
> This is Shaoshan Liu from U.C Irvine again. Thank you very much for
> your help, I was able to port SAC2C to my linux machine and generate
> the c intermediate codes as well as the executables.
>
> Acutally, I am a computer architecture student. My plan is to use
> SAC2C to generate codes that follow the single-assignment rule and
> then use a computer simulator (e.g. SimpleScalar) to simulate the
> execution of single assignment codes. My approach is to use my gcc
> cross compiler to compile the intermediate c code, and hope it
> generates an executable that can be run on my simulator.
>
> To start, I use helloworld.sac:
>
> Step 1: use sac2c to compiler helloworld.sac, it produces a.out.c and a.out
> Step 2: use gcc to compile a.out.c
>
> The compilation fails and returns the following error messages
>
> "/tmp/ccP5hd9a1.o: In function `SACf__MAIN__main':
> hw.c:347: undefined reference to `SAC_HM_MallocSmallChunk'
> hw.c:347: undefined reference to `SAC_HM_MallocSmallChunk'
> hw.c:347: undefined reference to `SAC_HM_MallocSmallChunk'
> hw.c:347: undefined reference to `SAC_HM_MallocSmallChunk'
> hw.c:347: undefined reference to `SAC_HM_MallocLargeChunk'
> hw.c:347: undefined reference to `SAC_HM_MallocLargeChunk'
> hw.c:347: undefined reference to `SAC_HM_MallocLargeChunk'
> hw.c:347: undefined reference to `SAC_HM_MallocLargeChunk'
> hw.c:388: undefined reference to `to_string'
> hw.c:399: undefined reference to `SACprintf'
> hw.c:401: undefined reference to `SAC_HM_FreeSmallChunk'
> /tmp/ccP5hd9a1.o: In function `SACf__MAIN_CL_INIT__init':
> hw.c:417: undefined reference to `SACo_World__TheWorld'
> hw.c:417: relocation truncated to fit: GPREL SACo_World__TheWorld
> hw.c:417: undefined reference to `SACo_World__TheWorld__desc'
> hw.c:417: relocation truncated to fit: GPREL SACo_World__TheWorld__desc
> hw.c:417: undefined reference to
> `SACf_World_CL_INIT__init_TheWorld__SACt_World__World'
> hw.c:422: undefined reference to `SACo_Terminal__TheTerminal'
> hw.c:422: relocation truncated to fit: GPREL SACo_Terminal__TheTerminal
> hw.c:422: undefined reference to `SACo_Terminal__TheTerminal__desc'
> hw.c:422: relocation truncated to fit: GPREL SACo_Terminal__TheTerminal__desc
> hw.c:422: undefined reference to
> `SACf_Terminal_CL_INIT__init_TheTerminal__SACt_Terminal__Terminal'
> hw.c:427: undefined reference to `SACo_TermFile__stdout'
> hw.c:427: relocation truncated to fit: GPREL SACo_TermFile__stdout
> hw.c:427: undefined reference to `SACo_TermFile__stdout__desc'
> hw.c:427: relocation truncated to fit: GPREL SACo_TermFile__stdout__desc
> hw.c:427: undefined reference to
> `SACf_TermFile_CL_INIT__init_stdout__SACt_TermFile__TermFile'
> /tmp/ccP5hd9a1.o: In function `main':
> hw.c:442: undefined reference to `SAC_HM_not_yet_initialized'
> hw.c:442: relocation truncated to fit: GPREL SAC_HM_not_yet_initialized
> hw.c:442: undefined reference to `SAC_HM_SetupMaster'
> hw.c:442: undefined reference to `SAC_HM_not_yet_initialized'
> hw.c:442: relocation truncated to fit: GPREL SAC_HM_not_yet_initialized
> hw.c:445: undefined reference to `SAC_commandline_argc'
> hw.c:445: relocation truncated to fit: GPREL SAC_commandline_argc
> hw.c:445: undefined reference to `SAC_commandline_argv'
> hw.c:445: relocation truncated to fit: GPREL SAC_commandline_argv
> "
>
> I just wonder if my approach [use a cross-compiler to compile
> intermediate c codes] would be a feasible one, if so, could you please
> give me some suggestions about how to proceed?
>
> I really appreciate the work done by you guys and I believe the hybrid
> between imperative and functional language will be the gold standard
> for parallel programming. Currently, it seems that SAC is the only such
> language out there, and without it I wouldnt be able to continue with
> my project.
>
>
> Thank you very much!
>
> Shaoshan Liu
>
>
>
>
>
>
>
> > Hi,
> >
> > by looking at the error messages you have sent, I got the suspicion
> > that you are still using the old sac2c binary. If you type
> >
> > sac2c -V
> >
> > in a shell, it should say sac2c-1.00 beta and not sac2c 0.9x. Make
> > sure that you remove the old installation of sac2c from your path
> > first. Alternatively
> >
> > export PATH=$SAC2CBASE/bin:$PATH
> >
> > will make sure that always the new sac2c is picked first.
> >
> > Please let me know whether this resolved your problem.
> >
> > Cheers
> > Stephan
> >
> > On 3/31/07, shaoshal at uci.edu <shaoshal at uci.edu> wrote:
> >> Hi, dear SAC developer,
> >>
> >> This is Shaoshan Liu from U.C Irvine in USA. I am currently trying to
> >> use SAC for my research project and downloaded the binary preview
> >> release on my fedora-linux-i686 machine. I followed the README file to
> >> set the PATH as well as SACBASE and SAC2CBASE. However, the
> >> compilation failed and returned the following messages:
> >>
> >> "
> >> make: *** [.TermFile.d] Error 1
> >> /workspace/shaoshal/sac2c-1.00-beta-linux-i686/stdlib/Makefiles/Makefile.standard:254:
> >> .ArrayIO.d: No such file or directory
> >> /workspace/shaoshal/sac2c-1.00-beta-linux-i686/stdlib/Makefiles/Makefile.standard:254:
> >> .BinFile.d: No such file or directory
> >> /workspace/shaoshal/sac2c-1.00-beta-linux-i686/stdlib/Makefiles/Makefile.standard:254:
> >> .ComplexIO.d: No such file or directory
> >> /workspace/shaoshal/sac2c-1.00-beta-linux-i686/stdlib/Makefiles/Makefile.standard:254:
> >> .Dislin.d: No such file or directory
> >> /workspace/shaoshal/sac2c-1.00-beta-linux-i686/stdlib/Makefiles/Makefile.standard:254:
> >> .FibreIO.d: No such file or directory
> >> /workspace/shaoshal/sac2c-1.00-beta-linux-i686/stdlib/Makefiles/Makefile.standard:254:
> >> .File.d: No such file or directory
> >> /workspace/shaoshal/sac2c-1.00-beta-linux-i686/stdlib/Makefiles/Makefile.standard:254:
> >> .IOresources.d: No such file or directory
> >> /workspace/shaoshal/sac2c-1.00-beta-linux-i686/stdlib/Makefiles/Makefile.standard:254:
> >> .ListIO.d: No such file or directory
> >> /workspace/shaoshal/sac2c-1.00-beta-linux-i686/stdlib/Makefiles/Makefile.standard:254:
> >> .ScalarIO.d: No such file or directory
> >> /workspace/shaoshal/sac2c-1.00-beta-linux-i686/stdlib/Makefiles/Makefile.standard:254:
> >> .StdIO.d: No such file or directory
> >> /workspace/shaoshal/sac2c-1.00-beta-linux-i686/stdlib/Makefiles/Makefile.standard:254:
> >> .TermFile.d: No such file or directory
> >> sac2c -Mlib -v0 -O3 -check tb TermFile.sac > .TermFile.d
> >> SYSTEM::ERROR: Illegal flag in argument for option: sac2c -check tb !
> >>
> >> *** Compilation failed ***
> >> *** Exit code 1 (Setting up sac2c compiler environment)
> >> *** 1 Error(s), 0 Warning(s)
> >> "
> >>
> >> To deal with this problem, I tried to use the sac2c binary executable
> >> in
> >> /bin, and it returns:
> >>
> >> "SYSTEM::ERROR: Unable to open public sac2crc file.
> >> :ERROR: Probably, your installation is corrupted. !
> >>
> >> *** Compilation failed ***
> >> *** Exit code 1 (Setting up sac2c compiler environment)
> >> *** 1 Error(s), 0 Warning(s)
> >> "
> >>
> >> Do you have any suggestions about how to approach this problem?
> >>
> >> Thank you very much!
> >>
> >> Shaoshan Liu
> >> _______________________________________________
> >> sac-devel mailing list
> >> sac-devel at sac-home.org
> >> http://lists.sac-home.org/listinfo/sac-devel
> >>
> >
> >
> > --
> > Stephan Herhut
> > Centre for Computer Science and Informatics Research
> > University of Hertfordshire
> >
>
>
>
--
Stephan Herhut
Centre for Computer Science and Informatics Research
University of Hertfordshire
More information about the sac-user
mailing list