gcc, ld and script

3 posts / 0 new
Last post
YesCop
YesCop's picture
Offline
Last seen: 3 years 7 months ago
Joined: 2011-05-17 15:07
gcc, ld and script

Hi OS4 fans,

I am trying to compile some unix commands. I changed the makefiles a little.
All was fine but during linking process, I had the error :
ld: final link failed: Invalid operation

I thought that the cause was a too long line. Yes, there are too many objects files.
I read docs from gcc and I saw that I could use ld scripts.
I created one (ld-script) with multiple lines of INPUT ( obj obj...).
When I compile with g++ -o prog ld-script, I had the error :
ld:ld-script: file format not recognized; treating as linker script
ld:ld-script:1: syntax error

I test this feature with a simple exec I coded and the compile worked.
I will add that I don't use -T because in this case, no input files are found.

I googled but I didn't find any hint to help me so I am here.

YesCop

corto
corto's picture
Offline
Last seen: 7 years 2 months ago
Joined: 2011-09-09 11:43
I think you should tell us

I think you should tell us more about your problem. Which program are you porting ? Why do you have to modify the makefile ?
I don't think modifying ld scripts is necessary to compile a plain desktop application.

YesCop
YesCop's picture
Offline
Last seen: 3 years 7 months ago
Joined: 2011-05-17 15:07
Hi Corto, If you want to have

Hi Corto,
If you want to have some more info, here we go.
I have already ported or changed some ports to use it on my OS4 efficiently.
I am talking about the problem of files > 2Gb for example.
I changed lha, unrar, ctorrent. Here, I am trying to compile p7zip (v9.20) as I have some 7z files to decompact.
I changed a little the makefiles, removed some (aesthetic) options in gcc because I had some errors. But the amost annoying is the link stage, I have already described the errors in my last post. There is a linking with too much objects files. I said that because I can't copy the command line, it is cut before the end. But is this the cause of the error ? I am not sure. but I tried to use this option (ls script) to remove the error and I had an another complain.
VoilĂ , that's all. I hope you understand better.

Log in or register to post comments