github / cmark-gfm

GitHub's fork of cmark, a CommonMark parsing and rendering library and program in C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

make install changes cmark-gfm (or uses an old copy?) causing an error due to a missing library

Poikilos opened this issue · comments

This seems to be the root cause of #163 still happening on Fedora.

Here is a demonstration (where I had a bad version installed already):

[redacted@redacted build]$ sudo make install
[ 35%] Built target libcmark-gfm
[ 46%] Built target libcmark-gfm-extensions
[ 48%] Built target cmark-gfm
[ 84%] Built target libcmark-gfm_static
[ 94%] Built target libcmark-gfm-extensions_static
[100%] Built target api_test
Install the project...
-- Install configuration: "Release"
-- Up-to-date: /usr/local/bin/cmark-gfm
-- Up-to-date: /usr/local/lib/libcmark-gfm.so.0.29.0.gfm.6
-- Up-to-date: /usr/local/lib/libcmark-gfm.so
-- Up-to-date: /usr/local/lib/libcmark-gfm.a
-- Up-to-date: /usr/local/lib/pkgconfig/libcmark-gfm.pc
-- Up-to-date: /usr/local/include/cmark-gfm.h
-- Up-to-date: /usr/local/include/cmark-gfm-extension_api.h
-- Up-to-date: /usr/local/include/cmark-gfm_export.h
-- Up-to-date: /usr/local/include/cmark-gfm_version.h
-- Up-to-date: /usr/local/lib/cmake/cmark-gfm.cmake
-- Up-to-date: /usr/local/lib/cmake/cmark-gfm-release.cmake
-- Up-to-date: /usr/local/lib/libcmark-gfm-extensions.so.0.29.0.gfm.6
-- Up-to-date: /usr/local/lib/libcmark-gfm-extensions.so
-- Up-to-date: /usr/local/lib/libcmark-gfm-extensions.a
-- Up-to-date: /usr/local/include/cmark-gfm-core-extensions.h
-- Up-to-date: /usr/local/include/cmark-gfm-extensions_export.h
-- Up-to-date: /usr/local/lib/cmake-gfm-extensions/cmark-gfm-extensions.cmake
-- Up-to-date: /usr/local/lib/cmake-gfm-extensions/cmark-gfm-extensions-release.cmake
-- Up-to-date: /usr/local/share/man/man1/cmark-gfm.1
-- Up-to-date: /usr/local/share/man/man3/cmark-gfm.3
[redacted@redacted build]$ ./cmark-gfm --version
bash: ./cmark-gfm: No such file or directory

Now here is a demonstration of Issue #163 on Fedora 37:

[redacted@redacted build]$ ./src/cmark-gfm --version
cmark-gfm 0.29.0.gfm.6 - CommonMark with GitHub Flavored Markdown converter
(C) 2014-2016 John MacFarlane

But it doesn't happen with the copy in build:

[redacted@redacted build]$ cmark-gfm --version
cmark-gfm: error while loading shared libraries: libcmark-gfm-extensions.so.0.29.0.gfm.6: cannot open shared object file: No such file or directory

It is clear that /usr/local/bin/cmark-gfm is the one running, but though it was modified when I did sudo make install it was broken somehow:

[redacted@redacted build]$ which cmark-gfm
/usr/local/bin/cmark-gfm
  • I confirmed it is not a symlink (readlink /usr/local/bin/cmark-gfm yields nothing)

You can see that the file is different, but even though the one in the system is dated a minute later when I ran sudo make install it is the broken one as proven above:

[redacted@redacted build]$ diff src/cmark-gfm /usr/local/bin/cmark-gfm
Binary files src/cmark-gfm and /usr/local/bin/cmark-gfm differ

[redacted@redacted build]$ stat /usr/local/bin/cmark-gfm
  File: /usr/local/bin/cmark-gfm
  Size: 26776     	Blocks: 56         IO Block: 4096   regular file
Device: 0,31	Inode: 1326647     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:bin_t:s0
Access: 2023-01-10 10:11:23.679885077 -0500
Modify: 2023-01-10 09:54:55.000000000 -0500
Change: 2023-01-10 10:10:44.552868026 -0500
 Birth: 2023-01-10 09:55:10.936985370 -0500

[redacted@redacted build]$ stat src/cmark-gfm
  File: src/cmark-gfm
  Size: 26776     	Blocks: 56         IO Block: 4096   regular file
Device: 0,31	Inode: 1326462     Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1000/   redacted)   Gid: ( 1000/   redacted)
Context: unconfined_u:object_r:default_t:s0
Access: 2023-01-10 09:55:04.601977220 -0500
Modify: 2023-01-10 09:54:55.491965500 -0500
Change: 2023-01-10 09:54:55.491965500 -0500
 Birth: 2023-01-10 09:54:55.479965485 -0500

There is a workaround which seems to further prove the problem:

cd cmark-gfm/build
sudo rm /usr/local/bin/cmark-gfm
sudo ln `pwd`/src/cmark-gfm /usr/local/bin/cmark-gfm
  • cmark-gfm --version works after performing that workaround.