Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#60147 closed defect (fixed)

legacy-support: unable to build on Leopard PPC

Reported by: kencu (Ken) Owned by: kencu (Ken)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: cjones051073 (Chris Jones)
Port: legacy-support

Description (last modified by kencu (Ken))

This is building the software directly from the checkout of the git repo.

At present, I am not sure exactly what to do to fix this issue.

The makefile now hard-codes in -arch flags, and these may not be supported by all the compilers we expect to use (we may have to hack out some compilers then, the ones that don't support (multiple?) arch flags).

I assume that something is calling in the same arch multiple times to generate this error. I am a bit out of my depth in this level of Makefile... maybe we have to somehow hack in a "FORCE_ARCH" setting?

At any rate, at present

$ make test
cc -c -Iinclude -Os -Wall test/test_arc4random.c -o test/test_arc4random.o
cc -c -Iinclude -Os -Wall -fPIC src/arc4random.c -o src/arc4random.dl.o
cc -c -Iinclude -Os -Wall -fPIC src/atcalls.c -o src/atcalls.dl.o
cc -c -Iinclude -Os -Wall -fPIC src/best_fchdir.c -o src/best_fchdir.dl.o
cc -c -Iinclude -Os -Wall -fPIC src/getdelim.c -o src/getdelim.dl.o
cc -c -Iinclude -Os -Wall -fPIC src/getline.c -o src/getline.dl.o
cc -c -Iinclude -Os -Wall -fPIC src/lchmod.c -o src/lchmod.dl.o
cc -c -Iinclude -Os -Wall -fPIC src/macports_legacy_realpath.c -o src/macports_legacy_realpath.dl.o
cc -c -Iinclude -Os -Wall -fPIC src/macports_legacy_sysconf.c -o src/macports_legacy_sysconf.dl.o
cc -c -Iinclude -Os -Wall -fPIC src/memmem.c -o src/memmem.dl.o
cc -c -Iinclude -Os -Wall -fPIC src/posix_memalign_emulation.c -o src/posix_memalign_emulation.dl.o
cc -c -Iinclude -Os -Wall -fPIC src/sincos.c -o src/sincos.dl.o
cc -c -Iinclude -Os -Wall -fPIC src/strndup.c -o src/strndup.dl.o
cc -c -Iinclude -Os -Wall -fPIC src/strnlen.c -o src/strnlen.dl.o
cc -c -Iinclude -Os -Wall -fPIC src/time.c -o src/time.dl.o
cc -c -Iinclude -Os -Wall -fPIC src/wcpcpy_family.c -o src/wcpcpy_family.dl.o
cc -c -Iinclude -Os -Wall -fPIC src/wcscasecmp_family.c -o src/wcscasecmp_family.dl.o
cc -c -Iinclude -Os -Wall -fPIC src/wcsdup.c -o src/wcsdup.dl.o
cc -c -Iinclude -Os -Wall -fPIC src/wcsnlen.c -o src/wcsnlen.dl.o
# Generate possibly multi-architecture object files ...
cc -c -Iinclude -Os -Wall -fPIC -D__DARWIN_UNIX03=0 -D__DARWIN_64_BIT_INO_T=0 -D__DARWIN_ONLY_64_BIT_INO_T=0 src/fdopendir.c -o src/fdopendir.dl.o.inode32
cc -c -Iinclude -Os -Wall -fPIC -D__DARWIN_UNIX03=1 -D__DARWIN_ONLY_UNIX_CONFORMANCE=0 -D__DARWIN_64_BIT_INO_T=0 -D__DARWIN_ONLY_64_BIT_INO_T=0 src/fdopendir.c -o src/fdopendir.dl.o.inode32unix2003
cc -c -Iinclude -Os -Wall -fPIC -D__DARWIN_UNIX03=1 -D__DARWIN_ONLY_UNIX_CONFORMANCE=1 -D__DARWIN_64_BIT_INO_T=1 -D__DARWIN_ONLY_64_BIT_INO_T=0 src/fdopendir.c -o src/fdopendir.dl.o.inode64
cc -c -Iinclude -Os -Wall -fPIC -D__DARWIN_UNIX03=1 -D__DARWIN_ONLY_UNIX_CONFORMANCE=0 -D__DARWIN_64_BIT_INO_T=1 -D__DARWIN_ONLY_64_BIT_INO_T=0 src/fdopendir.c -o src/fdopendir.dl.o.inode64unix2003
# ... and split them up, because ld can only generate single-architecture files ...
output='src/fdopendir.dl.o' && lipo='lipo' && rm='rm -f' && cp='/bin/cp' && ld='ld' && grep='/usr/bin/grep' && platform='9' && force_arch='' && objectlist="${output}".* && archlist='' && fatness='' && for object in ${objectlist}; do if [ -z "${force_arch}" ]; then archlist_new="$(${lipo} -archs "${object}")"; else archlist_new="${force_arch}"; fi && if [ -n "${archlist}" ] && [ "${archlist}" != "${archlist_new}" ]; then printf 'Old/previous architecture list "%s" does not match new one "%s", this is unsupported.\n' "${archlist}" "${archlist_new}" >&2 && exit '1'; else archlist="${archlist_new}"; fi && ( ${lipo} -info "${object}" | grep -qs '^Non-fat file:' ); fatness_new="${?}" && if [ -n "${fatness}" ] && [ "${fatness}" != "${fatness_new}" ]; then printf 'Old/previous fatness value "%d" does not match new one "%d", this is unsupported.\n' "${fatness}" "${fatness_new}" >&2 && exit '2'; else fatness="${fatness_new}"; fi && if [ -n "${force_arch}" ] && [ '0' -ne "${fatness}" ]; then printf 'Architecture forced to "%s", but object file "%s" is a multi-architecture (fat) object file, this is unsupported.\n' "${force_arch}" "${object}" >&2 && exit '3'; fi && $(: 'Check for unknown architectures.') && for arch in ${archlist}; do case "${arch}" in (unknown*) printf 'Unknown architecture "%s" encountered, this is unsupported.\n' "${arch}" >&2 && exit '4'; ;; (*) ;; esac && if [ '0' -eq "${fatness}" ]; then ${cp} "${object}" "${object}.${arch}" && $(: 'A non-fat file cannot have more than one architecture, but breaking out sounds weird.'); else ${lipo} "${object}" -thin "${arch}" -output "${object}.${arch}"; fi; done && ${rm} "${object}"; done && $(: '... and use ld to merge each variant into a single-architecture object file ...') && for arch in ${archlist}; do $(: 'Filter out variants not applicable to certain architectures.') && $(: 'For instance, the x86_64 architecture is fully UNIX2003-compliant and thus does not have $UNIX2003-compat functons.') && $(: 'On the contrary, the i386 architecture has only $UNIX2003-compat functions for the $INODE64 feature set.') && $(: '10.4 is so old that it does not even have the $INODE64 feature.') && case "${arch}" in ('x86_64') ${ld} -r "${output}.inode32.${arch}" "${output}.inode64.${arch}" -o "${output}.${arch}"; ;; ('ppc64') if [ '9' -gt "${platform}" ]; then ${ld} -r "${output}.inode32.${arch}" -o "${output}.${arch}"; else ${ld} -r "${output}.inode32.${arch}" "${output}.inode64.${arch}" -o "${output}.${arch}"; fi; ;; ('i386'|'ppc') if [ '9' -gt "${platform}" ]; then ${ld} -r "${output}.inode32.${arch}" "${output}.inode32unix2003.${arch}" -o "${output}.${arch}"; else ${ld} -r "${output}.inode32.${arch}" "${output}.inode32unix2003.${arch}" "${output}.inode64unix2003.${arch}" -o "${output}.${arch}"; fi; ;; (*) ${ld} -r "${output}.inode32.${arch}" "${output}.inode32unix2003.${arch}" "${output}.inode64.${arch}" "${output}.inode64unix2003.${arch}" -o "${output}.${arch}"; ;; esac; done && $(: '... build list of single-architecture merged object files ...') && objectarchlist='' && for arch in ${archlist}; do objectarchlist="${objectarchlist} ${output}.${arch}"; done && if [ '0' -eq "${fatness}" ]; then $(: 'Thin files can just be copied directly, assuming that the list will only contain one element.') && ${cp} ${objectarchlist} "${output}"; else $(: '... and eventually use lipo to merge them all together!') && ${lipo} ${objectarchlist} -create -output "${output}"; fi
ld: duplicate symbol _fdopendir$INODE64$UNIX2003 in src/fdopendir.dl.o.inode64unix2003.ppc7400 and src/fdopendir.dl.o.inode64.ppc7400 for inferred architecture ppc7400
make: *** [src/fdopendir.dl.o] Error 1

Change History (17)

comment:1 Changed 5 years ago by kencu (Ken)

Description: modified (diff)

comment:2 Changed 5 years ago by kencu (Ken)

Description: modified (diff)

comment:3 Changed 5 years ago by kencu (Ken)

Description: modified (diff)

comment:4 Changed 5 years ago by cjones051073 (Chris Jones)

I am not going to be able to help here, the Makefile is way more complicated (perhaps overly so..) than when I last looked at it. In particular you need to check with the author of the splitandfilterandmergemultiarch define as I think thats where the issue is...

comment:5 Changed 5 years ago by kencu (Ken)

I think we may need to back out ionic's changes, and find some other method (like using the muniversal portgroup) that makes this simpler for us to follow, and more importantly, to fix when it's not working.

Debugging shell script is very hard, as it's written in a totally incomprehensible language.

comment:6 Changed 5 years ago by cjones051073 (Chris Jones)

I wouldn't go as far as saying its written using an incomprehensible language. The syntax itself is pretty basic, mostly just for loops and if statements. The problem is the intention, I have not clue what its trying to do (a few comments might have helped)...

Have you tried contacting Ionic for help ? I would do that before rolling back those changes completely..

comment:7 Changed 5 years ago by kencu (Ken)

on my list, once I decided where I wanted to go with this...

special-casing in even more complexity is out of the question...

comment:8 Changed 5 years ago by cjones051073 (Chris Jones)

Agree there. Less complexity not more is needed.

I.. and if what it does can be replaced with the muniversal PG , and thus simplify the standalone makefile I am all for that.

comment:9 Changed 5 years ago by Ionic (Mihai Moldovan)

I haven't noticed that until now through the GH comment, we've figured it out since.

Nope, you can't replace what the Makefile does with the muniversal PG. We actually do need the muniversal PG for what it does to not depend upon newer cctools versions and create a dependency loop. :)

The problem is the intention, I have not clue what its trying to do (a few comments might have helped)...

Heh, the new Makefile stuff has a lot of comments that should explain what it does and why we want to skip some stuff (essentially for older systems such as Tiger). It's just a bit hidden within the function itself because there is no (other) way to add comments to multi-line code.

comment:10 Changed 5 years ago by kencu (Ken)

This level of Makefile trickiness is just hard for me to follow -- but heck, it works now, and you're still breathing to help us figure it out, so good enough :>

comment:11 Changed 5 years ago by kencu (Ken)

I hope I didn't speak to soon. It build on Tiger -- I guess I better double check Leopard again.

comment:12 Changed 5 years ago by kencu (Ken)

No, Leopard still failed, but I have that sorted with another fix:

ld: duplicate symbol _fdopendir$INODE64$UNIX2003 in src/fdopendir.dl.o.inode64unix2003.ppc7400 and src/fdopendir.dl.o.inode64.ppc7400 for inferred architecture ppc7400
$ git diff
diff --git a/Makefile b/Makefile
index fec7b53..10d9c8c 100644
--- a/Makefile
+++ b/Makefile
@@ -167,7 +167,7 @@ define splitandfilterandmergemultiarch
                                        $${ld} -r "$${output}.inode32.$${arch}" "$${output}.inode64.$${arch}" -o "$${output}.$${arch}"; \
                                fi; \
                                ;; \
-                       ('i386'|'ppc') \
+                       ('i386'|'ppc'|'ppc7400') \
                                if [ '9' -gt "$${platform}" ]; then \
                                        $${ld} -r "$${output}.inode32.$${arch}" "$${output}.inode32unix2003.$${arch}" -o "$${output}.$${arch}"; \
                                else \

Whack-A-Mole... but this might be it...

comment:13 Changed 5 years ago by kencu (Ken)

Resolution: fixed
Status: assignedclosed

In 1b5c0fcc853bf5b3cb4dd6add5a3440fd40edfd5/macports-legacy-support (master):

fdopendir variations: allow ppc7400

this needs to be separately added
closes: #60147

comment:14 Changed 5 years ago by Ionic (Mihai Moldovan)

Ah, I didn't know that ppc7400 existed. I get confused by all these ppc variants; some systems call it just ppc, others are more specific. Looks fine.

comment:15 in reply to:  13 Changed 3 years ago by barracuda156

Replying to kencu:

In 1b5c0fcc853bf5b3cb4dd6add5a3440fd40edfd5/macports-legacy-support (master):

fdopendir variations: allow ppc7400

this needs to be separately added
closes: #60147

There are two versions of legacysupport-*.tcl in Macports (1.0 and 1.1), which one is to be used?

comment:16 Changed 3 years ago by cjones051073 (Chris Jones)

Use the latest. 1.0 is kept just for backwards compatibility.

comment:17 in reply to:  16 Changed 3 years ago by barracuda156

Replying to cjones051073:

Use the latest. 1.0 is kept just for backwards compatibility.

Thank you!

Note: See TracTickets for help on using tickets.