[Top][All Lists]

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

Re: MacOS X nested functions in libtool library

From: Bill Northcott
Subject: Re: MacOS X nested functions in libtool library
Date: Tue, 29 May 2007 17:16:52 +1000

On 29/05/2007, at 4:36 PM, Peter O'Gorman wrote:
Adding '-fnested-functions' to the CFLAGS stops the compiler barfing.  However as per Apple Tech note it is also necessary to add -fnested-functions or an equivalent ld flag to the compiler link command.  Without this flag, the linker defaults to disable_stack_execute on i386 and the library crashes at runtime.

Adding -fnested-functions to libfoo_la_LDFLAGS does not work because libtool strips it out before invoking gcc.

Is there a way around this or an actual fix?

LDFLAGS=-Wl,-allow_stack_execute does not work?

I just sent the message below to the Apple xcode-users list:

TN2161 says that -fnested-functions can be passed to the compiler driver in a link command to send the "-allow_stack_execute" flag to the linker.

However, libtool seems to choke on it thus:
gcc -B ../../tools -dynamiclib -fnested-functions  -o .libs/libswarm.0.0.0.dylib  .libs/SwarmEnvironment.o .libs/classList.o  .libs/libswarm.lax/libspace.a/Ca2d.o 
*** lots of objects removed ****
.libs/libswarm.lax/libswarmobjc.a/thr.o   -L/Library/Frameworks/Swarm.framework/Versions/Current/Resources/lib -L/Library/Frameworks/Tk.framework/Versions/8.4-X11/lib -L/usr/X11R6/lib -lpthread /Library/Frameworks/Swarm.framework/Versions/Current/Resources/lib/libffi.dylib -lBLT24 -lXpm /Library/Frameworks/Swarm.framework/Versions/Current/Resources/lib/libpng12.dylib /Library/Frameworks/Swarm.framework/Versions/Current/Resources/lib/libhdf5.dylib -lz -lX11 -lm -ldl  -Wl,-search_paths_first -framework CoreFoundation -framework CoreFoundation -framework Tk -framework Tcl -install_name  /Library/Frameworks/Swarm.framework/Versions/2.2/lib/libswarm.0.dylib -Wl,-compatibility_version -Wl,1 -Wl,-current_version -Wl,1.0
/usr/bin/libtool: unknown option character `l' in: -allow_stack_execute
Usage: /usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT]
Usage: /usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]
make[4]: *** [] Error 1

Ho hum

This was done bodging -fnested-functions option into the configured libtool script.

 I will try the -Wl option but libtool seems to strip all flags that it does not recognise.

Have to dash now

reply via email to

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