#51 Linkage issue with gcc (at least Linux)

Closed
opened 1 year ago by devnexen · 2 comments
devnexen commented 1 year ago
Collaborator

With gcc on linux
^~~~~~~~ sapi/cli/main.c:112:34: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] } else if(c == 'm' || c == 'M' && SyStrlen(argv[n]) > 2) { ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ sapi/cli/main.c:144:7: warning: implicit declaration of function ‘ph7_vm_init’; did you mean ‘ph7_lib_init’? [-Wimplicit-function-declaration] rc = ph7_vm_init(pEngine, &pVm, dump_vm); ^~~~~~~~~~~ ph7_lib_init make[1]: Leaving directory '/home/dcarlier/Contribs/Aer' gcc -o build/aer -Wl,--export-dynamic -Wl,-rpath,/home/dcarlier/Contribs/Aer/binary -Lbuild -laer build/sapi/cli/main.o /usr/bin/ld: build/sapi/cli/main.o: in function Fatal':
main.c:(.text+0x19): undefined reference to ph7_lib_shutdown' /usr/bin/ld: build/sapi/cli/main.o: in function main':
main.c:(.text+0x1a0): undefined reference to SyStrlen' /usr/bin/ld: main.c:(.text+0x203): undefined reference to ph7_init'
/usr/bin/ld: main.c:(.text+0x237): undefined reference to ph7_config' /usr/bin/ld: main.c:(.text+0x26e): undefined reference to ph7_config'
/usr/bin/ld: main.c:(.text+0x289): undefined reference to ph7_vm_init' /usr/bin/ld: main.c:(.text+0x2da): undefined reference to ph7_vm_config'
/usr/bin/ld: main.c:(.text+0x30f): undefined reference to ph7_vm_config' /usr/bin/ld: main.c:(.text+0x340): undefined reference to ph7_vm_config'
/usr/bin/ld: main.c:(.text+0x36a): undefined reference to ph7_compile_file' /usr/bin/ld: main.c:(.text+0x3da): undefined reference to ph7_vm_config'
/usr/bin/ld: main.c:(.text+0x3f9): undefined reference to ph7_vm_exec' /usr/bin/ld: main.c:(.text+0x417): undefined reference to ph7_vm_dump'
/usr/bin/ld: main.c:(.text+0x423): undefined reference to ph7_vm_release' /usr/bin/ld: main.c:(.text+0x42f): undefined reference to ph7_release'
collect2: error: ld returned 1 exit status
make: *** [Makefile:154: cli] Error 1
`

while with clang
make build/modules/ctype/ctype.o make[1]: Entering directory '/home/dcarlier/Contribs/Aer' mkdir -p build/modules/ctype/ clang -fPIC -Iinclude -I. -W -Wunused -Wall -DPH7_LIBRARY_SUFFIX=\".so\" -c modules/ctype/ctype.c -o build/modules/ctype/ctype.o make[1]: Leaving directory '/home/dcarlier/Contribs/Aer' clang -o build/ctype.so -Wl,--export-dynamic -shared build/modules/ctype/ctype.o
works as expected.
Most likely Darwin works just fine too.

With gcc on linux ` ^~~~~~~~ sapi/cli/main.c:112:34: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] } else if(c == 'm' || c == 'M' && SyStrlen(argv[n]) > 2) { ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ sapi/cli/main.c:144:7: warning: implicit declaration of function ‘ph7_vm_init’; did you mean ‘ph7_lib_init’? [-Wimplicit-function-declaration] rc = ph7_vm_init(pEngine, &pVm, dump_vm); ^~~~~~~~~~~ ph7_lib_init make[1]: Leaving directory '/home/dcarlier/Contribs/Aer' gcc -o build/aer -Wl,--export-dynamic -Wl,-rpath,/home/dcarlier/Contribs/Aer/binary -Lbuild -laer build/sapi/cli/main.o /usr/bin/ld: build/sapi/cli/main.o: in function `Fatal': main.c:(.text+0x19): undefined reference to `ph7_lib_shutdown' /usr/bin/ld: build/sapi/cli/main.o: in function `main': main.c:(.text+0x1a0): undefined reference to `SyStrlen' /usr/bin/ld: main.c:(.text+0x203): undefined reference to `ph7_init' /usr/bin/ld: main.c:(.text+0x237): undefined reference to `ph7_config' /usr/bin/ld: main.c:(.text+0x26e): undefined reference to `ph7_config' /usr/bin/ld: main.c:(.text+0x289): undefined reference to `ph7_vm_init' /usr/bin/ld: main.c:(.text+0x2da): undefined reference to `ph7_vm_config' /usr/bin/ld: main.c:(.text+0x30f): undefined reference to `ph7_vm_config' /usr/bin/ld: main.c:(.text+0x340): undefined reference to `ph7_vm_config' /usr/bin/ld: main.c:(.text+0x36a): undefined reference to `ph7_compile_file' /usr/bin/ld: main.c:(.text+0x3da): undefined reference to `ph7_vm_config' /usr/bin/ld: main.c:(.text+0x3f9): undefined reference to `ph7_vm_exec' /usr/bin/ld: main.c:(.text+0x417): undefined reference to `ph7_vm_dump' /usr/bin/ld: main.c:(.text+0x423): undefined reference to `ph7_vm_release' /usr/bin/ld: main.c:(.text+0x42f): undefined reference to `ph7_release' collect2: error: ld returned 1 exit status make: *** [Makefile:154: cli] Error 1 ` while with clang `make build/modules/ctype/ctype.o make[1]: Entering directory '/home/dcarlier/Contribs/Aer' mkdir -p build/modules/ctype/ clang -fPIC -Iinclude -I. -W -Wunused -Wall -DPH7_LIBRARY_SUFFIX=\".so\" -c modules/ctype/ctype.c -o build/modules/ctype/ctype.o make[1]: Leaving directory '/home/dcarlier/Contribs/Aer' clang -o build/ctype.so -Wl,--export-dynamic -shared build/modules/ctype/ctype.o ` works as expected. Most likely Darwin works just fine too.
belliash commented 1 year ago
Poster
Owner

This looks very strange to me. As you can see it builds just fine:

Both branches can be built with GCC, both on server and on my PC, at least using GCC 9.1.0.

This looks very strange to me. As you can see it builds just fine: * master: https://git.codingworkshop.eu.org/ci/status/1557834841_3cc347f25f40ad69abca806e6104ceef3becd31c.txt * oop_fixes: https://git.codingworkshop.eu.org/ci/status/1559043721_1175219ad455c01e2288342a3295c55646763254.txt Both branches can be built with GCC, both on server and on my PC, at least using GCC 9.1.0.
devnexen commented 1 year ago
Poster
Collaborator

That must be a false alarm. Fails only on one machine (Ubuntu disco). FreeBSD and another Linux (older) box works ok with gcc.

That must be a false alarm. Fails only on one machine (Ubuntu disco). FreeBSD and another Linux (older) box works ok with gcc.
devnexen closed this issue 1 year ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.