Bug 257676 - sysutils/grub2-pcbsd fails build if tigcc installed due to detecting gcc from tigcc as the gcc to use for portions of build
Summary: sysutils/grub2-pcbsd fails build if tigcc installed due to detecting gcc from...
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-07 17:32 UTC by alt2600
Modified: 2024-01-05 04:59 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (kevlo)


Attachments
configure log (30.93 KB, text/plain)
2021-08-07 20:25 UTC, alt2600
no flags Details
build log (680.26 KB, text/plain)
2021-08-07 20:25 UTC, alt2600
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description alt2600 2021-08-07 17:32:01 UTC
I'm trying to get this built and run into this error, it seems somehow the basic include path for stdio.h and similar are not being passed to the make target. I'm doing this from a live system. Not sure if garbage-gen.c is a required library, or somehow being pulled in by presence of random library available in my system. I'm exploring a little bit more to see if that is the case to hunt it down.

Releng 12.2p9, ports tree main from last night and 15:00 UTC today. I'm building with FUSE, but this happens with that option or not.


gcc -o garbage-gen  -DGRUB_FILE=\"util/garbage-gen.c\" -I. -I. -I. -I. -I./include -I./include -I./grub-core/lib/libgcrypt-grub/src/   util/garbage-gen.c
util/garbage-gen.c:23:19: error: stdio.h: No such file or directory
util/garbage-gen.c:24:20: error: stdlib.h: No such file or directory
util/garbage-gen.c:25:18: error: time.h: No such file or directory
util/garbage-gen.c:26:22: error: sys/time.h: No such file or directory
util/garbage-gen.c: In function 'main':
util/garbage-gen.c:36: error: storage size of 'tv' isn't known
util/garbage-gen.c:37: error: 'NULL' undeclared (first use in this function)
util/garbage-gen.c:62: error: 'stdout' undeclared (first use in this function)
gmake[3]: *** [Makefile:13648: garbage-gen] Error 1
gmake[3]: Leaving directory '/usr/ports/sysutils/grub2-pcbsd/work/grub-2.02'
gmake[2]: *** [Makefile:11092: all-recursive] Error 1
gmake[2]: Leaving directory '/usr/ports/sysutils/grub2-pcbsd/work/grub-2.02'
gmake[1]: *** [Makefile:3482: all] Error 2
gmake[1]: Leaving directory '/usr/ports/sysutils/grub2-pcbsd/work/grub-2.02'
*** Error code 1

### $WORKSRC/Makefile

lines 1916-1921

BUILD_CC = gcc
BUILD_CFLAGS = 
BUILD_CPPFLAGS =  $(CPPFLAGS_DEFAULT)
BUILD_EXEEXT = 
BUILD_FREETYPE = freetype-config
BUILD_LDFLAGS = 

lines 2738-2741

CPPFLAGS_DEFAULT = -DGRUB_FILE=\"$(subst $(srcdir)/,,$<)\" \
	-I$(builddir) -I$(srcdir) -I$(top_builddir) -I$(top_srcdir) \
	-I$(top_srcdir)/include -I$(top_builddir)/include \
	-I$(top_srcdir)/grub-core/lib/libgcrypt-grub/src/
	

lines 13647-13648

garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c
	$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS)  $^
Comment 1 alt2600 2021-08-07 20:25:39 UTC
Created attachment 227010 [details]
configure log

Configure log
Comment 2 alt2600 2021-08-07 20:25:59 UTC
Created attachment 227011 [details]
build log

Build Log
Comment 3 alt2600 2021-08-21 21:54:02 UTC
so I explored this some more by building in a clean bhyve and my base system and comparing tee'd configure logs and config.log from work directory. Still exploring how to mitigate but updating bug for actual error, its possible I'm sharing environments with sudo and that is breaking things as root shouldn't have this in their path. I know I made this change on a linux box due to RHEL fun times, and assumed it was safe on freebsd and forgot about it, I might not have done this, it might be the default here, but i digress. 

For some reason if tigcc is installed, it is selected by configure for use building the port. it seems like TIGCC expects it is in the path, and this breaks things in wonderfully fun ways. I noticed between logs the endianess of the system said big endian on my amd64 which was obviously wrong, and this led to finding the tigcc issue. its not clear why configure would accept a 68k  compiler even if it was found when not cross-compiling. It appears it was using gcc10 for the start and gcc (tigcc) for the build stage that crashed at 

gcc -o garbage-gen  -DGRUB_FILE=\"util/garbage-gen.c\" -I. -I. -I. -I. -I./include -I./include -I./grub-core/lib/libgcrypt-grub/src/   util/garbage-gen.c

As this issue is caused by placing tigcc into my users .shrc path, not the system path during install I will mark this resolved. not a bug, but allow others to maybe find in google if they see errors. I'll give a little time before doing so the maintainer sees and can let upstream know, if they think maybe it is a configure bug. They can mark resolved in that case if they want. I still think it is odd the port us mixing which compiler to use for each component though, or that it ever accepted a 68k compiler on an amd64 host in the first place.
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2024-01-05 04:59:03 UTC
^Triage: commit bit was taken in for safekeeping.