pkgconf - still not building with MIPSPro -
Raion - 05-02-2021
pkgconf, a replacement for, and lighterweight version of, pkg-config is not building with MIPSPro. We've discussed this before:
~/pkgconf-0.9.6 % /usr/local/bin/make -j3
c99 -c -O2 -mips4 -TARG:proc=r10000 -DLIBDIR=\"/usr/share/bsd/lib32\" -DINCLUDEDIR=\"/usr/share/bsd/include\" -DPKG_DEFAULT_PATH=\"/usr/share/bsd/lib32/pkgconfig:/u
sr/share/pkgconfig\" -DSYSTEM_INCLUDEDIR=\"/usr/share/bsd/include\" -DSYSTEM_LIBDIR=\"/usr/share/bsd/lib32\" -Wall -I. -I/usr/include -I/usr/gnu/include main.c -o
main.o
c99 -c -O2 -mips4 -TARG:proc=r10000 -DLIBDIR=\"/usr/share/bsd/lib32\" -DINCLUDEDIR=\"/usr/share/bsd/include\" -DPKG_DEFAULT_PATH=\"/usr/share/bsd/lib32/pkgconfig:/u
sr/share/pkgconfig\" -DSYSTEM_INCLUDEDIR=\"/usr/share/bsd/include\" -DSYSTEM_LIBDIR=\"/usr/share/bsd/lib32\" -Wall -I. -I/usr/include -I/usr/gnu/include cache.c -o
cache.o
c99 -c -O2 -mips4 -TARG:proc=r10000 -DLIBDIR=\"/usr/share/bsd/lib32\" -DINCLUDEDIR=\"/usr/share/bsd/include\" -DPKG_DEFAULT_PATH=\"/usr/share/bsd/lib32/pkgconfig:/u
sr/share/pkgconfig\" -DSYSTEM_INCLUDEDIR=\"/usr/share/bsd/include\" -DSYSTEM_LIBDIR=\"/usr/share/bsd/lib32\" -Wall -I. -I/usr/include -I/usr/gnu/include pkg.c -o p
kg.o
cc-1110 c99: REMARK File = main.c, Line = 627
The indicated statement is not reachable.
break;
^
cc-3943 c99: REMARK File = pkg.c, Line = 474
declaration hides variable "pkg" (declared at line 463)
pkg_t *pkg;
^
Signal: Segmentation fault in Scope Setup phase.
Error: Signal Segmentation fault in phase Scope Setup -- processing aborted
c99 ERROR: /usr/lib32/cmplrs/fec died due to signal 4
c99 ERROR: core dumped
Makefile:47: recipe for target 'pkg.o' failed
Clearly, something in pkg.c is killing the compiler. It's post-preprocessor, but during compilation and after line 474
https://github.com/pkgconf/pkgconf/releases/tag/pkgconf-0.9.6
If someone wants to try the same version, though later versions have similar problems with pkg.c when you get over the hump.
I know this is a C scope issue, but I don't know how to diagnose it further. Does this mean that a C function is just going too deep in scope???
RE: pkgconf - still not building with MIPSPro -
jpstewart - 05-03-2021
I don't know if either of the "REMARKs" is the root cause of the problem, but they're easy to fix.
(05-02-2021, 10:50 PM)Raion Wrote: cc-1110 c99: REMARK File = main.c, Line = 627
The indicated statement is not reachable.
break;
^
Line 627 of main.c in that particular version of pkgconf is a break statement right after a return. It is obviously unreachable and (understandably) MIPSPro doesn't like it. Just delete the line with break on it (right after "return EXIT_FAILURE;").
(05-02-2021, 10:50 PM)Raion Wrote: cc-3943 c99: REMARK File = pkg.c, Line = 474
declaration hides variable "pkg" (declared at line 463)
pkg_t *pkg;
^
This one is a case of declaring the same variable twice, on lines 463 and 474. Delete the second declaration on line 474.
I suspect it is the double-declaration that is confusing the compiler to the point of segfaulting but I make no promises (LOL).
RE: pkgconf - still not building with MIPSPro -
Raion - 05-03-2021
% gmake -j3
c99 -c -O3 -mips4 -TARG:proc=r10000 -DLIBDIR=\"/usr/share/bsd/lib32\" -DINCLUDEDIR=\"/usr/share/bsd/include\" -DPKG_DEFAULT_PATH=\"/usr/share/bsd/lib32/pkgconfig:/usr/share/pkgconfig\" -DSYSTEM_INCLUDEDIR=\"/usr/share/bsd/include\" -DSYSTEM_LIBDIR=\"/usr/share/bsd/lib32\" -Wall -I. -I/usr/include main.c -o main.o
c99 -c -O3 -mips4 -TARG:proc=r10000 -DLIBDIR=\"/usr/share/bsd/lib32\" -DINCLUDEDIR=\"/usr/share/bsd/include\" -DPKG_DEFAULT_PATH=\"/usr/share/bsd/lib32/pkgconfig:/usr/share/pkgconfig\" -DSYSTEM_INCLUDEDIR=\"/usr/share/bsd/include\" -DSYSTEM_LIBDIR=\"/usr/share/bsd/lib32\" -Wall -I. -I/usr/include pkg.c -o pkg.o
Signal: Segmentation fault in Scope Setup phase.
Error: Signal Segmentation fault in phase Scope Setup -- processing aborted
c99 ERROR: /usr/lib32/cmplrs/fec died due to signal 4
c99 ERROR: core dumped
gmake: *** [pkg.o] Error 32
gmake: *** Waiting for unfinished jobs....
I didn't anticipate that would fix it.
RE: pkgconf - still not building with MIPSPro -
jpstewart - 05-03-2021
Oh well, it was worth a shot. I was hoping "Scope Setup" was referring to the scope of the duplicate variable names. I guess not. (Aside: warnings like those -- especially since they were from just plain sloppy code -- really get on my nerves and I can't fight the tendency to fix them.)
There's something wrong with the input C file that will require a much deeper dive than I have time for. Valid C should never cause a compiler crash. Maybe somebody with more knowledge of the compiler internals will pop up to offer some assistance....
RE: pkgconf - still not building with MIPSPro -
Raion - 05-03-2021
Yeah. PKGCONF is mostly a better option than pkg-config for three reasons:
1. it doesn't depend on anything else
2. It is currently developed and exceeds pkg-config specifications
3. It has better performance
I can build it with GCC - it's not the /end/ of the world.
RE: pkgconf - still not building with MIPSPro -
jpstewart - 05-05-2021
I spent a bit more time on this yesterday. I had three more ideas to explore. Unfortunately they all failed. I'm working on one more.
RE: pkgconf - still not building with MIPSPro -
jpstewart - 05-06-2021
And that's yet another dead end for me on this one. I give up.
I tried to:
- Remove the duplicate variable of the same name, as mentioned earlier in this thread.
- Remove the variable declarations from "if" blocks and other similar contexts. That's allowed in c99 but not older standards, so I thought maybe MIPSPro wasn't handling it correctly. Not the problem.
- Remove the static variables from functions on the chance that they were confusing the compiler. (Something I saw online gave me that idea.) Still not the problem.
I post my failures here so that other people don't waste their time duplicating the effort. (I think there was a fourth failure, but I'm drawing a blank at the moment.)
RE: pkgconf - still not building with MIPSPro -
Raion - 05-06-2021
Don't worry about it then. I will see if I can get farther.
RE: pkgconf - still not building with MIPSPro -
Raion - 05-07-2021
Code:
static pkg_t pkg_config_virtual = {
.id = "pkg-config",
.realname = "pkg-config",
.description = "virtual package defining pkg-config API version supported",
.url = PACKAGE_BUGREPORT,
.version = PKG_PKGCONFIG_VERSION_EQUIV,
.flags = PKG_PROPF_VIRTUAL,
.vars = {
.head = &(pkg_node_t){
.prev = NULL,
.next = NULL,
.data = &(pkg_tuple_t){
.key = "pc_path",
},
},
.tail = NULL,
},
};
It's this.
Something here is breaking MIPSPro. I figured it out by blindly deleting functions and structs from the file one at a time.
RE: pkgconf - still not building with MIPSPro -
Raion - 05-07-2021
update. This struct appears once in the code of this version of pkgconf, in a function verifying the dependency graph. I think this struct needs to be changed around but I have no idea where to begin. I guess I'll poke at it later when I'm well-rested, but I'm glad to be near the end of this.
Once I know this, I can go to higher versions of pkgconf and fix it there and perhaps upstream a patch. Maybe. I doubt it, but still.