x10-lang / x10

Core implementation of X10 programming language including compiler, runtime, class libraries, sample programs and test suite
Eclipse Public License 1.0
70 stars 15 forks source link

Link error: cannot find -lgc #32

Open elliottslaughter opened 5 years ago

elliottslaughter commented 5 years ago

When I build my application with the newest master branch, I get the following link error:

x10c++  -x10rt mpi -O3 -NO_CHECKS TaskBench.x10 -post "# -o main #  -std=c++11 -I../core #  -L../core -lcore_s"
x10c++: Failed to copy core.h from to /global/u1/s/slaughte/task-bench/x10/
x10c++: /usr/bin/ld: cannot find -lgc    
     collect2: error: ld returned 1 exit status    
x10c++: Non-zero return code: 1
2 errors.

Reverting my copy of x10 to commit 9212dc271c8bcba805c82114617d47506747ee3a appears to fix the problem. Maybe the BDWGC upgrade is responsible?

dgrove-oss commented 5 years ago

Sorry for the slow response; been overloaded for a while.

Couple of thoughts.

  1. Does it work if you compile a trivial program (eg HelloWorld.x10) without an explict -post command to x10c++?
  2. Can you take a look to see if libgc.so was correctly built in x10.runtime/src-cpp/bdwgc-8.0.2/install/lib/ and verify that it was correctly copied to x10.dist/lib/
elliottslaughter commented 3 years ago
  1. Yes, it compiles.
  2. Here's what I see:

    $ ls deps/x10/x10/x10.runtime/src-cpp/bdwgc-8.0.2/install/lib 
    libcord.la  libcord.so  libcord.so.1  libcord.so.1.4.0  libgc.la  libgc.so  libgc.so.1  libgc.so.1.4.2  pkgconfig
    $ ls deps/x10/x10/x10.dist/lib 
    RunJava.jar                           commons-math3-3.6.1.jar  hazelcast-client-3.11.1.jar  libgc.so.1.4.2      lpg.jar          x10doc.jar
    antlr-runtime_4.5.0.201505151407.jar  ecj-4.10.jar             libgc.so                     libx10rt_mpi.a      snappy-java.jar
    commons-logging-1.2.jar               hazelcast-3.11.1.jar     libgc.so.1                   logging.properties  x10c.jar

    Looks like the libgc.la isn't getting copied? I think the C++ compiler on this system is configured to specify -static by default.

elliottslaughter commented 3 years ago

I went back to the old commit that worked, and it turns out the difference is that the static library extension changed from .a to .la. I'm guessing your build process is set to copy all .a files but hasn't been adapted to copy .la.

elliottslaughter commented 3 years ago

I may be wrong about the usage of .la, looks like it's associated with libtool. Anyway, the old build had .a and no .la and the new had .la but no .a. Perhaps the static library isn't being built at all? Could be a configure flag that needs to be set.