MayaPosch / NymphRPC

Versatile and fast remote procedure call library.
BSD 3-Clause "New" or "Revised" License
62 stars 10 forks source link

Compiling with just make breaks on Alpine Linux #3

Closed PureTryOut closed 3 years ago

PureTryOut commented 4 years ago

Running just make causes build issues when compiling the tests.

g++ -o bin/nymph_client obj/nymph_test_client.o -L ../../lib -lnymphrpc -lPocoNet -lPocoUtil -lPocoFoundation -lPocoJSON -pthread
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lnymphrpc
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:36: bin/nymph_client] Error 1
make[1]: Leaving directory '/home/bart/Git/aports/testing/nymphrpc/src/NymphRPC-288a360f91dab3d14de92cc78d0fa15a71061a4a/test/nymph_test_client'
make: *** [Makefile:66: test-client] Error 2
make: *** Waiting for unfinished jobs....
g++ -o bin/nymph_server obj/nymph_test_server.o -L ../../lib -lnymphrpc -lPocoNet -lPocoUtil -lPocoFoundation -lPocoJSON -pthread
g++: error: obj/nymph_test_server.o: No such file or directory
make[1]: *** [Makefile:35: bin/nymph_server] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/bart/Git/aports/testing/nymphrpc/src/NymphRPC-288a360f91dab3d14de92cc78d0fa15a71061a4a/test/nymph_test_server'
make: *** [Makefile:69: test-server] Error 2

However, first running make lib and then make test manually seems to work fine! I'm unsure why this is, as reading the makefile the default make target seems to do just that :thinking:

MayaPosch commented 4 years ago

Is this when running make in the NymphRPC or NymphCast folder? It's not quite clear to me from the output you quoted.

PureTryOut commented 4 years ago

NymphRPC

MayaPosch commented 4 years ago

I have been unable to replicate it on either MSYS2 or any of the Linux versions I have here (Manjaro, Ubuntu, Raspbian). From the waiting for unfinished jobs... part it does suggest that the problem is that Make on Alpine is not running the jobs in the right dependency order.

I have made the dependencies in the Makefiles more explicit now, please retest :)

PureTryOut commented 4 years ago

No luck :cry:

g++ -o bin/nymph_client obj/nymph_test_client.o -L ../../lib -lnymphrpc -lPocoNet -lPocoUtil -lPocoFoundation -lPocoJSON -pthread
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lnymphrpc
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:36: bin/nymph_client] Error 1
make[1]: Leaving directory '/home/bart/Git/aports/testing/nymphrpc/src/NymphRPC-eff8a0188f0b28afdf610406f9780629c3e64911/test/nymph_test_client'
make: *** [Makefile:66: test-client] Error 2
make: *** Waiting for unfinished jobs....
g++ -o bin/nymph_server obj/nymph_test_server.o -L ../../lib -lnymphrpc -lPocoNet -lPocoUtil -lPocoFoundation -lPocoJSON -pthread
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lnymphrpc
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:35: bin/nymph_server] Error 1
make[1]: Leaving directory '/home/bart/Git/aports/testing/nymphrpc/src/NymphRPC-eff8a0188f0b28afdf610406f9780629c3e64911/test/nymph_test_server'
make: *** [Makefile:69: test-server] Error 2
MayaPosch commented 4 years ago

I ran the same make command on Alpine Linux (3.12_alpha20200122) in a VirtualBox VM and I could not replicate the reported issue.

MayaPosch commented 4 years ago

Steps I took:

PureTryOut commented 3 years ago

I can not reproduce this anymore, not sure why this happened earlier...

PureTryOut commented 3 years ago

Actually, I couldn't reproduce it locally anymore but the Alpine Linux CI still fails on it.

https://gitlab.alpinelinux.org/alpine/aports/-/jobs/450857/raw

MayaPosch commented 3 years ago

Looks like you're compiling NymphRPC with make and not make lib? The former also builds the test client, which needs to find libnymphrpc. For a CI setting like this just building the lib should be sufficient, I think?

PureTryOut commented 3 years ago

make lib to get the package running yes. make to try and get the tests to work

For CI we require running unit tests when they are available to verify functionality of the resulting package. No just building isn't enough.

MayaPosch commented 3 years ago

I have made the lib target an explicit dependency for the test client and server targets. This should ensure that the the library is always built before the binaries.

On a sidenote: these test binaries are currently not used for any unit testing or compile-time tests. They're reference implementations used during development and for documentation purposes. This could probably be marked more clearly in the (lacking) documentation.

PureTryOut commented 3 years ago

That seems to have solved it, thanks!

On a sidenote: these test binaries are currently not used for any unit testing or compile-time tests.

Ah, so not useful for distros then. I'll disable it, thanks.