Skip to content

Conversation

@michaelortmann
Copy link
Member

@michaelortmann michaelortmann commented Jul 4, 2025

Found by: michaelortmann
Patch by: michaelortmann
Fixes:

One-line summary:
Fix portability regarding compat/base64, python mod cflags and c compilers like zig cc

Additional description (if needed):
$ CC="zig cc -Wno-deprecated-non-prototype" ./configure && make config && make works now :)

Test cases demonstrating functionality (if applicable):
Fixes all make errors with zig cc:
1.

zig cc -Wno-deprecated-non-prototype -std=gnu99 -g -O2 -pipe -Wall -I.. -I..  -DHAVE_CONFIG_H -I/usr/include -lpthread -o ../eggdrop bg.o botcmd.o botmsg.o botnet.o chanprog.o cmds.o dcc.o dccutil.o dns.o flags.o language.o match.o main.o mem.o misc.o misc_file.o modules.o net.o rfc1459.o tcl.o tcldcc.o tclhash.o tclmisc.o tcluser.o tls.o userent.o userrec.o users.o  -L/usr/lib -ltcl8.6  -lz -lpthread -lm -lssl -lcrypto  md5/md5c.o compat/*.o `cat mod/mod.xlibs`
ld.lld: error: undefined symbol: b64_ntop
>>> referenced by modules.c:182
>>>               modules.o:(global_table)

ld.lld: error: undefined symbol: b64_pton
>>> referenced by modules.c:182
>>>               modules.o:(global_table)
make[2]: *** [Makefile:48: link] Error 1

Before (note the underscores):

$ nm src/compat/base64.o
0000000000000000 T __b64_ntop
00000000000001c0 T __b64_pton

After:

$ nm src/compat/base64.o
0000000000000000 T egg_b64_ntop
00000000000001c0 T egg_b64_pton

2.

zig cc -Wno-deprecated-non-prototype -fPIC -I/usr/include/python3.13 -I/usr/include/python3.13  -fno-strict-overflow -Wsign-compare -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -ffat-lto-objects -DNDEBUG -g -O3 -Wall -std=gnu99 -g -O2 -pipe -Wall -I. -I../../.. -I../../.. -I../../../src/mod  -DHAVE_CONFIG_H -I/usr/include  -DMAKING_MODS -c .././python.mod/python.c && mv -f python.o ../
error: unsupported preprocessor arg: -D_FORTIFY_SOURCE
make[2]: *** [Makefile:19: ../python.o] Error 1

3.

zig cc -Wno-deprecated-non-prototype -fPIC -I/usr/include/python3.13 -I/usr/include/python3.13 -fno-strict-overflow -Wsign-compare -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -std=gnu99 -g -O2 -pipe -Wall -I. -I../../.. -I../../.. -I../../../src/mod  -DHAVE_CONFIG_H -I/usr/include  -DMAKING_MODS -c .././python.mod/python.c && mv -f python.o ../
error: unknown target CPU 'generic'
note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, rocketlake, icelake-server, tigerlake, sapphirerapids, alderlake, raptorlake, meteorlake, arrowlake, arrowlake-s, lunarlake, gracemont, pantherlake, sierraforest, grandridge, graniterapids, graniterapids-d, emeraldrapids, clearwaterforest, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, znver4, znver5, x86-64, x86-64-v2, x86-64-v3, x86-64-v4
make[2]: *** [Makefile:19: ../python.o] Error 1

@michaelortmann michaelortmann changed the title Fix portability regarding compat/base64, python mod cflags and c compilers like zig cc (WIP) Fix portability regarding compat/base64, python mod cflags and c compilers like zig cc Jul 4, 2025
@michaelortmann
Copy link
Member Author

Something is still not right regarding base64: Can't load modules server: /home/michael/eggdrop/modules/server.so: undefined symbol: __b64_pton

@michaelortmann michaelortmann changed the title (WIP) Fix portability regarding compat/base64, python mod cflags and c compilers like zig cc Fix portability regarding compat/base64, python mod cflags and c compilers like zig cc Jul 5, 2025
@michaelortmann
Copy link
Member Author

michaelortmann commented Jul 5, 2025

this was symbol resolving hell. finally i fixed it by putting the include for resolv.h in one and only one place in eggdrop and fix it proper there. if configure didnt find a way to use a system base64 it will make eggdrop use its own compat functions. still eggdrop would include resolv.h for dns and stuff, and resolv.h was still defining b64() funcs to __b64() funcs in some cases / systems. the the final fix was to undef b64() funcs right after including resolv.h if HAVE_BASE64 wasnt set by configure.

@vanosg vanosg added this to the v1.10.2 milestone Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants