From owner-freebsd-questions@FreeBSD.ORG Fri May 31 13:30:12 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B7B25B56 for ; Fri, 31 May 2013 13:30:12 +0000 (UTC) (envelope-from emorrasg@yahoo.es) Received: from nm9.bullet.mail.ird.yahoo.com (nm9.bullet.mail.ird.yahoo.com [77.238.189.35]) by mx1.freebsd.org (Postfix) with ESMTP id EC1881C3 for ; Fri, 31 May 2013 13:30:11 +0000 (UTC) Received: from [77.238.189.56] by nm9.bullet.mail.ird.yahoo.com with NNFMP; 31 May 2013 13:26:34 -0000 Received: from [46.228.39.108] by tm9.bullet.mail.ird.yahoo.com with NNFMP; 31 May 2013 13:26:34 -0000 Received: from [127.0.0.1] by smtp145.mail.ir2.yahoo.com with NNFMP; 31 May 2013 13:26:34 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s1024; t=1370006793; bh=F6TLKyXYNUI+ppCfElCC/CdEwdD6onPiG+KxZxe8X6Y=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Date:From:To:Subject:Message-Id:X-Mailer:Disposition-Notification-To:Mime-Version:Content-Type:Content-Transfer-Encoding; b=2d2n78HNnl61hIbLa/nCTqscQ/bVXaUVbEXmLw1pMiMNxMM1xaW1MSuh2lLZirNQUU0143UJSYy7+m7WtKoVCjSXVVgcaagAnyfeOLk+TSd0z9zU5mGQpVi4wsFog1OiDCURLx1DVp3GxRK9jfzSl2jOWI2rllnD2s1ttxY3t1M= X-Yahoo-Newman-Id: 997337.65893.bm@smtp145.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-5 X-YMail-OSG: _QczaI4VM1mniCChUdUXuBKVq6ZqEx3gQMBDGRFaiqTaQUg xrtMH_hrePDUv18rpvGJSBE0fnLVSHqIqvg06hudvPIkNYgm9RkNjAvhPNNW obY.7XEIzbektQUzKlxo6Z1sR6GqD5.sGtxR9bjhq8i7BhBbPzTVbEXxtgAY pYRyMku4hOPBR16ruw2q2r4fvt_UZtxMkDgOw2rFQFDwuVzwqnbyu66m1hcr nLTn174VvTKugDO6RB9vbi6n8ZXk69XE91u.ofGvKacuXGoJMZIwKscGryfr 34BfpPcyCXJ.yLhhD1xZ0_G.lkVdLMHpM9bvrSnmXKXm6dQWUkXAArX3Vupg 3olijo2yFApz2zv64eLRMvxohWsfHfN6mz15GLJX3fDg_hp103Z5CZGpAI0H K0bpostBMbe4v5fhQULZkv7Vms26gQF6LdWzopeKjOMD2pw5CYSXYfHqz5pP ou.VU335.virL1F5VKI7wFM3oar09EI3Nu_PhvU.dpZDVIopGQzxgpK6XDJ1 fxQ-- X-Yahoo-SMTP: mX392iiswBAeJNdO_s.EW62LZDJR X-Rocket-Received: from camibar.emorras.eu (emorrasg@85.219.45.142 with ) by smtp145.mail.ir2.yahoo.com with SMTP; 31 May 2013 13:26:33 +0000 UTC Date: Fri, 31 May 2013 15:26:33 +0200 From: Eduardo Morras To: freebsd-questions@freebsd.org Subject: Clang cannot finds standard system lib libssl.a Message-Id: <20130531152633.dd6dfb61118c57184369c5de@yahoo.es> X-Mailer: Sylpheed 3.3.0 (GTK+ 2.24.18; amd64-portbld-freebsd9.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 May 2013 13:30:12 -0000 Hi, I'm trying to compile a single big file project written in C. It compiled fine, without problems in my develop machine (FreeBSD 9.1 STABLE, Clang3.2) but not on the server (FreeBSD 9.1 Release#0, Clang 3.1). The app uses openssl dtls and links to system ssl libs. Am I missing something? For compile I do: %clang gog_server.c -o gog_server -v -I /usr/include/openssl but I get a lot of undefined references to whole openssl lib functions, structs etc in Link phase: ... gog_server.c:(.text+0x9): undefined reference to `CRYPTO_num_locks' gog_server.c:(.text+0x50): undefined reference to `CRYPTO_num_locks' ... I have manually checked that: a) /usr/lib/libssl.a /usr/lib/libssl.so exist b) The linker has /usr/lib path %clang -print-search-dirs programs: =/usr/bin libraries: =/usr/bin/../lib/clang/3.1:/usr/lib c) Add -Xlinker "-L /usr/lib" d) Add -Xlinker "-l /usr/lib/libssl.a", get this from linker: "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 -o gog_server /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib /tmp/gog_server-8bAHxn.o "-l /usr/lib/libssl.a" -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o /usr/bin/ld: cannot find "-l /usr/lib/libssl.a" e) Tried c) and d) without "", but get the same answers /usr/bin/ld: cannont find ... Finally, this is the relevant output of last try: % clang gog_server.c -o gog_server -v -I /usr/include/openssl -Xlinker /usr/lib/libssl.a 2>err FreeBSD clang version 3.1 (branches/release_31 156863) 20120523 Target: x86_64-unknown-freebsd9.0 Thread model: posix "/usr/bin/clang" -cc1 -triple x86_64-unknown-freebsd9.0 -emit-obj -mrelax-all -disable-free -main-file-name gog_server.c -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -momit-leaf-frame-pointer -v -resource-dir /usr/bin/../lib/clang/3.1 -I /usr/include/openssl -fmodule-cache-path /var/tmp/clang-module-cache -fdebug-compilation-dir /home/gowen/clang/Gog -ferror-limit 19 -fmessage-length 0 -mstackrealign -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-dispatch-method=non-legacy -fdiagnostics-show-option -o /tmp/gog_server-mK51RB.o -x c gog_server.c clang -cc1 version 3.1 based upon LLVM 3.1 default target x86_64-unknown-freebsd9.0 ignoring nonexistent directory "/usr/bin/../lib/clang/3.1/include" #include "..." search starts here: #include <...> search starts here: /usr/include/openssl /usr/include/clang/3.1 /usr/include End of search list. "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 -o gog_server /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib /tmp/gog_server-mK51RB.o /usr/lib/libssl.a -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o /tmp/gog_server-mK51RB.o: In function `THREAD_setup': gog_server.c:(.text+0x9): undefined reference to `CRYPTO_num_locks' ..... and a lot of similar lines. So, Am I missing something? Thanks in advance. --- --- Eduardo Morras