Thread: C code of executable file compilation error

  1. #1
    Registered User
    Join Date
    Nov 2020
    Posts
    34

    C code of executable file compilation error

    Hi guys,
    I'm struggling about week to compile a file that's generated by this website:
    Spiral Project: Viterbi Decoder Software Generator

    K=7 , rate =1/2 with given polynema 109, 79.
    (in the website you press generate code in order to generate a code of the decoder)

    Im trying to compile the file that's generated by the generator code of the website and I couldn't succeed to compile the file.
    could anyone please help me in this?
    file called called : infrastructure.tar , and I just downloaded this file.

    I downloaded this file in Linux Ubuntu and couldn't succeed to compile the file successfully .. any help please?
    there's no code error or whatever, all is how to compile the file correctly.


    Appreciated for any help!

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,279
    As indicated by the ".tar", infrastructure.tar is an archive that we call a tarball. You would need to extract the files from this tarball, e.g., by using the tar utility on your Ubuntu Linux box. After doing that, you might find a README file with further instructions, e.g., maybe you'll have to do a ./configure, make, and make install dance, or maybe it uses some other build script, or maybe it only comes with a few source files that you can compile directly.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Sep 2020
    Posts
    195
    Works on my machine.

    As well as the infrastructure bundle you also need the '.c' and '.h' file, labeled as spiral-vit<something>.c & spiral-vit<something>.c

    I also had to add -lm to the Makefile to include the math library.

    Code:
    $ make
    gcc -O2 -msse2 -I ./ -std=gnu99 -lm -include spiral-vit*.h spiral-vit*.c verify_viterbi.c -o viterbi -lm
    $ ./viterbi
    Code specifications:
             rate = 1/2
             K = 7 (thus 64 states)
             frame size = 2048 (thus padded frame size = 2054)
             polynomials = { 109, 79 }
    
    
    Computing error rates over 10000 frames, ebn0 = 3.00 dB, gain = 32
    BER 7583/20480000 (   0.00037) FER 1348/10000 (     0.135)
    
    
    Verification: Error rates of a generic decoder
    BER 7583/20480000 (   0.00037) FER 1348/10000 (     0.135)
    
    
    Execution time for 10000 2054-bit frames: 1.58 sec
    decoder speed: 12948 kbits/s
    $

  4. #4
    Registered User
    Join Date
    Sep 2020
    Posts
    195
    Here's the contents of the README:
    Code:
    To compile the Spiral-generated decoder, simply put the generated code
    and header files in the same directory than the infrastructure files and
    type "make".
    
    
    You can then run the executable by typing "./viterbi". It should
    return you the error rates of the spiral decoder and of the generic
    C decoder plus the decoding speed.
    
    
    Note that the speed of the generated decoder files is highly dependent
    on the compiler because Spiral produces C code with intrinsics and not
    assembly code. Therefore, we recommend using the highest possible
    optimization level and switching to the Intel compiler if possible (In
    this case, try to use the flags "-fast -fno-alias"). Note that, in
    some cases, optimizations may actually make the code incorrect which
    is easily detectable because the error rate of the code becomes
    unrealistic.
    
    
    
    
    -------------------
    Frederic de Mesmay
    June 4th 2008
    Carnegie Mellon University

  5. #5
    Registered User
    Join Date
    Nov 2020
    Posts
    34
    Quote Originally Posted by hamster_nz View Post
    Works on my machine.

    As well as the infrastructure bundle you also need the '.c' and '.h' file, labeled as spiral-vit<something>.c & spiral-vit<something>.c

    I also had to add -lm to the Makefile to include the math library.

    Code:
    $ make
    gcc -O2 -msse2 -I ./ -std=gnu99 -lm -include spiral-vit*.h spiral-vit*.c verify_viterbi.c -o viterbi -lm
    $ ./viterbi
    Code specifications:
             rate = 1/2
             K = 7 (thus 64 states)
             frame size = 2048 (thus padded frame size = 2054)
             polynomials = { 109, 79 }
    
    
    Computing error rates over 10000 frames, ebn0 = 3.00 dB, gain = 32
    BER 7583/20480000 (   0.00037) FER 1348/10000 (     0.135)
    
    
    Verification: Error rates of a generic decoder
    BER 7583/20480000 (   0.00037) FER 1348/10000 (     0.135)
    
    
    Execution time for 10000 2054-bit frames: 1.58 sec
    decoder speed: 12948 kbits/s
    $
    Hi hamster_nz.

    I've downloaded the file infrastructure.tar on my ubuntu (linux) , and I extracted the file (implicitly unzipped it) , I went to the directory where the extracted file
    infrastructure found (in this file there's read me /make file c files / "include" folder), and I did this
    $make
    then I did
    $gcc -O2 -msse2 -I ./ -std=gnu99 -lm -include spiral-vit*.h spiral-vit*.c verify_viterbi.c -o viterbi -lm
    then I did
    $
    $ ./viterbi
    it shows me that there's missing files .. my question is what did you do exactly while downloading the generator code?
    you just downloaded infrastructure.tar file? or also the other files as shown in the photo down(header/source file) ?

    I would be really appreciated if you could explain step by step what you did while downloading the generator code.

    -Im working with Ubuntu (linux) , I also have read the read me but because it didn't work for me it sounds that I didn't understand it well because the generator code isn't compile/worked for me.


    as you wrote As well as the infrastructure bundle you also need the '.c' and '.h' file, labeled as spiral-vit<something>.c & spiral-vit<something>.c
    what do you mean by this? I should download the source file and head file and what I name them? shouldn't I include them in the scripts of source code of infrastructure files?

    the labels of the names I must name this exactly like this:
    spiral-vit<something>.c
    spiral-vit<something>.c
    so I must choose what I write in "<something>" ? or I write as it's <something>? and the two files are .c and not header files ..

    appreciated.
    C code of executable file compilation error-infra-jpg
    Last edited by JohnnyOmari; 12-01-2020 at 02:41 AM.

  6. #6
    Registered User
    Join Date
    Nov 2020
    Posts
    34
    Quote Originally Posted by laserlight View Post
    As indicated by the ".tar", infrastructure.tar is an archive that we call a tarball. You would need to extract the files from this tarball, e.g., by using the tar utility on your Ubuntu Linux box. After doing that, you might find a README file with further instructions, e.g., maybe you'll have to do a ./configure, make, and make install dance, or maybe it uses some other build script, or maybe it only comes with a few source files that you can compile directly.
    Hi laserlight, there's a readme file but I didn't understand it, or I should say after I've read it I tried to compile the code according to it and didn't succeed to compile(see please my comments above)

  7. #7
    Registered User
    Join Date
    Sep 2020
    Posts
    195
    Just also download the other two files, and put them in the same directory as the rest.

  8. #8
    Registered User
    Join Date
    Nov 2020
    Posts
    34
    Quote Originally Posted by hamster_nz View Post
    Just also download the other two files, and put them in the same directory as the rest.
    Hi, I will explain exactly what I did:
    I downloaded all the files in one directory called infrastructure (after I extracted them ) , I opened my terminal in that directory, I wrote this:
    $make
    then I write
    $gcc -O2 -msse2 -I ./ -std=gnu99 -lm -include spiral-vit*.h spiral-vit*.c verify_viterbi.c -o viterbi -lm
    then I write
    $./viterbi


    I didn't get as what you've shown above, it tells me there's an error while compiling the files regarding to architecture of my pc.

  9. #9
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,543
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  10. #10
    Registered User
    Join Date
    May 2009
    Posts
    3,977
    Is the a reason newbies never seem to post the error messages needed to help them?

    Tim S.
    Last edited by stahta01; 12-02-2020 at 12:15 AM. Reason: Grammar
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  11. #11
    Registered User
    Join Date
    Sep 2020
    Posts
    195
    Probably not worth persevering.

    They are given three things to download. All three go together to make the complete program.

    They only download one of the three parts, try to build it and it doesn't work, because the other two parts are missing....

    No mystery to solve.

  12. #12
    Registered User
    Join Date
    Nov 2020
    Posts
    34
    Finally it's worked fine.
    @Salem I didn't notice that I've an answer honestly .. why would I post there if I would have an answer

    Appreciated for every guys that helped me here.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. no error of compilation but my code makes codeblocks bug
    By funnydarkvador in forum C++ Programming
    Replies: 3
    Last Post: 03-19-2013, 12:31 AM
  2. Problem with Multiple File Compilation Error:
    By shyam.sunder91 in forum C Programming
    Replies: 3
    Last Post: 12-07-2012, 04:01 AM
  3. error in executable file!
    By tarun007 in forum C Programming
    Replies: 3
    Last Post: 09-02-2012, 08:53 PM
  4. Multiple file compilation error
    By MTK in forum C++ Programming
    Replies: 6
    Last Post: 12-01-2009, 09:41 PM
  5. error in executable
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 07-06-2002, 08:52 PM

Tags for this Thread