Build fails on OBS, but doesn't on actual fresh opensuse install.

I keep getting undefined reference errors, but I don’t know why. All dependencies are present, and it builds just fine on my personal system, but for some reason it can’t on the OBS. Can anyone take a look and see what could be going wrong?

  1. Did you check which library provides missing symbols and if this library is included in BuildRequires?
  2. Did you compare compiler/linker options on your system and on OBS?
  1. Yep, it keeps complaining about missing references that are found in imlib2-devel, and it also complains about having some missing references that are found in libX11-devel. Checking the log on OBS, it definitely installed.

  2. Yeah, using the same compiler.

And you get exactly the same command lines with exactly the same options locally?

Normally libraries should come after object files on command line. Linker sequentially iterates over arguments and is using each library to resolve missing references; it does not go back and tries previous arguments. In OBS log all library options are before object files, so I’d say failure to resolve is expected.

Yep, same commands are being ran on my personal system (libraries coming before objects) I’ll even include the full output.

gcc -Wall -zrelro -znow  -lX11 -lgif -lImlib2 -lXinerama -D VERSION=\"1.4.2\" -D HAVE_XINERAMA  -I/usr/lib64/gcc/x86_64-suse-linux/7/include  -I/usr/local/include  -I/usr/lib64/gcc/x86_64-suse-linux/7/include-fixed  -I/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/include  -I/usr/include   -c xrootgif.c -o xrootgif.o
gcc -Wall -zrelro -znow  -lX11 -lgif -lImlib2 -lXinerama -D VERSION=\"1.4.2\" -D HAVE_XINERAMA  -I/usr/lib64/gcc/x86_64-suse-linux/7/include  -I/usr/local/include  -I/usr/lib64/gcc/x86_64-suse-linux/7/include-fixed  -I/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/include  -I/usr/include   -c globals.c -o globals.o
gcc -Wall -zrelro -znow  -lX11 -lgif -lImlib2 -lXinerama -D VERSION=\"1.4.2\" -D HAVE_XINERAMA  -I/usr/lib64/gcc/x86_64-suse-linux/7/include  -I/usr/local/include  -I/usr/lib64/gcc/x86_64-suse-linux/7/include-fixed  -I/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/include  -I/usr/include   -c output.c -o output.o
gcc -Wall -zrelro -znow  -lX11 -lgif -lImlib2 -lXinerama -D VERSION=\"1.4.2\" -D HAVE_XINERAMA  -I/usr/lib64/gcc/x86_64-suse-linux/7/include  -I/usr/local/include  -I/usr/lib64/gcc/x86_64-suse-linux/7/include-fixed  -I/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/include  -I/usr/include   -c sample.c -o sample.o
gcc -Wall -zrelro -znow  -lX11 -lgif -lImlib2 -lXinerama -D VERSION=\"1.4.2\" -D HAVE_XINERAMA  -I/usr/lib64/gcc/x86_64-suse-linux/7/include  -I/usr/local/include  -I/usr/lib64/gcc/x86_64-suse-linux/7/include-fixed  -I/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/include  -I/usr/include   -c gif.c -o gif.o
gcc -Wall -zrelro -znow  -lX11 -lgif -lImlib2 -lXinerama -D VERSION=\"1.4.2\" -D HAVE_XINERAMA  -I/usr/lib64/gcc/x86_64-suse-linux/7/include  -I/usr/local/include  -I/usr/lib64/gcc/x86_64-suse-linux/7/include-fixed  -I/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/include  -I/usr/include   -c pixmap_allocate.c -o pixmap_allocate.o
gcc -Wall -zrelro -znow  -lX11 -lgif -lImlib2 -lXinerama -D VERSION=\"1.4.2\" -D HAVE_XINERAMA  -I/usr/lib64/gcc/x86_64-suse-linux/7/include  -I/usr/local/include  -I/usr/lib64/gcc/x86_64-suse-linux/7/include-fixed  -I/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/include  -I/usr/include   -c daemon.c -o daemon.o
gcc -zrelro -znow  -lX11 -lgif -lImlib2 -lXinerama xrootgif.o globals.o output.o sample.o gif.o pixmap_allocate.o daemon.o -o xrootgif

Looks largely the same as the OBS log, except that it succeeded

Build’s fine locally, with just configure or using osc locally?

Try changing your configure to use the macro which is %configure as it adds extra build flags.

Builds fine locally without osc (I haven’t tried it with osc yet) and %configure didn’t do anything. I even swapped out the other commands with macros (Such as switching make with %make_build) and still has the same error.

Hi should be;

$(CC) $(LNFLAGS) -o xrootgif $(OBJ) $(LIBRARIES)

Well, this fails for me as expected and if I reverse order everything works. So I would suggest you patch Makefile so it works. Why it does not fail on your system remains mystery, but that’s out of scope of this thread. So far OBS behaves as it should.

Pushed an SR to you…

Thanks guys. I wish I knew why it builds on my system, because that kinda irks me as a C programmer lol

Not sure, I’m not a programmer…just a packager… it’s still doing some funky things with that Makefile since it runs gcc a second time. IMHO it really needs to be fixed properly to confirm to the standard defines used in a Makefile?

I might fork it sometime later and use a build system i’m more familiar with, like meson. It doesn’t look that hard to convert, but i’ll guess i’ll find out haha