kristapsdz / sblg

static blog utility
https://kristaps.bsd.lv/sblg
ISC License
96 stars 14 forks source link

sblg 0.6.0 fails to build on macOS #22

Open hakoyamah opened 1 week ago

hakoyamah commented 1 week ago

Hi! I have found that sblg (version >= 0.5.9) fails to build on macOS. It cannot find expat. Test Environments OS: macOS Sonoma, Monterey CPU: x86_64 and arm64

$ ./configure ... $ make ... Undefined symbols for architecture arm64: "_XML_ErrorString", referenced from: ... ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [sblg] Error 1

Workaround: link -lexpat; add something like the following in configure or Makefile

if [ "$(uname)" = "Darwin" ]; then LDFLAGS="$LDFLAGS -lexpat" fi

or

ifeq ($(shell uname), Darwin) LDADD += -lexpat endif

kristapsdz commented 1 week ago

Interesting---it should just pick that up. What happens when you run pkg-config --libs expat? If it's empty, can you also check the return code of the command?

On 15 November 2024 19:51:31 GMT+05:00, hakoyamah @.***> wrote:

Hi! I have found that sblg (version >= 0.5.9) fails to build on macOS. It cannot find expat. Test Environments OS: macOS Sonoma, Monterey CPU: x86_64 and arm64

./configure

...

make

... Undefined symbols for architecture arm64: "_XML_ErrorString", referenced from: ... ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [sblg] Error 1

Workaround: link -lexpat; add something like the following in configure or Makefile

if [ "$(uname)" = "Darwin" ]; then LDFLAGS="$LDFLAGS -lexpat" fi

or

ifeq ($(shell uname), Darwin) LDADD += -lexpat endif

-- Reply to this email directly or view it on GitHub: https://github.com/kristapsdz/sblg/issues/22 You are receiving this because you are subscribed to this thread.

Message ID: @.***>

hakoyamah commented 1 week ago

% pkg-config --libs expat -L/opt/local/lib -lexpat

I installed expat using macports instead of homebrew, so the location of the lib is /opt/local/lib.

Hiroshi

2024/11/18 10:03、Kristaps Dz @.***>のメール:

Interesting---it should just pick that up. What happens when you run pkg-config --libs expat? If it's empty, can you also check the return code of the command?

On 15 November 2024 19:51:31 GMT+05:00, hakoyamah @.***> wrote:

Hi! I have found that sblg (version >= 0.5.9) fails to build on macOS. It cannot find expat. Test Environments OS: macOS Sonoma, Monterey CPU: x86_64 and arm64

./configure

...

make

... Undefined symbols for architecture arm64: "_XML_ErrorString", referenced from: ... ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [sblg] Error 1

Workaround: link -lexpat; add something like the following in configure or Makefile

if [ "$(uname)" = "Darwin" ]; then LDFLAGS="$LDFLAGS -lexpat" fi

or

ifeq ($(shell uname), Darwin) LDADD += -lexpat endif

-- Reply to this email directly or view it on GitHub: https://github.com/kristapsdz/sblg/issues/22 You are receiving this because you are subscribed to this thread.

Message ID: @.> — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.>

kristapsdz commented 1 week ago

That's weird... The Makefile uses pkg-config to specify its linker arguments, so use probably just that function that's not in mac's expat. Can you copy the output of make so I can be doubly sure? I'll have access to a sonoma machine end of the week but not now.

On 18 November 2024 10:00:03 GMT+05:00, hakoyamah @.***> wrote:

% pkg-config --libs expat -L/opt/local/lib -lexpat

I installed expat using macports instead of homebrew, so the location of the lib is /opt/local/lib.

Hiroshi

2024/11/18 10:03、Kristaps Dz @.***>のメール:

Interesting---it should just pick that up. What happens when you run pkg-config --libs expat? If it's empty, can you also check the return code of the command?

On 15 November 2024 19:51:31 GMT+05:00, hakoyamah @.***> wrote:

Hi! I have found that sblg (version >= 0.5.9) fails to build on macOS. It cannot find expat. Test Environments OS: macOS Sonoma, Monterey CPU: x86_64 and arm64

./configure

...

make

... Undefined symbols for architecture arm64: "_XML_ErrorString", referenced from: ... ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [sblg] Error 1

Workaround: link -lexpat; add something like the following in configure or Makefile

if [ "$(uname)" = "Darwin" ]; then LDFLAGS="$LDFLAGS -lexpat" fi

or

ifeq ($(shell uname), Darwin) LDADD += -lexpat endif

-- Reply to this email directly or view it on GitHub: https://github.com/kristapsdz/sblg/issues/22 You are receiving this because you are subscribed to this thread.

Message ID: @.> — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.>

-- Reply to this email directly or view it on GitHub: https://github.com/kristapsdz/sblg/issues/22#issuecomment-2481958660 You are receiving this because you commented.

Message ID: @.***>

hakoyamah commented 1 week ago

OK. here you are.

[m2:~/Desktop/sblg-0.6.0 2] hako% ./configure
config.log: writing...
ld: unknown options: -soname
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure.local: no (fully automatic configuration)
arc4random: yes
blowfish: no
b64_ntop: yes (with -lresolv)
capsicum: no
crypt: yes
crypt_newhash: no
endian_h: no
err: yes
explicit_bzero: no
fts: yes
getexecname: no
getprogname: yes
INFTIM: no
landlock: no
lib_socket: yes
md5: no
memmem: yes
memrchr: no
memset_s: yes
mkfifoat: yes
mknodat: yes
osbyteorder_h: yes
PASSWORD_LEN: yes
PATH_MAX: yes
pledge: no
program_invocation_short_name: no
readpassphrase: yes
reallocarray: no
recallocarray: no
sandbox_init: yes
scan_scaled: no
seccomp-filter: no
setresgid: no
setresuid: no
sha2: no
SOCK_NONBLOCK: no
static: no
strlcat: yes
strlcpy: yes
strndup: yes
strnlen: yes
strtonum: yes
sys_byteorder_h: no
sys_endian_h: no
sys_mkdev_h: no
sys_sysmacros_h: no
sys_queue: yes
sys_tree: no
termios: yes
timingsafe_bcmp: no
unveil: no
WAIT_ANY: yes
__progname: yes
config.h: written
Makefile.configure: written
[m2:~/Desktop/sblg-0.6.0 2] hako% make
echo "#define VERSION \"0.6.0\"" >version.h
cc -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter -c -o compats.o compats.c
cc -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter -c -o main.o main.c
main.c:60:6: warning: 'sandbox_init' is deprecated: first deprecated in macOS 10.8 - No longer supported [-Wdeprecated-declarations]
60 | if (sandbox_init
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sandbox.h:48:5: note: 'sandbox_init' has been explicitly marked deprecated here
48 | int sandbox_init(const char *profile, uint64_t flags, char **errorbuf);
| ^
main.c:61:7: warning: 'kSBXProfileNoNetwork' is deprecated: first deprecated in macOS 10.8 - No longer supported [-Wdeprecated-declarations]
61 | (kSBXProfileNoNetwork, SANDBOX_NAMED, NULL) < 0)
| ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sandbox.h:68:19: note: 'kSBXProfileNoNetwork' has been explicitly marked deprecated here
68 | extern const char kSBXProfileNoNetwork[];
| ^
2 warnings generated.
cc -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter -c -o compile.o compile.c
cc -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter -c -o linkall.o linkall.c
cc -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter -c -o grok.o grok.c
cc -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter -c -o util.o util.c
cc -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter -c -o atom.o atom.c
cc -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter -c -o article.o article.c
cc -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter -c -o json.o json.c
cc -g -W -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter -c -o listtags.o listtags.c
cc -o sblg compats.o main.o compile.o linkall.o grok.o util.o atom.o article.o json.o listtags.o
Undefined symbols for architecture arm64:
"_XML_ErrorString", referenced from:
_compile in compile.o
_linkall in linkall.o
_linkall_r in linkall.o
_logerr in grok.o
_atom in atom.o
"_XML_GetCurrentColumnNumber", referenced from:
_compile in compile.o
_linkall in linkall.o
_linkall_r in linkall.o
_logerrx in grok.o
_atom in atom.o
"_XML_GetCurrentLineNumber", referenced from:
_compile in compile.o
_linkall in linkall.o
_linkall_r in linkall.o
_logerrx in grok.o
_atom in atom.o
"_XML_GetErrorCode", referenced from:
_compile in compile.o
_linkall in linkall.o
_linkall_r in linkall.o
_logerr in grok.o
_atom in atom.o
"_XML_Parse", referenced from:
_compile in compile.o
_linkall in linkall.o
_linkall_r in linkall.o
_sblg_parse in grok.o
_atom in atom.o
"_XML_ParserCreate", referenced from:
_main in main.o
"_XML_ParserFree", referenced from:
_main in main.o
"_XML_ParserReset", referenced from:
_compile in compile.o
_linkall in linkall.o
_linkall_r in linkall.o
_sblg_parse in grok.o
_atom in atom.o
"_XML_SetDefaultHandlerExpand", referenced from:
_compile in compile.o
_linkall in linkall.o
_linkall_r in linkall.o
_sblg_parse in grok.o
_atom in atom.o
_tmpl_begin in atom.o
_tmpl_begin in atom.o
_tmpl_begin in atom.o
...
"_XML_SetElementHandler", referenced from:
_compile in compile.o
_template_begin in compile.o
_article_end in compile.o
_linkall in linkall.o
_tmpl_begin in linkall.o
_tmpl_begin in linkall.o
_tmpl_begin in linkall.o
...
"_XML_SetSkippedEntityHandler", referenced from:
_compile in compile.o
_linkall in linkall.o
_linkall_r in linkall.o
_sblg_parse in grok.o
"_XML_SetStartElementHandler", referenced from:
_sblg_parse in grok.o
"_XML_SetUserData", referenced from:
_compile in compile.o
_linkall in linkall.o
_linkall_r in linkall.o
_sblg_parse in grok.o
_atom in atom.o
"_XML_StopParser", referenced from:
_tmpl_begin in atom.o
_up_begin in atom.o
_id_begin in atom.o
_id_end in atom.o
_id_end in atom.o
"_XML_UseForeignDTD", referenced from:
_compile in compile.o
_linkall in linkall.o
_linkall_r in linkall.o
_sblg_parse in grok.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sblg] Error 1