Operating System - Linux
1824977 Members
3972 Online
109678 Solutions
New Discussion юеВ

How to get aCC & ld to use alternative crt0.o ?

 
SOLVED
Go to solution
Michael Knox
Occasional Contributor

How to get aCC & ld to use alternative crt0.o ?

Does anyone know how to tell aCC to use libs from a location other than /opt/langtools?

When aCC calls ld it does ...
/usr/ccs/bin/ld -o a.out /opt/langtools/lib/pa20_64/crt0.o -u___exit -umain -L ...

Does anyone know how to tell aCC to tell ld that crt0.o is in a different location?
I can do this manually with ld, but can't get aCC to tell ld.

Cheers
13 REPLIES 13
RAC_1
Honored Contributor

Re: How to get aCC & ld to use alternative crt0.o ?

aCC must be using SHLIB_PATH or/and LD_LIBRARY_PATH variables in addition to in-built library path.

chatr 'acc' will tell you what it uses. Make changes accordingly. May be you will have to set SHLIB_PATH variable.
There is no substitute to HARDWORK
Michael Knox
Occasional Contributor

Re: How to get aCC & ld to use alternative crt0.o ?

Thanks RAC,
However I have already tried SHLIB_PATH, LD_LIBRARY_PATH, LPATH and explictly requiring the lib (using -l)

and unless I misread the chatr output ...
shared library dynamic path search:
SHLIB_PATH disabled second
embedded path disabled first
aCC doesn't look at SHLIB_PATH anyway.
RAC_1
Honored Contributor

Re: How to get aCC & ld to use alternative crt0.o ?

chatr ldd

Changes if required.
There is no substitute to HARDWORK
Muthukumar_5
Honored Contributor

Re: How to get aCC & ld to use alternative crt0.o ?

what is there in SHLIB_PATH Variable?

echo $SHLIB_PATH before building? Try to export and build it.

hth.
Easy to suggest when don't know about the problem!
Arunvijai_4
Honored Contributor

Re: How to get aCC & ld to use alternative crt0.o ?

Try modifying your Makefile(if you have any) and add explicitly HLIB_PATH, LD_LIBRARY_PATH, LPATH and -L/.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Michael Knox
Occasional Contributor

Re: How to get aCC & ld to use alternative crt0.o ?

chatr `which ldd` ...
/usr/ccs/bin/ldd:
shared executable
shared library dynamic path search:
SHLIB_PATH disabled second
embedded path disabled first
Neither ldd nor aCC appear to utilise SHLIB_PATH ...

However I have tried setting SHLIB_PATH, LD_LIBRARY_PATH and LPATH (and using -L for aCC) all to no avail.

Once I get it working it will go into the Makefiles, but until then ...


Muthukumar_5
Honored Contributor

Re: How to get aCC & ld to use alternative crt0.o ?

I hope in the configuration phase itself you can add with -L/directory/ so that makefiles will get reflected this changes.

check with make -p to know LDFLAGS more.

hth.
Easy to suggest when don't know about the problem!
VEL_1
Valued Contributor

Re: How to get aCC & ld to use alternative crt0.o ?

Hi,

Try in new session by changing the LDFALGS library orders:

LDFALGS="-L/usr/lib -L/usr/local/lib"

Thanks.


Michael Knox
Occasional Contributor

Re: How to get aCC & ld to use alternative crt0.o ?

A sample ...
$ echo $SHLIB_PATH
/langtools/lib:/langtools/lib/pa20_64
$ echo $LD_LIBRARY_PATH
/langtools/lib:/langtools/lib/pa20_64

$ /aCC/bin/aCC -L/langtools/lib -L/langtools/lib/pa20_64 -v -Ae -mt -ext +DA2.0W +DA2.0W /staff/mknox/tmp/conftest.c

/aCC/lbin/ctcom.pa20 -architecture 2.0W -architecture 2.0W -piccode long -inst compiletime -diags 523 -ext on -lang c -exception off -inline_power 1 -longbranch 0 -unique_strings off -cachesize 256 -I/usr/include -D__HP_CXD_SPP=1 -D__hpux -D__unix -D__hppa -D__hp9000s800 -D__parisc -D__STDCPP__ -D_LP64 -D__LP64__ -D__HP_cc=33900 -D_REENTRANT -DRWSTD_MULTI_THREAD -DRW_MULTI_THREAD -D_THREAD_SAFE -D_HPUX_SOURCE -D_POSIX_C_SOURCE=199506L -D__hp9000s700 -D_PA_RISC2_0 -D__STDC_EXT__ -D_HPUX_SOURCE -D_INCLUDE_LONGLONG /staff/mknox/tmp/conftest.c
LPATH=/usr/lib/pa20_64:/opt/langtools/lib/pa20_64
/usr/ccs/bin/ld -o a.out /opt/langtools/lib/pa20_64/crt0.o -u___exit -umain -L /langtools/lib -L /langtools/lib/pa20_64 conftest.o -lpthread -lc >/var/tmp/AAAa11613 2>&1
/aCC/bin/c++filt &2
/usr/ccs/bin/ld: Can't open /opt/langtools/lib/pa20_64/crt0.o
/usr/ccs/bin/ld: No such file or directory
removing /var/tmp/AAAa11613
$

Setting LPATH appears to make no difference
RAC_1
Honored Contributor

Re: How to get aCC & ld to use alternative crt0.o ?

This is output fro my system.
# chatr `which ldd`
/usr/ccs/bin/ldd:
32-bit ELF executable
shared library dynamic path search:
LD_LIBRARY_PATH enabled first
SHLIB_PATH enabled second
embedded path enabled third Not Defined


All paths enabled. Do you have latest ldd patch?? you can also try enabling it. man chatr for details.
There is no substitute to HARDWORK
Ermin Borovac
Honored Contributor
Solution

Re: How to get aCC & ld to use alternative crt0.o ?

Have a look at the following URL

http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,2548,00.html

Try setting SDKROOT environment variable to where is root directory of your aCC installation.
Michael Knox
Occasional Contributor

Re: How to get aCC & ld to use alternative crt0.o ?

Thanks Ermin for the pointers, thats solved it.
ranganath ramachandra
Esteemed Contributor

Re: How to get aCC & ld to use alternative crt0.o ?

hi,

i guess you are aware that SDKROOT will make aCC look into $SDKROOT for everything (e.g. the linker it will invoke, etc), not just crt0.o.

any specific reason why you want to do this?

regards
ranga
 
--
ranga
hp-ux 11i v3[i work for hpe]

Accept or Kudo