Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LC_RPATH not added when compiling XS modules on macOS #402

Open
hakonhagland opened this issue Sep 16, 2021 · 9 comments
Open

LC_RPATH not added when compiling XS modules on macOS #402

hakonhagland opened this issue Sep 16, 2021 · 9 comments

Comments

@hakonhagland
Copy link
Contributor

Introduction

I did some research to try to better understand the way shared libraries are generated and used on macOS. I include it here as an introduction. See below for the actual issue with ExtUtils::MakeMaker

On Linux it is enough to set the environment variable LC_RUN_PATH when compiling a shared library. This will make the linker include the run path given in the LC_RUN_PATH variable into the shared library. On macOS it is more complicated. Each library has a header providing an install name (LC_ID_DYLIB) of the library. If other libraries should be able to find this library through their own run time path (rpath) the install name of the current library must begin with the special string @rpath. Secondly, if this library is trying to load another library using its rpath the header section of this library called LC_LOAD_DYLIB must include the rpath install name of the other library. This means that the name in the LC_LOAD_DYLIB section must start with the special string @rpath. Thirdly, this library must include an LC_RPATH section with the run time paths to the libraries (the ones whose names starts with @rpath) given in the LC_LOAD_DYLIB section.

When linking a shared library on macOS (using here cc = clang as the most relevant example),

  • the switch -install_name can be used to set the LC_ID_DYLIB section for the generated shared object,
  • the switch -rpath or -Wl,-rpath, can be used to set the LC_RPATH section,
  • and the environment variable LD_RUN_PATH can be used to set the @rpath prefix of library names in the LC_LOAD_DYLIB section

See this link for more information.

Here is an example: I have the following files on my mac (Big Sur 11.5.2) :

$ tree .
.
├── mylib1
│   ├── libmylib1.dylib
│   ├── mylib1.c
│   └── mylib1.h
├── mylib2
│   ├── libmylib2.dylib
│   ├── mylib2.c
│   └── mylib2.h
└── program
    ├── main
    └── main.c

3 directories, 8 files

and the file contents are:

  • mylib1.c :
#include <stdio.h>
#include "mylib1.h"
void foo() {
    printf( "Hello from foo()\n");
}
  • mylib2.c :
#include <stdio.h>
#include "mylib1.h"
#include "mylib2.h"
void bar() {
    printf( "Hello from bar()\n");
    foo();
}
  • main.c:
#include <stdio.h>
#include "mylib2.h"
int main() {
    printf( "Hello from main()\n");
    bar();
}

Let's say I compile the libraries like this:

cd mylib1
cc -I. -dynamiclib -install_name @rpath/libmylib1.dylib mylib1.c -o libmylib1.dylib
cd ../mylib2
LD_RUN_PATH=../mylib1 cc -I. -I../mylib1 -L../mylib1 -dynamiclib -install_name @rpath/libmylib2.dylib  mylib2.c -o libmylib2.dylib -lmylib1
cd ../program
LD_RUN_PATH=../mylib2 cc main.c -I../mylib2 -L../mylib2 -o main -Wl,-rpath,../mylib2 -lmylib2

we can then note :

  • it is necessary to include the -install_name with the @rpath prefix when compiling both libmylib1.dylib and libmylib2.dylib. For libmylib1.dylib it necessary in order for the dynamic linker (when loading the main program, which then loads libmylib2.dylib) to accept libmylib1.dylib using the rpath included in libmylib2.dylib). For libmylib2.dylib it is necessary in order for the dynamic linker to accept it using the rpath in the main program when loading the main program.
  • it is not necessary to include LD_RUN_PATH when compiling libmylib1.dylib since it is not loading any shared libraries on its own through its rpath
  • we need to use LD_RUN_PATH when compiling both the main program and libmylib2.dylib since both are loading a shared object through their rpath.
  • we failed to set the rpath for libmylib2.dylib ( I omitted this by purpose to illustrate what happens) such that it cannot find libmylib1.dylib

If I now try to run the main program:

$ ./main
dyld: Library not loaded: @rpath/libmylib1.dylib
  Referenced from: /Users/hakonhaegland/test/c/mylib2/libmylib2.dylib
  Reason: image not found
[1]    26853 abort      ./main

However, if I recompile libmylib2.dylib and add the option -rpath ../mylib1 :

LD_RUN_PATH=../mylib1 cc -I. -I../mylib1 -L../mylib1 -dynamiclib -rpath ../mylib1 -install_name @rpath/libmylib2.dylib  mylib2.c -o libmylib2.dylib -lmylib1

and then rerun, it works:

$ ./main
Hello from main()
Hello from bar()
Hello from foo()

Problem with ExtUtil::MakeMaker

When compiling an XS module on macOS that refers to another shared library (in a nonstandard location with explicit path given in the LIBS argument to WriteMakefile()), the generated Makefile does not include the -rpath option to cc which then fails to set the LC_RPATH section of the generated .bundle. This makes it necessary for the user to do some extra work to make the module useable. For example, setting the environment DYLD_LIBRARY_PATH, or manually modify the .bundle afterwards using install_name_tool, like in this issue.

hakonhagland pushed a commit to hakonhagland/ExtUtils-MakeMaker that referenced this issue Sep 16, 2021
This change fixes issue Perl-Toolchain-Gang#402 on my machine.
@hakonhagland
Copy link
Contributor Author

Added a PR that seems to fix this issue, see #403 .

hakonhagland pushed a commit to hakonhagland/ExtUtils-MakeMaker that referenced this issue Sep 17, 2021
@hakonhagland
Copy link
Contributor Author

Here is another example that would probably benefit from #403

hakonhagland pushed a commit to hakonhagland/ExtUtils-MakeMaker that referenced this issue Oct 6, 2021
Added a new test case that tests a special case for the generation of XS
modules on OS darwin. More specifically, it tests if we are able to
compile an XS module which refers to another shared library in a
non-standard location such that we can load the XS module from a perl
script without having to set the DYLD_LIBRARY_PATH environment variable.
See PR Perl-Toolchain-Gang#403 and issue Perl-Toolchain-Gang#402.
@theory
Copy link

theory commented Oct 31, 2021

Was really hoping this patch would let me compile DBD::Firebird against Firebird.framework, but it didn't change it. :(

$ ls -l /Library/Frameworks 
total 0
drwxr-xr-x  8 firebird  firebird   256B Oct 30 15:30 Firebird.framework
drwxr-xr-x  6 root      wheel      192B May 26 11:02 Libmacgpg.framework
lrwxr-xr-x@ 1 root      wheel       50B Jan  1  2020 iTunesLibrary.framework -> /System/Library/Frameworks/iTunesLibrary.framework

$ env | grep FIRE
FIREBIRD_HOME=/Library/Frameworks/Firebird.framework/Resources

$ perl Makefile.PL 
Configuring DBD::Firebird (on darwin)
Detected Firebird API version 30

FIREBIRD_HOME   : /Library/Frameworks/Firebird.framework/Resources
FIREBIRD_INCLUDE: /Library/Frameworks/Firebird.framework/Resources/../Headers
FIREBIRD_LIB    : /Library/Frameworks/Firebird.framework/Resources/../Libraries
Client library  : fbclient

Using DBI 1.643 (for perl 5.030002 on darwin-multi-2level) installed in /Users/david/.plenv/versions/5.30.2/lib/perl5/site_perl/5.30.2/darwin-multi-2level/auto/DBI/
Found libfbembed, will build DBD::FirebirdEmbed too.
Checking if your kit is complete...
Looks good
Configuring DBD::FirebirdEmbedded (on darwin)

FIREBIRD_HOME   : /Library/Frameworks/Firebird.framework/Resources
FIREBIRD_INCLUDE: /Library/Frameworks/Firebird.framework/Resources/../Headers
FIREBIRD_LIB    : /Library/Frameworks/Firebird.framework/Resources/../Libraries
Client library  : fbclient

Writing MYMETA.yml and MYMETA.json
Generating a Unix-style Makefile
Writing Makefile for DBD::Firebird
Writing MYMETA.yml and MYMETA.json

$ make
cp lib/DBD/Firebird/TableInfo.pm blib/lib/DBD/Firebird/TableInfo.pm
cp lib/DBD/Firebird/TypeInfo.pm blib/lib/DBD/Firebird/TypeInfo.pm
cp Firebird.pm blib/lib/DBD/Firebird.pm
cp lib/DBD/Firebird/GetInfo.pm blib/lib/DBD/Firebird/GetInfo.pm
cp lib/DBD/Firebird/TableInfo/Firebird21.pm blib/lib/DBD/Firebird/TableInfo/Firebird21.pm
cp lib/DBD/Firebird/TableInfo/Basic.pm blib/lib/DBD/Firebird/TableInfo/Basic.pm
cp FirebirdEmbedded.pm ../blib/lib/DBD/FirebirdEmbedded.pm
Running Mkbootstrap for FirebirdEmbedded ()
chmod 644 "FirebirdEmbedded.bs"
"/Users/david/.plenv/versions/5.30.2/bin/perl5.30.2" -MExtUtils::Command::MM -e 'cp_nonempty' -- FirebirdEmbedded.bs ../blib/arch/auto/DBD/FirebirdEmbedded/FirebirdEmbedded.bs 644
"/Users/david/.plenv/versions/5.30.2/bin/perl5.30.2" -p -e "s/~DRIVER~/FirebirdEmbedded/g" /Users/david/.plenv/versions/5.30.2/lib/perl5/site_perl/5.30.2/darwin-multi-2level/auto/DBI/Driver.xst > FirebirdEmbedded.xsi
"/Users/david/.plenv/versions/5.30.2/bin/perl5.30.2" "/Users/david/.plenv/versions/5.30.2/lib/perl5/5.30.2/ExtUtils/xsubpp" -noprototypes -typemap '/Users/david/.plenv/versions/5.30.2/lib/perl5/5.30.2/ExtUtils/typemap'  FirebirdEmbedded.xs > FirebirdEmbedded.xsc
mv FirebirdEmbedded.xsc FirebirdEmbedded.c
cc -c -I"/Library/Frameworks/Firebird.framework/Resources/../Headers" -I"/Users/david/.plenv/versions/5.30.2/lib/perl5/site_perl/5.30.2/darwin-multi-2level/auto/DBI"  -I"/Library/Frameworks/Firebird.framework/Resources/../Headers" -I"/Users/david/.plenv/versions/5.30.2/lib/perl5/site_perl/5.30.2/darwin-multi-2level/auto/DBI" -fno-common -DPERL_DARWIN -mmacosx-version-min=10.15 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -DPERL_USE_SAFE_PUTENV -Wno-error=implicit-function-declaration -O3   -DVERSION=\"1.32\" -DXS_VERSION=\"1.32\"  "-I/Users/david/.plenv/versions/5.30.2/lib/perl5/5.30.2/darwin-multi-2level/CORE"  -DEMBEDDED FirebirdEmbedded.c
FirebirdEmbedded.xs:1556:59: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
        DPB_FILL_STRING_LEN(dpb, isc_dpb_user_name, user, user_len);
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
./dbdimp.h:140:43: note: expanded from macro 'DPB_FILL_STRING_LEN'
        croak("DPB string too long (%d)", len);     \
                                    ~~    ^~~
FirebirdEmbedded.xs:1560:57: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
        DPB_FILL_STRING_LEN(dpb, isc_dpb_password, pwd, pwd_len);
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
./dbdimp.h:140:43: note: expanded from macro 'DPB_FILL_STRING_LEN'
        croak("DPB string too long (%d)", len);     \
                                    ~~    ^~~
2 warnings generated.
cc -c -I"/Library/Frameworks/Firebird.framework/Resources/../Headers" -I"/Users/david/.plenv/versions/5.30.2/lib/perl5/site_perl/5.30.2/darwin-multi-2level/auto/DBI"  -I"/Library/Frameworks/Firebird.framework/Resources/../Headers" -I"/Users/david/.plenv/versions/5.30.2/lib/perl5/site_perl/5.30.2/darwin-multi-2level/auto/DBI" -fno-common -DPERL_DARWIN -mmacosx-version-min=10.15 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -DPERL_USE_SAFE_PUTENV -Wno-error=implicit-function-declaration -O3   -DVERSION=\"1.32\" -DXS_VERSION=\"1.32\"  "-I/Users/david/.plenv/versions/5.30.2/lib/perl5/5.30.2/darwin-multi-2level/CORE"  -DEMBEDDED dbdimp.c
dbdimp.c:443:5: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
    DPB_FILL_STRING(dpb, isc_dpb_user_name, uid);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./dbdimp.h:135:44: note: expanded from macro 'DPB_FILL_STRING'
    DPB_FILL_STRING_LEN(dpb, code, string, strlen(string) )
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
./dbdimp.h:140:43: note: expanded from macro 'DPB_FILL_STRING_LEN'
        croak("DPB string too long (%d)", len);     \
                                    ~~    ^~~
dbdimp.c:445:5: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
    DPB_FILL_STRING(dpb, isc_dpb_password, pwd);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./dbdimp.h:135:44: note: expanded from macro 'DPB_FILL_STRING'
    DPB_FILL_STRING_LEN(dpb, code, string, strlen(string) )
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
./dbdimp.h:140:43: note: expanded from macro 'DPB_FILL_STRING_LEN'
        croak("DPB string too long (%d)", len);     \
                                    ~~    ^~~
dbdimp.c:466:9: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
        DPB_FILL_STRING(dpb, isc_dpb_lc_ctype, imp_dbh->ib_charset);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./dbdimp.h:135:44: note: expanded from macro 'DPB_FILL_STRING'
    DPB_FILL_STRING_LEN(dpb, code, string, strlen(string) )
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
./dbdimp.h:140:43: note: expanded from macro 'DPB_FILL_STRING_LEN'
        croak("DPB string too long (%d)", len);     \
                                    ~~    ^~~
dbdimp.c:471:9: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
        DPB_FILL_STRING(dpb, isc_dpb_sql_role_name, ib_role);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./dbdimp.h:135:44: note: expanded from macro 'DPB_FILL_STRING'
    DPB_FILL_STRING_LEN(dpb, code, string, strlen(string) )
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
./dbdimp.h:140:43: note: expanded from macro 'DPB_FILL_STRING_LEN'
        croak("DPB string too long (%d)", len);     \
                                    ~~    ^~~
4 warnings generated.
rm -f ../blib/arch/auto/DBD/FirebirdEmbedded/FirebirdEmbedded.bundle
cc  -mmacosx-version-min=10.15 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector-strong -framework Firebird   FirebirdEmbedded.o dbdimp.o  -o ../blib/arch/auto/DBD/FirebirdEmbedded/FirebirdEmbedded.bundle  \
	      \
	  
ld: framework not found Firebird
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [../blib/arch/auto/DBD/FirebirdEmbedded/FirebirdEmbedded.bundle] Error 1
make: *** [subdirs] Error 2

I have not been able to get it to find the Firebird framework. I even disabled SIP and reinstalled the Xcode command-line tools. No joy.

Is this a different issue?

@hakonhagland
Copy link
Contributor Author

Is this a different issue?

@theory I am not sure what is going on here yet. I am getting the same error on macOS 12.0.1 (Monterey) with Apple M1 chip. Here is my install log.

@theory
Copy link

theory commented Oct 31, 2021

Yeah, pretty weird, right?

@hakonhagland
Copy link
Contributor Author

ld: framework not found Firebird

It seems like the Firebird framework file does not exist:

$ file /Library/Frameworks/Firebird.framework/Firebird
/Library/Frameworks/Firebird.framework/Firebird: broken symbolic link to Versions/Current/Firebird

@theory
Copy link

theory commented Nov 1, 2021

Oh weird. I wonder what it should be pointing at? (I uninstalled and got things working in a docker container to solve my problem.)

@hakonhagland
Copy link
Contributor Author

@theory Added bug report and a possible fix, see mariuz/perl-dbd-firebird#52. Could you test the PR as I am not able to test it myself since I am using Apple M1 chip?

bingos pushed a commit that referenced this issue Nov 3, 2021
This fixes issue #402

This change fixes issue #402 on my machine.
bingos pushed a commit that referenced this issue Nov 3, 2021
Added a new test case that tests a special case for the generation of XS
modules on OS darwin. More specifically, it tests if we are able to
compile an XS module which refers to another shared library in a
non-standard location such that we can load the XS module from a perl
script without having to set the DYLD_LIBRARY_PATH environment variable.
See PR #403 and issue #402.
khwilliamson pushed a commit to khwilliamson/ExtUtils-MakeMaker that referenced this issue Dec 12, 2021
khwilliamson pushed a commit to khwilliamson/ExtUtils-MakeMaker that referenced this issue Dec 12, 2021
Added a new test case that tests a special case for the generation of XS
modules on OS darwin. More specifically, it tests if we are able to
compile an XS module which refers to another shared library in a
non-standard location such that we can load the XS module from a perl
script without having to set the DYLD_LIBRARY_PATH environment variable.
See PR Perl-Toolchain-Gang#403 and issue Perl-Toolchain-Gang#402.
@mohawk2
Copy link
Member

mohawk2 commented Mar 11, 2022

Further light on this issue might be shed by @kiwiroy's findings on PDLPorters/pdl#391, fixing a problem of those linking to Alien::proj's provided proj library on MacOS needing rpath to both /opt/local/lib for sqlite, and to its own location. It involves using install_name_tool to delete the :-separated rpath, and replacing it with its two parts.

I gather Roy will also investigate whether the rpath stuff is transitive, so that the sqlite location doesn't need to be embedded in the proj-using library (PDL::GIS::Proj, as it happens).

theory added a commit to theory/perl-commonmark that referenced this issue Sep 11, 2023
Create a GitHub workflow to test CommonMark against all supported
versions of Perl and cmark on Linux, macOS, and Windows. Include tests
for the system default Perl and and package-supplied cmark on Linux
(Apt) and macOS (Homewbrew), as well. Each version of cmark has two
steps: one for macOS and Linux using `build.sh`, and one for Windows
using `build.ps1`. Just add new steps to test new versions.

Perls: 5.38, 5.36, 5.34, 5.32, 5.30, 5.28, 5.26, 5.24, 5.22, 5.20, 5.18,
5.16, 5.14, 5.12, 5.10, 5.8, macOS system, Linux System.

cmarks: 0.30.3, 0.29.0, 0.28.3, 0.27.1, 0.26.1, 0.25.2, 0.24.1, 0.20.0,
apt-get, Homebrew.

All tests pass on Linux and macOS, though the latter requires an updated
version of ExtUtils::MakeMaker that includes
Perl-Toolchain-Gang/ExtUtils-MakeMaker#402  so that it always finds
cmark at runtime the same place it found it at compile time.

Windows tests do not currently pass at all: 5.32 compiles but then `make
test` cannot find the cmark DLL; 5.38 doesn't get past `perl
Makefile.PL`, saying it cannot find the cmark library, even though INC
ane LIBS are set.

Also: update `.gitignore` to ignore additional files, and to specify
root-level files and directories.
theory added a commit to theory/perl-commonmark that referenced this issue Sep 11, 2023
Create a GitHub workflow to test CommonMark against all supported
versions of Perl and cmark on Linux, macOS, and Windows. Include tests
for the system default Perl and and package-supplied cmark on Linux
(Apt) and macOS (Homewbrew), as well. Each version of cmark has two
steps: one for macOS and Linux using `build.sh`, and one for Windows
using `build.ps1`. Just add new steps to test new versions.

Perls: 5.38, 5.36, 5.34, 5.32, 5.30, 5.28, 5.26, 5.24, 5.22, 5.20, 5.18,
5.16, 5.14, 5.12, 5.10, 5.8, macOS system, Linux System.

cmarks: 0.30.3, 0.29.0, 0.28.3, 0.27.1, 0.26.1, 0.25.2, 0.24.1, 0.20.0,
apt-get, Homebrew.

All tests pass on Linux and macOS, though the latter requires an updated
version of ExtUtils::MakeMaker that includes
Perl-Toolchain-Gang/ExtUtils-MakeMaker#402  so that it always finds
cmark at runtime the same place it found it at compile time.

Windows tests do not currently pass at all: 5.32 compiles but then
`CommonMark->parse_file` dies without any error output in
`t/02_accessors.t` and `t/10_wrappers.t` (I thought the issue might be
the path, but use of File::Spec does not fix it). 5.38 doesn't get past
`perl Makefile.PL`, saying it cannot find the cmark library, even though
INC and LIBS are set.

Also: update `.gitignore` to ignore additional files, and to specify
root-level files and directories, and add some diagnostic output to
`t/01_memory.t` to show the versions of cmark.
theory added a commit to theory/perl-commonmark that referenced this issue Sep 11, 2023
Create a GitHub workflow to test CommonMark against all supported
versions of Perl and cmark on Linux, macOS, and Windows. Include tests
for the system default Perl and and package-supplied cmark on Linux
(Apt) and macOS (Homewbrew), as well. Each version of cmark has two
steps: one for macOS and Linux using `build.sh`, and one for Windows
using `build.ps1`. Just add new steps to test new versions.

Perls: 5.38, 5.36, 5.34, 5.32, 5.30, 5.28, 5.26, 5.24, 5.22, 5.20, 5.18,
5.16, 5.14, 5.12, 5.10, 5.8, macOS system, Linux System.

cmarks: 0.30.3, 0.29.0, 0.28.3, 0.27.1, 0.26.1, 0.25.2, 0.24.1, 0.20.0,
apt-get, Homebrew.

All tests pass on Linux and macOS, though the latter requires an updated
version of ExtUtils::MakeMaker that includes
Perl-Toolchain-Gang/ExtUtils-MakeMaker#402  so that it always finds
cmark at runtime the same place it found it at compile time.

Windows tests do not currently pass at all: 5.32 compiles but then
`CommonMark->parse_file` dies without any error output in
`t/02_accessors.t` and `t/10_wrappers.t` (I thought the issue might be
the path, but use of File::Spec does not fix it). 5.38 doesn't get past
`perl Makefile.PL`, saying it cannot find the cmark library, even though
INC and LIBS are set.

Also: update `.gitignore` to ignore additional files, and to specify
root-level files and directories, and add some diagnostic output to
`t/01_memory.t` to show the versions of cmark.
theory added a commit to theory/perl-commonmark that referenced this issue Sep 11, 2023
Create a GitHub workflow to test CommonMark against all supported
versions of Perl and cmark on Linux, macOS, and Windows. Include tests
for the system default Perl and and package-supplied cmark on Linux
(Apt) and macOS (Homewbrew), as well. Each version of cmark has two
steps: one for macOS and Linux using `build.sh`, and one for Windows
using `build.ps1`. Just add new steps to test new versions.

Perls: 5.38, 5.36, 5.34, 5.32, 5.30, 5.28, 5.26, 5.24, 5.22, 5.20, 5.18,
5.16, 5.14, 5.12, 5.10, 5.8, macOS system, Linux System.

cmarks: 0.30.3, 0.29.0, 0.28.3, 0.27.1, 0.26.1, 0.25.2, 0.24.1, 0.20.0,
apt-get, Homebrew.

All tests pass on Linux and macOS, though the latter requires an updated
version of ExtUtils::MakeMaker that includes
Perl-Toolchain-Gang/ExtUtils-MakeMaker#402  so that it always finds
cmark at runtime the same place it found it at compile time.

Windows tests do not currently pass at all: 5.32 compiles but then
`CommonMark->parse_file` dies without any error output in
`t/02_accessors.t` and `t/10_wrappers.t` (I thought the issue might be
the path, but use of File::Spec does not fix it). 5.38 doesn't get past
`perl Makefile.PL`, saying it cannot find the cmark library, even though
INC and LIBS are set.

Also: update `.gitignore` to ignore additional files, and to specify
root-level files and directories, and add some diagnostic output to
`t/01_memory.t` to show the versions of cmark.
theory added a commit to theory/perl-commonmark that referenced this issue Sep 11, 2023
Create a GitHub workflow to test CommonMark against all supported
versions of Perl and cmark on Linux, macOS, and Windows. Include tests
for the system default Perl and and package-supplied cmark on Linux
(Apt) and macOS (Homewbrew), as well. Each version of cmark has two
steps: one for macOS and Linux using `build.sh`, and one for Windows
using `build.ps1`. Just add new steps to test new versions.

Perls: 5.38, 5.36, 5.34, 5.32, 5.30, 5.28, 5.26, 5.24, 5.22, 5.20, 5.18,
5.16, 5.14, 5.12, 5.10, 5.8, macOS system, Linux System.

cmarks: 0.30.3, 0.29.0, 0.28.3, 0.27.1, 0.26.1, 0.25.2, 0.24.1, 0.20.0,
apt-get, Homebrew.

All tests pass on Linux and macOS, though the latter requires an updated
version of ExtUtils::MakeMaker that includes
Perl-Toolchain-Gang/ExtUtils-MakeMaker#402  so that it always finds
cmark at runtime the same place it found it at compile time.

Windows tests do not currently pass at all: 5.32 compiles but then
`CommonMark->parse_file` dies without any error output in
`t/02_accessors.t` and `t/10_wrappers.t` (I thought the issue might be
the path, but use of File::Spec does not fix it). 5.38 doesn't get past
`perl Makefile.PL`, saying it cannot find the cmark library, even though
INC and LIBS are set.

Also: update `.gitignore` to ignore additional files, and to specify
root-level files and directories, and add some diagnostic output to
`t/01_memory.t` to show the versions of cmark.
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

No branches or pull requests

3 participants