tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] macos: DYLD_LIBRARY_PATH no longer works after cleanu


From: Christian Jullien
Subject: Re: [Tinycc-devel] macos: DYLD_LIBRARY_PATH no longer works after cleanup
Date: Thu, 9 Jul 2020 07:53:17 +0200

Got it! Once again Apple does things in your back.
Whatever starts with DYLD_ is processed directly by the system in a different 
way on a real mac (tested on Catalina and High Sierra).
Read: 
https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_cs_allow-dyld-environment-variables

Michael, it probably works for you because your system is set differently. Mine 
is 'standard" I mean installed wo. special tuning.

--- Makefile ---
ifndef TOP
 TOP = .
 CURDIR = $(PWD)
 SYSTEM = `uname`
endif

 export DYLD_LIBRARY_PATH := $(CURDIR)/$(TOP)
 export DYLD_LIBRARY_FOO := $(CURDIR)/$(TOP)
 export DYLD_FOO_PATH := $(CURDIR)/$(TOP)
 export DYLDFOO_PATH := $(CURDIR)/$(TOP)
 export EDYLD_LIBRARY_PATH := $(CURDIR)/$(TOP)
 export

all:
        @echo Running on $(SYSTEM)
        @echo in Makefile environment is set to
        @set

$ make | grep DY
DYLDFOO_PATH=/Users/jullien/foo/.
EDYLD_LIBRARY_PATH=/Users/jullien/foo/.

All "^DYLD_" variables are dropped!!!
I'll revert to the code I wrote which uses "DYLD_LIBRARY_PATH=<tcc-path> tcc"

I faced a similar issue while porting Le-Lisp (not OpenLisp) on macOS. The 
assembler code has dlink and llink variables (dynamic and lexical link). macOS 
assembler uses llink internally and silently dropped (wo warning) this variable 
while dlink was kept (!). It took me 2 days to understand. Grrrr!

-----Original Message-----
From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange.fr@nongnu.org] On 
Behalf Of Christian Jullien
Sent: Wednesday, July 08, 2020 17:50
To: tinycc-devel@nongnu.org; jullien@eligis.com
Subject: Re: [Tinycc-devel] macos: DYLD_LIBRARY_PATH no longer works after 
cleanup

Thank you for testing, make is the same:
jullien@jacquet:~/tinycc $ make -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.

Single dash was an automatic edit from my email agent. I pass of course 2 dashes

I tested on High Sierra which uses bash and Catalina which uses zsh. It fails 
the same on both systems.

jullien@jacquet:~/tinycc $ make clean
jullien@jacquet:~/tinycc $ ./configure --disable-static
Binary directory    /usr/local/bin
TinyCC directory    /usr/local/lib/tcc
Library directory   /usr/local/lib
Include directory   /usr/local/include
Manual directory    /usr/local/share/man
Info directory      /usr/local/share/info
Doc directory       /usr/local/share/doc
/usr/include dir    
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include
Source path         /Users/jullien/tinycc
C compiler          clang (10.0)
Target OS           Darwin
CPU                 x86_64
Config              OSX static=no
Creating config.mak and config.h
config.h is unchanged
jullien@jacquet:~/tinycc $ make && make test
clang -o tcc.o -c tcc.c 
-DCONFIG_USR_INCLUDE="\"/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include\""
 -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO       -DONE_SOURCE=0 -Wall -O2 
-Wdeclaration-after-statement -fno-strict-aliasing -fheinous-gnu-extensions 
-Wno-pointer-

clang -shared -o libtcc.dylib libtcc.o tccpp.o tccgen.o tccelf.o tccasm.o 
tccrun.o x86_64-gen.o x86_64-link.o i386-asm.o tccmacho.o  -flat_namespace 
-undefined warning
clang -o tcc tcc.o libtcc.dylib -lm -lpthread -ldl  -flat_namespace -undefined 
warning  -Wl,-rpath,"/usr/local/lib"
../tcc -c libtcc1.c -o libtcc1.o -B.. -I..
../tcc -c alloca86_64.S -o alloca86_64.o -B.. -I..
../tcc -c alloca86_64-bt.S -o alloca86_64-bt.o -B.. -I..
../tcc -c va_list.c -o va_list.o -B.. -I..
../tcc -ar rcs ../libtcc1.a libtcc1.o alloca86_64.o alloca86_64-bt.o va_list.o
../tcc -c bt-exe.c -o ../bt-exe.o -B.. -I..
../tcc -c bt-log.c -o ../bt-log.o -B.. -I..
../tcc -c bcheck.c -o ../bcheck.o -B.. -I.. -g
...
------------ hello-exe ------------
dyld: Library not loaded: libtcc.dylib
  Referenced from: /Users/jullien/tinycc/tests/../tcc
  Reason: image not found
/bin/sh: line 1: 62218 Abort trap: 6           ../tcc -B.. -I../include -I.. 
-I.. ../examples/ex1.c -o hello
+ ../tcc -vv
dyld: Library not loaded: libtcc.dylib
  Referenced from: /Users/jullien/tinycc/tests/../tcc
  Reason: image not found
/bin/sh: line 1: 62220 Abort trap: 6           ../tcc -vv
+ ldd ../tcc
/bin/sh: ldd: command not found
+ exit 1
make[2]: *** [hello-exe] Error 1
make[1]: *** [all] Error 2
make: *** [test] Error 2




-----Original Message-----
From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange.fr@nongnu.org] On 
Behalf Of Michael Matz
Sent: Wednesday, July 08, 2020 17:35
To: jullien@eligis.com; tinycc-devel@nongnu.org
Subject: Re: [Tinycc-devel] macos: DYLD_LIBRARY_PATH no longer works after 
cleanup

Hello,

On Wed, 8 Jul 2020, Christian Jullien wrote:

> 
> It is still unclear why it does not work but on macOS, ./configure 
> –disable-static Now raises an error:
> 
> ------------ hello-exe ------------
> 
> === recurse /Users/jullien/tinycc/tests/.. ===
> 
> dyld: Library not loaded: libtcc.dylib
> 
>   Referenced from: /Users/jullien/tinycc/tests/../tcc
> 
>   Reason: image not found

Hmm, can't reproduce here:

% git log -1 --online HEAD
9d75f14 Fix structure passing i386 PE
% make clean
% ./configure --disable-static
...
Config              OSX static=no
...
% make
% make test
... works ...

(Note the double dash for configure options, I'm not sure if it was just a typo 
in your mail).  And there's proof that the export from the Makefile does work, 
because calling tcc from the tests directory directly indeed doesn't work:

% cd tests; ../tcc -h
dyld: Library not loaded: libtcc.dylib
   Referenced from: /Users/micha/src/tinycc/tests/../tcc
   Reason: image not found
Abort trap: 6

So that the testsuite works for me is the indication that the 'export 
DYLD_LIBRARY_PATH' construct does work (for me).  Any differences in make 
behaviour perhaps?

% make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.

This program built for i386-apple-darwin11.3.0


Ciao,
Michael.


_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]