Summary

Exporting a macro inhibits compiled program from locating libraries

Metadata

Attachments

Description

The bug I found makes the compiled program unable to locate libraries based on the environment variables `CHICKEN_INCLUDE_PATH` and `CHICKEN_REPOSITORY_PATH`.

The bug is quite fiddly to reproduce so I've added a 7z archive that contains the neccessary file structure and sets the environment variables appropriately. To compile and run it execute the make.sh script.

The program runs as expected as long as the 5. line (exporting the macro) in the test.scm file is commented out, but fails to load the testlib library if it's included.

What makes the bug so fiddly and likely the reason why it hasn't been noticed so far is that everything works as expected as long as the include *.import.scm files and the library *.so files are in the same directory, as pointed by CHICKEN_REPOSITORY_PATH. This can be observed by commenting out the 8. line in the make.sh script.

Therefore I hope it's a simple error in using a wrong variable to get the search directory for the *.import.scm files.

Lastly, I've run it on Arch Linux updated as of 2023.03.30:

 $ chicken-csc -version
 CHICKEN
 (c) 2008-2021, The CHICKEN Team
 (c) 2000-2007, Felix L. Winkelmann
 Version 5.3.0 (rev e31bbee5)
 linux-unix-gnu-x86-64 [ 64bit dload ptables ]

Changes and comments

[2023-03-30 16:22:35 UTC] binary-brain attached load_library_bug.7z (description=#f)

[2023-11-06 23:29:15 UTC] felix changed milestone from someday to 6.0.0

[2023-11-08 23:04:26 UTC] felix wrote:

The script doesn't export the environment variables, so they are not seen at all during compile and run-time. I tried with and without exporting the macro but that doesn't seem to make any difference. Also, CHICKEN_INCLUDE_PATH is not necessary, you can just set CHICKEN_REPOSITORY_PATH to lib (+ the default one, as you correctly do).

[2023-11-08 23:04:37 UTC] felix changed milestone from 6.0.0 to someday