4 Replies Latest reply on Mar 12, 2012 9:44 AM by hptcrsn

    problem building a static executable

    hptcrsn

      I'm trying to build a static executable, doing the following:

      OPEN64=/opt/x86_open64-4.5.1

      export PATH=${OPEN64}/bin:$PATH

      ACML=/opt/acml5.1.0/open64_64_fma4/lib

      opencc -c second.c

      openf95 -c -O2 -ftz main.f

      openf95 -Bsymbolic main.o second.o ${ACML}/libacml.a -o a.out

       

      But, I get this:

      ldd a.out

              linux-vdso.so.1 =>  (0x00007fffcefff000)

              libfortran.so => /opt/x86_open64-4.5.1//lib/gcc-lib/x86_64-open64-linux/4.5.1/libfortran.so (0x00007fe22959a000)

              libmv.so.1 => /opt/x86_open64-4.5.1//lib/gcc-lib/x86_64-open64-linux/4.5.1/libmv.so.1 (0x00007fe22938f000)

              libm.so.6 => /lib64/libm.so.6 (0x0000003689800000)

              libacml_mv.so => /opt/x86_open64-4.5.1//lib/gcc-lib/x86_64-open64-linux/4.5.1/libacml_mv.so (0x00007fe2290cf000)

              libffio.so => /opt/x86_open64-4.5.1//lib/gcc-lib/x86_64-open64-linux/4.5.1/libffio.so (0x00007fe228e40000)

              libc.so.6 => /lib64/libc.so.6 (0x0000003689000000)

              /lib64/ld-linux-x86-64.so.2 (0x0000003688800000)

       

      Is there anyway to statically load all the libraries being resolved from /opt/x86_open64-4.5.1//lib/gcc-lib/x86_64-open64-linux/4.5.1 ??

       

      Thanks!

      Mark

        • Re: problem building a static executable
          chipf

          I was able to add the -static flag to the open64 dgetrf example and it worked.   This can be found in the example directory for each ACML version that you have.  First I removed the exe and res file for dgetrf_example, and ran make.  This rebuilds the exe.  I copied the command line and added -static to the openf95 link command.  There was an information message about -static-data, but I ignored that.  The resulting executable is static, and it ran for me.

            • Re: problem building a static executable
              hptcrsn

              Which OS?

              Doesn't seem to work with RH6 update 1

               

              openf95 WARNING: Under Linux, -static is a linker option for using static libraries; if you wanted to put local data in static area, use -static-data instead

              /usr/bin/ld: cannot find -lm

              collect2: ld returned 1 exit status

               

              There's not a static version of libm with RH6....which is OK, I can live with "most" of the symbols being static and some (libm, libgcc, etc.) being shared.  I'm trying to get the ACML and open64 libraries to all load statically.

               

              Thanks!

              Mark