From nobody Sat Nov 26 15:53:36 2022 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NKGVZ1GJVz4hQjx for ; Sat, 26 Nov 2022 15:53:42 +0000 (UTC) (envelope-from yuri@aetern.org) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4NKGVY4WgKz3rGX for ; Sat, 26 Nov 2022 15:53:41 +0000 (UTC) (envelope-from yuri@aetern.org) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=aetern.org header.s=fm1 header.b="h oEzcDd"; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=l9D488V0; spf=pass (mx1.freebsd.org: domain of yuri@aetern.org designates 66.111.4.28 as permitted sender) smtp.mailfrom=yuri@aetern.org Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id BAC3F5C00DD; Sat, 26 Nov 2022 10:53:40 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sat, 26 Nov 2022 10:53:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aetern.org; h=cc :content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1669478020; x= 1669564420; bh=gy7SSOFLvUqisXcxcxHl/2tebO5PODcc4VDRpW+9hio=; b=h oEzcDdhVyILkP4NpG0Lu1pOpyXBmyopFrV2iNfFIU5stW5ltvVR5StSj4hyDULcj 7DoPNWbtDhKjK9Dw2kFq7lrPqEnaUUvSsFSkma8uJhyrQf53lHOqqpf/Pr27Hik4 H300wpZ5JvoPsyFbxMM643XB605CU5nARThVtK6dfRTeHPlCwG69c98lJDEwRj7l meBt+rjRCx42wmo2iuRduGde1KHP16d5ThQOeu+AdJlW3lG+brc90HGt8gLDPp3/ VkWN+ip8/nbNVdC6yQ6x3CW0gyDCZROEfjO8w75vjcZQQu22K8zBSPTpQuTgwEhq ghNZVtW0zQjVFgLQauStg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1669478020; x=1669564420; bh=g y7SSOFLvUqisXcxcxHl/2tebO5PODcc4VDRpW+9hio=; b=l9D488V0gYURurdeS eOC3Rf304GrAcqhW9g2qQig0aa1ffgP4/1biCK0Yg14U0kKM7gUezI7bg3aRAt1+ kVMhCMX1vjjnbvLYejLJpio+gzubZaIU2l0WRdJ41yTbtIzB5lTCwsXNFvNIvpdQ LRlbtVBcqJ0m/ONxHu7/DoG5zx5NcakXf782v/9CzxoviP9jBBDEeuIP6qcsJNVb wIr++BtQvqUEYCbPCBFU8ZaJgcIDaf3y9GSpKk6eCopDlVeoMtqCfuHyByLvArtu kMtVpzXKMHHIUGKBqZ6+POO8R+vhg8py4feYeGxQSvY1jxnWB+qdd7QHVHtgtq8T 0IFOg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrieejgdekgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpegjuhhrihcu oeihuhhrihesrggvthgvrhhnrdhorhhgqeenucggtffrrghtthgvrhhnpefhfeekueduff ehvdejueetueffjeduiedtueehlefffeelkeefgeehkedufeeileenucffohhmrghinhep ohhpthhsrdhmkhdpphhrohhgrdhmkhdpshhqlhhithgvrdhorhhgpdgtohhnfhhighhurh gvrdgrtgdpphgtrdhinhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpeihuhhrihesrggvthgvrhhnrdhorhhg X-ME-Proxy: Feedback-ID: i0d79475b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 26 Nov 2022 10:53:39 -0500 (EST) Message-ID: <33b789dd-d501-e57b-0817-a8f533f337a5@aetern.org> Date: Sat, 26 Nov 2022 16:53:36 +0100 List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: ld error (undefined symbol) while compiling sqlite3 To: Archimedes Gaviola , freebsd-current References: Content-Language: en-US From: Yuri In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4NKGVY4WgKz3rGX X-Spamd-Bar: / X-Spamd-Result: default: False [-0.40 / 15.00]; R_SPF_ALLOW(-0.20)[+ip4:66.111.4.28]; R_DKIM_ALLOW(-0.20)[aetern.org:s=fm1,messagingengine.com:s=fm1]; TAGGED_RCPT(0.00)[]; local_wl_from(0.00)[yuri@aetern.org]; DKIM_TRACE(0.00)[aetern.org:+,messagingengine.com:+]; ASN(0.00)[asn:19151, ipnet:66.111.4.0/24, country:US] X-Rspamd-Pre-Result: action=no action; module=multimap; Matched map: local_wl_from X-ThisMailContainsUnwantedMimeParts: N Archimedes Gaviola wrote: > Hi, > > For some reason, I am compiling sqlite3 from the > /usr/src/contrib/sqlite3 source using > FreeBSD-14.0-CURRENT-arm64-aarch64-RPI-20221027-769b884e2e2-258837. I > created a /usr/src/usr.bin/sqlite3 directory and created a Makefile file > with content referred to the source. > > root@generic:/usr/src/usr.bin/sqlite3 # ls -la > total 16 > drwxr-xr-x    2 root  wheel   512 Nov 26 12:46 . > drwxr-xr-x  279 root  wheel  5120 Nov 26 12:46 .. > -rw-r--r--    1 root  wheel   295 Nov 26 16:50 Makefile > > root@generic:/usr/src/usr.bin/sqlite3 # cat Makefile > # $FreeBSD$ > > .include > > SQLITE= ${SRCTOP}/contrib/sqlite3 > .PATH:  ${SQLITE} > > PROG= sqlite3 > MK_MAN=no > SRCS= sqlite3.c SRCS= shell.c sqlite3.c > INCS= shell.c sqlite3.h Remove? > > WARNS?= 3 WARNS?= 2 worked for me. > CFLAGS+=        -I${SQLITE} \ >                 -DSQLITE_THREADSAFE=0 \ >                 -DSQLITE_OMIT_LOAD_EXTENSION > > .include > > With 'make' command invoked, I encountered this error -> ld: error: > undefined symbol: main as referenced to the crt1_c.c:72 > (/usr/src/lib/csu/aarch64/crt1_c.c:72) file. See below details for the > actual error. > > root@generic:/usr/src/usr.bin/sqlite3 # make > cc  -O2 -pipe -fno-common -I/usr/src/contrib/sqlite3  -DSQLITE_THREADSAFE=1 >  -DSQLITE_OMIT_LOAD_EXTENSION   -fPIE -g -gz=zlib -MD  -MF.depend.sqlite3.o > -MTsqlite3.o -std=gnu99 -Wno-format-zero-length -fstack-protector-strong > -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter > -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized > -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int > -Wno-unused-const-variable -Wno-error=unused-but-set-variable > -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality > -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef > -Wno-address-of-packed-member  -Qunused-arguments    -c > /usr/src/contrib/sqlite3/sqlite3.c -o sqlite3.o > cc -O2 -pipe -fno-common -I/usr/src/contrib/sqlite3 -DSQLITE_THREADSAFE=1 > -DSQLITE_OMIT_LOAD_EXTENSION -fPIE -g -gz=zlib -std=gnu99 > -Wno-format-zero-length -fstack-protector-strong -Wsystem-headers -Werror > -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes > -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign > -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable > -Wno-error=unused-but-set-variable -Wno-tautological-compare > -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function > -Wno-enum-conversion -Wno-unused-local-typedef > -Wno-address-of-packed-member -Qunused-arguments  -Wl,-zrelro -pie   -o > sqlite3.full sqlite3.o  -L/usr/obj/usr/src/arm64.aarch64/lib/libthr > -lpthread > ld: error: undefined symbol: main >>>> referenced by crt1_c.c:72 (/usr/src/lib/csu/aarch64/crt1_c.c:72) >>>>               /usr/lib/Scrt1.o:(__start) > cc: error: linker command failed with exit code 1 (use -v to see invocation) > *** Error code 1 > > Stop. > make: stopped in /usr/src/usr.bin/sqlite3 > > Not sure if I missed something or if something goes wrong with my Makefile > content construction. I basically followed here > https://www.sqlite.org/howtocompile.html > and then proved the source to > compile successfully. > > root@generic:/usr/src/contrib/sqlite3 # pwd > /usr/src/contrib/sqlite3 > root@generic:/usr/src/contrib/sqlite3 # ls -lah > total 11364 > drwxr-xr-x   3 root  wheel   1.0K Oct 27 08:06 . > drwxr-xr-x  89 root  wheel   2.0K Nov 26 13:01 .. > -rw-r--r--   1 root  wheel    15K Oct 27 08:06 INSTALL > -rw-r--r--   1 root  wheel   729B Oct 27 08:06 Makefile.am > -rw-r--r--   1 root  wheel   547B Oct 27 08:06 Makefile.fallback > -rw-r--r--   1 root  wheel    37K Oct 27 08:06 Makefile.in > -rw-r--r--   1 root  wheel    28K Oct 27 08:06 Makefile.msc > -rw-r--r--   1 root  wheel   3.5K Oct 27 08:06 README.txt > -rw-r--r--   1 root  wheel   7.1K Oct 27 08:06 Replace.cs > -rw-r--r--   1 root  wheel   365K Oct 27 08:06 aclocal.m4 > -rwxr-xr-x   1 root  wheel   7.2K Oct 27 08:06 compile > -rwxr-xr-x   1 root  wheel    48K Oct 27 08:06 config.guess > -rwxr-xr-x   1 root  wheel    35K Oct 27 08:06 config.sub > -rwxr-xr-x   1 root  wheel   485K Oct 27 08:06 configure > -rw-r--r--   1 root  wheel   8.5K Oct 27 08:06 configure.ac > > -rwxr-xr-x   1 root  wheel    23K Oct 27 08:06 depcomp > -rwxr-xr-x   1 root  wheel    15K Oct 27 08:06 install-sh > -rwxr-xr-x   1 root  wheel   320K Oct 27 08:06 ltmain.sh > -rwxr-xr-x   1 root  wheel   6.7K Oct 27 08:06 missing > -rw-r--r--   1 root  wheel   717K Oct 27 08:06 shell.c > -rw-r--r--   1 root  wheel   8.7K Oct 27 08:06 sqlite3.1 > -rw-r--r--   1 root  wheel   8.2M Oct 27 08:06 sqlite3.c > -rw-r--r--   1 root  wheel   599K Oct 27 08:06 sqlite3.h > -rw-r--r--   1 root  wheel   267B Oct 27 08:06 sqlite3.pc.in > > -rw-r--r--   1 root  wheel   1.9K Oct 27 08:06 sqlite3.rc > -rw-r--r--   1 root  wheel    36K Oct 27 08:06 sqlite3ext.h > -rw-r--r--   1 root  wheel    78B Oct 27 08:06 sqlite3rc.h > drwxr-xr-x   6 root  wheel   512B Oct 27 08:06 tea > > root@generic:/usr/src/contrib/sqlite3 # cc -DSQLITE_THREADSAFE=0 > -DSQLITE_OMIT_LOAD_EXTENSION shell.c sqlite3.c -o sqlite3 > > So, the above compilation builds the source successfully. > > This time I've manually invoked the first compilation command and it > works just fine as seen below. > > root@generic:/usr/src/contrib/sqlite3 # cc  -O2 -pipe -fno-common > -I/usr/src/contrib/sqlite3  -DSQLITE_THREADSAFE=0 >  -DSQLITE_OMIT_LOAD_EXTENSION -fPIE -g -gz=zlib -MD  -MF.depend.sqlite3.o > -MTsqlite3.o -std=gnu99 -Wno-format-zero-length -fstack-protector-strong > -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter > -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized > -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int > -Wno-unused-const-variable -Wno-error=unused-but-set-variable > -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality > -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef > -Wno-address-of-packed-member  -Qunused-arguments -c > /usr/src/contrib/sqlite3/sqlite3.c -o sqlite3.o > > While the second compilation command below breaks having the same > manifested error. > > cc -O2 -pipe -fno-common -I/usr/src/contrib/sqlite3 -DSQLITE_THREADSAFE=1 > -DSQLITE_OMIT_LOAD_EXTENSION -fPIE -g -gz=zlib -std=gnu99 > -Wno-format-zero-length -fstack-protector-strong -Wsystem-headers -Werror > -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes > -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign > -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable > -Wno-error=unused-but-set-variable -Wno-tautological-compare > -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function > -Wno-enum-conversion -Wno-unused-local-typedef > -Wno-address-of-packed-member -Qunused-arguments  -Wl,-zrelro -pie   -o > sqlite3.full sqlite3.o  -L/usr/obj/usr/src/arm64.aarch64/lib/libthr > -lpthread > ld: error: undefined symbol: main >>>> referenced by crt1_c.c:72 (/usr/src/lib/csu/aarch64/crt1_c.c:72) >>>>               /usr/lib/Scrt1.o:(__start) > cc: error: linker command failed with exit code 1 (use -v to see invocation) > *** Error code 1 > > Stop. > make: stopped in /usr/src/usr.bin/sqlite3 > > Any idea of this problem? I posted this at freebsd-database ML however, > I'm thinking that the problem might not be related to SQLite3 > perspective as I have compiled the source without any problem at all so, > I share it here. > > Thanks and best regards, > Archimedes > > > > > >