From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 24420 invoked from network); 24 Jul 2020 18:24:56 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 24 Jul 2020 18:24:56 -0000 Received: (qmail 21920 invoked by uid 550); 24 Jul 2020 18:24:51 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 21899 invoked from network); 24 Jul 2020 18:24:50 -0000 X-Virus-Scanned: Debian amavisd-new at disroot.org Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1595615073; bh=vDL6VonNAwKnMT2f9PiEptMaWZna3u1nChIuwvYI3sU=; h=From:To:Cc:Subject:Date:In-Reply-To; b=bEX0/I7AjEykH9vu/VLnZHjQO5NttBDzypucok5th6BvWBG0/4/jBiblOQrP5onco OXpqpj60E9XR7Fs/ZgPNnRqDiYyTxvzSZr26rfoBitwGLZNn4xxJKjuA+M9DIoYbT8 FzWvRC3Uzc6j0W7epx/IXVqylSZGH0bvFHk7BA0tUuH9d3OKH5WQM6hAXYQeeahPNo 1fQ4aVW3I1PaH7sfJU7OrpiM6vNvAN/cmchgB7Ybp1Xt4oMhYw9xeFVe0rcbJ9H6Gc wtvpaGR7I5OxxvX6Cna8tDd5nzuc/dzMV/MvajV+lUHecrLjJxJJeZ7rrIKZTQ3c+d USOe+u7BMKZfw== Content-Type: text/plain; charset=UTF-8 From: =?utf-8?q?=C3=89rico_Nogueira?= To: "Szabolcs Nagy" Cc: Date: Fri, 24 Jul 2020 15:23:19 -0300 Message-Id: In-Reply-To: <20200724143356.GA879655@port70.net> Subject: Re: [musl] [PATCH] Makefile: fix src/api compilation. On Fri Jul 24, 2020 at 1:33 PM -03, Szabolcs Nagy wrote: > * =C3=89rico Rolim [2020-07-23 00:44:33 -0300]: > > Adding all .o files in src/api to the api/main.OBJ variable led to them > > being included twice when linking api/main.exe, which failed with a > > double definition of the main() function. This can be tested by removin= g > > the failing definitions from unistdc.c and running make. > > thanks. > > > --- > >=20 > > This is a patch for libc-test. > >=20 > > Makefile | 1 - > > 1 file changed, 1 deletion(-) > >=20 > > diff --git a/Makefile b/Makefile > > index 86b6ff5..683c850 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -113,7 +113,6 @@ $(B)/common/mtest.o: src/common/mtest.h > > $(math.OBJS): src/common/mtest.h > > =20 > > $(B)/api/main.exe: $(api.OBJS) > > -api/main.OBJS:=3D$(api.OBJS) > > $(api.OBJS):$(B)/common/options.h > > $(api.OBJS):CFLAGS+=3D-pedantic-errors -Werror -Wno-unused -D_XOPEN_SO= URCE=3D700 > > this is not the right fix, > > the problem is that api/main.o is duplicated: > once because of the %.exe: %.o rule and once > in the api/main.OBJS. > > but all other api/*.o files are not duplicated > and should be linked (so we link test all > referenced symbols not just include header test). > > i'm considering doing > > $(B)/%.exe: $(B)/%.o > - $(CC) $(LDFLAGS) $($*.LDFLAGS) -o $@ $< $($*.OBJS) $(LDLIBS) > $($*.LDLIBS) 2>$@.ld.err || echo BUILDERROR $@; cat $@.ld.err > + $(CC) $(LDFLAGS) $($*.LDFLAGS) -o $@ $(sort $< $($*.OBJS)) $(LDLIBS) > $($*.LDLIBS) 2>$@.ld.err || echo BUILDERROR $@; cat $@.ld.err > > (note: the make sort function removes duplicates) Didn't know about that! This worked here as a fix, thanks.