Errors in SLES11

Hello
recently i magrated my server from SLES10 SLES11.2, gcc copmlier 4.3.4&binutils 2.21. when i am doing builds i am getting errors as atoi,setenv,etc was not declared in the scope and one more error Unrecognized option “–build id”.

g++ /home/ismdev/sources/cfsw/source/wscafl02.cpp -c -o /home/ismdev/builds/sap/build/wscafl02.o -fexceptions -DTRACE -DCFSW -DSAP -DWEB -DCFSWEB_LINUX2VM -DCFSWEB_SWNT_SAP -DCFSWEB_SAVERESTORE -m32 -ggdb -DCOMPILER_MIGRATION -DISPF_EXCLUDE -I/home/ismdev/sources/cfsw/include -I/home/ismdev/sources/cfsw/components/logclient/include -I/home/ismdev/sources/ispf_emulator/include -I/home/ismdev/sources/wscapi/include -I/home/ismdev/sources/crf/include -I/usr/include/libxml2 -I/usr/include/curl
/home/ismdev/sources/cfsw/source/wscafl02.cpp: In member function âRESULT WSCAFL02_FileUploadPanel::CheckAuthorization()â:
/home/ismdev/sources/cfsw/source/wscafl02.cpp:1849: error: âgetenvâ was not declared in this scope
/home/ismdev/sources/cfsw/source/wscafl02.cpp:1849: error: âsetenvâ was not declared in this scope
/home/ismdev/sources/cfsw/source/wscafl02.cpp:1926: error: âatoiâ was not declared in this scope
/home/ismdev/sources/cfsw/source/wscafl02.cpp:1942: error: âatoiâ was not declared in this scope
/home/ismdev/sources/cfsw/source/wscafl02.cpp:1954: error: âfreeâ was not declared in this scope
/home/ismdev/sources/cfsw/source/wscafl02.cpp:2007: error: âatoiâ was not declared in this scope
/home/ismdev/sources/cfsw/source/wscafl02.cpp:2013: error: âfreeâ was not declared in this scope
/home/ismdev/sources/cfsw/source/wscafl02.cpp: In member function âRESULT WSCAFL02_FileUploadPanel::CheckAuthCFReportRestore()â:
/home/ismdev/sources/cfsw/source/wscafl02.cpp:2142: error: âatoiâ was not declared in this scope
make[2]: *** [/home/ismdev/builds/sap/build/wscafl02.o] Error 1

g++ -o /home/ismdev/builds/sap/build/ismcache.module /home/ismdev/builds/sap/build/wsconfig.o /home/ismdev/builds/sap/build/settings_manager.o /home/ismdev/builds/sap/build/wscwmqc.o /home/ismdev/builds/sap/build/cmqasync.o /home/ismdev/builds/sap/build/wscwrdcc.o -L/home/ismdev/builds/sap/build -L/home/ismdev/builds/wscapi/build -L/home/ismdev/builds/ispf/build -L/home/ismdev/builds/sap/build -Xlinker -\( -lwsc135 -lwscx10a -lwscx10b -lwscx10c -lwscp10a -lwscp10b -lwscp10c -lwscp10d -lwscv10 -lwscv111a -lwscv111b -lwscv111c -lwscegg -lwscu10 -lwscde10 -lwscd10a -lwscgl10a -lwscgl10b -lwscgl10c -lwscli10 -lwscna10 -lwscpr10 -lwscse10 -lwscva10 -lwscr10a -lwscr10b -lwscr10c -lwscaci10 -lwscrsap -lwscw10 -lapit -lispf -lpanel -lform -lncurses -lcurl -lxml2 -lssl -lmqic -lsapnt -Xlinker -\) -m32 -Xlinker --export-dynamic
/usr/lib64/gcc/x86_64-suse-linux/4.3/…/…/…/…/x86_64-suse-linux/bin/ld: unrecognized option ‘–build-id’
/usr/lib64/gcc/x86_64-suse-linux/4.3/…/…/…/…/x86_64-suse-linux/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status
make[1]: *** [ismcache.module] Error 1

Hello
please help me with it. anyone can be much appreciated.

Thanks

[QUOTE=Supriya;24374]Hello
please help me with it. anyone can be much appreciated.

Thanks[/QUOTE]

I think the reason you’ve not got any replies so far is in large part because it’s not at all clear what you are trying to do. You’re trying to compile something, but what exactly is it you’re trying to compile?

I’m curious why you’ve updated to SLES 11 SP2 rather than SLES 11 SP3 given that SP2 is already End Of Life.

Hi Supriya,

/home/ismdev/sources/cfsw/source/wscafl02.cpp:1849: error: âgetenvâ was not declared in this scope

does that source file include the proper include files? It’s rather typical that gcc gets more picky over versions, pointing out errors and warnings that were not reported earlier.

See “man 3 getenv” etc. for details.

/usr/lib64/gcc/x86_64-suse-linux/4.3/…/…/…/…/x86_64-suse-linux/bin/ld: unrecognized option ‘–build-id’
/usr/lib64/gcc/x86_64-suse-linux/4.3/…/…/…/…/x86_64-suse-linux/bin/ld: use the --help option for usage information

That one looks strange. You might want to call that ld (which ought to be a symlink effectively pointing to /usr/bin/ld) with “–help” to check if it mentions that option - my SLES11SP3 version does.

Regards,
Jens

Hi
When having linking issues with older code, exporting the following
before you compile some times helps…

export SUSE_ASNEEDED=0


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
SUSE Linux Enterprise Desktop 12 GNOME 3.10.1 Kernel 3.12.28-4-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

Hi Malcolm,

learning something new every day… interesting way to revert that “as-needed” linker flag :slight_smile:

In this case, I believe that this variable wouldn’t help much: The linker statement is already using a link group to wrap all libraries (to avoid the “symbol not found because of lib ordering” issue) and no missing symbols are reported by the linker, anyhow. But from what I can tell, the linker should support the “–build-id” option, Why it is complaining about it, I cannot tell. Do you have an idea what may be causing this, have I overlooked something in the linker parameters used?

Regards,
Jens

SLES11 SP2 is mandatory for me. All the libraries are installed and i have some files. When i am compiling those i am getting those errors. i don’t know why those errors are getting exactly. Thanks

Hi Supriya,

are you the developer in charge of those sources?

Regards,
Jens

no i am not. i am working on migrating an old server to new server. for that i copied all sources from old to new server and i installed all libraries which the server needed. after that when i tried to compile those sources i am getting errors.

Hi Supriya,

then I’ll try my best, at least to explain… but it’d be helpful if you had someone with a bit of C coding experience at hand…

When stumbling over a function call within some C code, the compiler tries to check if the programmer gave proper parameters to the function call. In order to do that verification, the compiler has to know about the number of required parameters and their types, this information is provided in so-called “header files” (because they include the function signature headers, among other information) or “include files” (because a “#include” statement is used to link your source to those files). In the C world, these files have names that end in “.h”.

The older a compiler you come across, the less picky it acts. Early C compilers didn’t even have a mean to check the function signatures nor cared if the function existed at all. Later compilers issued warnings, modern compilers are more rigorous, as you have found out.

Now, for each function that the compiler complains about, you need to find the name of the proper include file, and include that file once. The functions that were reported in your first post were all system functions, coming from stdlib.h, so you’ll have to insert an include statement in the source code file. Usually, you put these at the beginning of the file, so look for some block of include statement and add

#include <stdlib.h>

Now the compiler complaints should have gone away.

I still have no clue what’s wrong with the linker invocation, so I currently cannot help you with that, unfortunately.

Regards,
Jens

I kept all my libraries in /usr/include I don’t want to keep that libraries in source code. In old server we follow same process that time they compiled successfully. now why they are giving error.

my libraries are in
ismdev@INMBZ2197:/usr/include> ls
stdlib.h
string.h
stdint.h
All libarries are included like this.

It is not working for this linking error.

[QUOTE=malcolmlewis;24393]Hi
When having linking issues with older code, exporting the following
before you compile some times helps…

export SUSE_ASNEEDED=0

Hi Supriya,

[QUOTE=Supriya;24423]I kept all my libraries in /usr/include I don’t want to keep that libraries in source code. In old server we follow same process that time they compiled successfully. now why they are giving error.

my libraries are in
ismdev@INMBZ2197:/usr/include> ls
stdlib.h
string.h
stdint.h
All libarries are included like this.[/QUOTE]

to me it seems this is no product problem, but requires (at least basic “C”) programming skills. Teaching C programming is beyond the scope of this forum, I suggest that you either get some local person from that area to help you out (should be a matter of an hour or less, judging from your description) or try some forum specialized on C/C++ programming if you want to learn the language and programming fundamentals.

Regards,
Jens

I know C++ programming. my problem is that if i include that stdlib.h in source file then error won’t occur. but as per my requirement lib will not be include in source fiels. those libraries need to keep inside /usr/include from there source file will take that libraries and do compilation. in previous servers it works fine. while i am doing the same in new server it is giving error.

Hi Supriya,

ah, that’s good.

That’s even better - because that#s the way things are to work :wink:

Most likely I’m not understanding you correctly - those files in /usr/include are no libraries, but header files, and you need to include them in order to use them. That’s what they are written for. What else do you mean with “from there source file will take that libraries and do compilation”?

That it worked in older versions is likely to blame on the carelessness of the older compilers.

Regards,
Jens