Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8210153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:58:37+00:00 2026-06-07T09:58:37+00:00

After a long time, I downloaded a program I co-developed and tried to recompile

  • 0

After a long time, I downloaded a program I co-developed and tried to recompile it on my Ubuntu Linux 12.04, but it seems it does not find math.h anymore. This may be because something has changed recently in gcc, but I can’t figure out if it’s something wrong in src/Makefile.am or a missing dependency:

Download from http://www.ub.edu/softevol/variscan/:

tar xzf variscan-2.0.2.tar.gz 
cd variscan-2.0.2/
make distclean
sh ./autogen.sh
make

I get:
[…]

gcc -DNDEBUG -O3 -W -Wall -ansi -pedantic  -lm  -o variscan variscan.o statistics.o common.o linefile.o memalloc.o dlist.o errabort.o dystring.o intExp.o kxTok.o pop.o window.o free.o output.o readphylip.o readaxt.o readmga.o readmaf.o readhapmap.o readxmfa.o readmav.o ran1.o swcolumn.o swnet.o swpoly.o swref.o  
statistics.o: In function `calculate_Fu_and_Li_D':
statistics.c:(.text+0x497): undefined reference to `sqrt'
statistics.o: In function `calculate_Fu_and_Li_F':
statistics.c:(.text+0x569): undefined reference to `sqrt'
statistics.o: In function `calculate_Fu_and_Li_D_star':
statistics.c:(.text+0x63b): undefined reference to `sqrt'
statistics.o: In function `calculate_Fu_and_Li_F_star':
statistics.c:(.text+0x75c): undefined reference to `sqrt'
statistics.o: In function `calculate_Tajima_D':
statistics.c:(.text+0x85d): undefined reference to `sqrt'
statistics.o:statistics.c:(.text+0xcb1): more undefined references to `sqrt' follow
statistics.o: In function `calcRunMode21Stats':
statistics.c:(.text+0xe02): undefined reference to `log'
statistics.o: In function `correctedDivergence':
statistics.c:(.text+0xe5a): undefined reference to `log'
statistics.o: In function `calcRunMode22Stats':
statistics.c:(.text+0x104a): undefined reference to `sqrt'
statistics.o: In function `calculate_Fu_fs':
statistics.c:(.text+0x11a8): undefined reference to `fabsl'
statistics.c:(.text+0x11ca): undefined reference to `powl'
statistics.c:(.text+0x11f2): undefined reference to `logl'
statistics.o: In function `calculateStatistics':
statistics.c:(.text+0x13f2): undefined reference to `log'
collect2: ld returned 1 exit status
make[1]: *** [variscan] Error 1
make[1]: Leaving directory `/home/avilella/variscan/latest/variscan-2.0.2/src'
make: *** [all-recursive] Error 1

The libraries are there because this simple example works perfectly well:

$ gcc test.c -o test -lm
$ cat test.c 
#include <stdio.h>
#include <math.h>
int main(void)
{
        double x = 0.5;
        double result = sqrt(x);
        printf("The hyperbolic cosine of %lf is %lf\n", x, result);
        return 0;
}

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T09:58:38+00:00Added an answer on June 7, 2026 at 9:58 am

    The library needs to go at the end of the compiler command, as you have in the simple example:

    gcc -DNDEBUG -O3 -W -Wall -ansi -pedantic -o variscan variscan.o statistics.o common.o linefile.o memalloc.o dlist.o errabort.o dystring.o intExp.o kxTok.o pop.o window.o free.o output.o readphylip.o readaxt.o readmga.o readmaf.o readhapmap.o readxmfa.o readmav.o ran1.o swcolumn.o swnet.o swpoly.o swref.o statistics.o -lm

    From GCC Link Options:

    -llibrary
    -l library
        Search the library named library when linking. 
        (The second alternative with the library as a separate argument
        is only for POSIX compliance and is not recommended.)
    
        It makes a difference where in the command you write this option;
        the linker searches and processes libraries and object files in the
        order they are specified.
        Thus, `foo.o -lz bar.o' searches library `z' after file foo.o but
        before bar.o. If bar.o refers to functions in `z', those functions
        may not be loaded.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been using Symfony for a long time but I'm new to Symfony2. After
After a long time searching and trying I'm asking now for help: My situation:
After searching a long time for a performance bug, I read about denormal floating
I used java after a long time and found out that unlike other languages
I heard the word buffer after a long time today and wondering if somebody
After the long time I spent getting an analog clock to work, I am
After long time of searching I have to give up and ask. Is it
Well, after a long time writing .net programs in C# I started to feel
I downloaded a single file from an subversion repository (subversion) long time ago. So
I noticed a long time ago (when facebook updated their application after the new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.