Skip to Content.
Sympa Menu

svadev - Re: [svadev] ld: cannot find -lsc_dbg_rt on openbsd

svadev AT lists.siebelschool.illinois.edu

Subject: Svadev mailing list

List archive

Re: [svadev] ld: cannot find -lsc_dbg_rt on openbsd


Chronological Thread 
  • From: John Criswell <criswell AT illinois.edu>
  • To: Daniel Vargas <danielgvargas AT gmail.com>
  • Cc: svadev AT cs.uiuc.edu
  • Subject: Re: [svadev] ld: cannot find -lsc_dbg_rt on openbsd
  • Date: Thu, 24 Jan 2013 09:48:49 -0600
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/svadev/>
  • List-id: <svadev.cs.uiuc.edu>
  • Organization: University of Illinois

On 1/24/13 4:10 AM, Daniel Vargas wrote:
Hello all, I'm trying to use SAFEcode on openbsd but oddly I got error when linking static libs..

I have two theories as to why it's not working:

1) The SAFECode libraries weren't compiled with -fPIC and, as a result, the linker is refusing to link the library even though it can find  libsc_dbg_rt.a.

2) For some reason, ld is not being run with the proper -L option to find the libraries, so it's never finding libsc_dbg_rt.a.

Does it work without the -fPIC option?  If it does, then theory #1 is probably correct.  I think you could fix it by re-running configure with the LDFLAGS or CFLAGS/CXXFLAGS/CPPFLAGS environment variables containing the -fPIC option.

If it doesn't work regardless of which options you use, then theory #2 is probably correct.  The quick work-around for that is to use a -L option on the clang command line to tell it where to find libsc_dbg_rt.a.  If this is what is happening, then I'd like to find out why clang isn't adding the proper -L option on OpenBSD.  It adds it properly on other systems (e.g., Linux and Mac OS X).

In any event, please let me know whether either of these options fixes the problem.

-- John T.



$ clang -v -g -fmemsafety -fPIC -o test test.c 
clang version 3.2 (: http://llvm.org/svn/llvm-project/safecode/branches/release_32/tools/clang)
Target: x86_64-unknown-openbsd5.2
Thread model: posix
 "/usr/local/bin/clang" -cc1 -triple x86_64-unknown-openbsd5.2 -emit-obj -mrelax-all -disable-free -main-file-name test.c -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version 2.15 -momit-leaf-frame-pointer -v -g -resource-dir /usr/local/bin/../lib/clang/3.2 -fmodule-cache-path /var/tmp/clang-module-cache -fdebug-compilation-dir /home/dgv/stuff -ferror-limit 19 -fmessage-length 134 -fmemsafety -mstackrealign -fobjc-runtime=gnustep -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/test-D2YmJs.o -x c test.c
clang -cc1 version 3.2 based upon LLVM 3.2svn default target x86_64-unknown-openbsd5.2
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/bin/../lib/clang/3.2/include
 /usr/include
End of search list.
 "/usr/bin/ld" -e __start --eh-frame-hdr -Bdynamic -dynamic-linker /usr/libexec/ld.so -o test /usr/lib/crt0.o /usr/lib/crtbegin.o -L/usr/lib/gcc-lib/amd64-unknown-openbsd5.2/4.2.1 /tmp/test-D2YmJs.o -lsc_dbg_rt -lpoolalloc_bitmap -lgdtoa -lstdc++ -lgcc -lc -lgcc /usr/lib/crtend.o
/usr/bin/ld: cannot find -lsc_dbg_rt
clang: error: linker command failed with exit code 1 (use -v to see invocation

$ ls /usr/local/lib/libpoolalloc_bitmap.a /usr/local/lib/libsc_dbg_rt.a 
/usr/local/lib/libpoolalloc_bitmap.a         /usr/local/lib/libsc_dbg_rt.a

clang works well without flags, probably ld cannot find them because needs -Bstatic or something else, someone have idea?
thanks

--
Daniel Vargas


_______________________________________________
svadev mailing list
svadev AT cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/svadev




Archive powered by MHonArc 2.6.16.

Top of Page