I am trying to create a makefile through GYP. I had errors saying that ld cannot find the necessary libraries so I included them in ldflags in the gyp file. The code I have is:
'link_settings': {
'ldflags': [
'-L/path/to/lib1' , '-L/path/to/lib2', ...
],
'libraries': [
'-llib1',
'-llib2', ...
],
},
The previous errors dissappeared, but now I am getting a new one
group ended before it began (--help for usage)
collect2: ld returned 1 exit status
I tried adding the libraries in the 'libraries' list with an absolute path but the result is the same. I saw this question but I don't thing it helps me (or I can't understand how). I would really appreciate your help!
I solved this error by specifying the exact libraries that I wanted to include from each directory:
'ldflags': [
'-L/path/to/lib1 -llib1' , '-L/path/to/lib2 -llib2', ...
],
Related
I tried to build something with GnatColl from GPS Community 2021 on Fedora 35. The linker failed, saying
ld: /path/to/common/Ada/Quoter/obj/gnatcoll-refcount.o: in function `gnatcoll__refcount__sync_bool_compare_and_swap':
gnatcoll-refcount.adb:(.text+0x622): undefined reference to `gnatcoll_sync_bool_compare_and_swap_access'
collect2: error: ld returned 1 exit status
This also fails if I try to run the project using gprbuild -P Quoter.gpr.
I can fix this from the command line by copying the failed command (gcc ...) and adding ~/opt/GNAT/2021/include/gnatcoll/gnatcoll_support.c to the list of files to compile, as that's the included file with the desired function. That's awfully inconvenient, though.
I guess I have something configured slightly wrong. Might anyone here have an idea?
I found the answer, and it's a bit embarrassing, but looking in the gnatcoll examples would have done it: add with "gnatcoll"; to the beginning of the gpr file.
I've been trying to get the regex.h library to work all day, but it's not working. (Here are my VS Code workspace configurations: https://github.com/EnderCommunity/Murmur/tree/main/.vscode - all the compiler info are here)
This is the file that I was trying to get the regex library to work with:
https://github.com/EnderCommunity/Murmur/blob/main/compiler/libraries/regex/reg.h
I tried to include the library normally, but it returns an error:
And I tried to include this library, but it returns some compiling errors:
> Executing task: C/C++: gcc.exe build active file <
Starting build...
"C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\gcc.exe" -g C:\Users\adels\Desktop\EnderCommunity\Projects\Murmur\compiler\start.c -o C:\Users\adels\Desktop\EnderCommunity\Projects\Murmur\compiler\start.exe
C:\Users\adels\AppData\Local\Temp\ccifSq1r.o: In function `regChk':
C:/Users/adels/Desktop/EnderCommunity/Projects/Murmur/compiler/libraries/regex/reg.h:15: undefined reference to `__imp_regcomp'
C:/Users/adels/Desktop/EnderCommunity/Projects/Murmur/compiler/libraries/regex/reg.h:22: undefined reference to `__imp_regexec'
C:/Users/adels/Desktop/EnderCommunity/Projects/Murmur/compiler/libraries/regex/reg.h:33: undefined reference to `__imp_regerror'
C:/Users/adels/Desktop/EnderCommunity/Projects/Murmur/compiler/libraries/regex/reg.h:40: undefined reference to `__imp_regfree'
collect2.exe: error: ld returned 1 exit status
Build finished with error(s).
The terminal process terminated with exit code: -1.
Terminal will be reused by tasks, press any key to close it.
So the way that I included this library might be wrong! What am I doing wrong here?
Using MSYS2 will fix this, it comes with all the necessary libraries for C.
As the title suggests, I am having a problem linking some libraries to my code. Minuit2 is in
/home/christian/root/include
and when I compile I run the following:
g++ -I/home/christian/root/include niminimzationExample.cpp -o niminimzationExample -L/Minuit2/lib -lMinuit2
which gives me the following error
/usr/bin/ld: cannot find -lMinuit2
collect2: error: ld returned 1 exit status
Being a newbie, I am not even sure what the error exactly means or how to fix it. I run Minuit2 on another machine, which the same command, and everything works fine. Any help would be greatly appreciated.
Thanks,
Christian
I am not even sure what the error exactly means
The error means: linker searched for a file named libMinuit2.so and libMinuit2.a in /Minuit2/lib/ and then standard directories (usually /usr/lib and /lib), and didn't find it anywhere.
or how to fix it.
You need to find the directory in which one or both of libMinuit2.{so,a} are located, and then use -L/that/directory at link time to tell the linker where to find the library.
Greetings
I am new to iotivity and following the iotivity wiki guidelines for understanding and building framework.(on Ubuntu 16.04)
AIM - For ARM Cross Compilation. We are following the below Iotivity link.
https://wiki.iotivity.org/iotivity_porting_to_arm_based_platforms?s[]=arm&s[]=based&s[]=platforms
Described below Step 4 as mention in the link .
We are using arm-linux-gnueabi compiler which support build for our tager Artik 520 - ARM Cortex A7 processer.
4) Download the UUID Header/Libraries for arm architecture from Internet or from linkuuid-arm.zip. Place the UUID Headers/Libraries inside IoTivity folder (For Eg: iotivity/extlibs/). Update the CPPPATH/LIBPATH for UUID Headers/Libraries in required SConscript
As describe above i have followed the steps.
-Issue is the uuid-arm folder doesn't have any defulat SConscript when unzip(only header and lib folder) and it is not Cleary mention which is the required SConscript to add below lines. The uuid.so is present in the uuid-arm lib folder.below are the lines which are mention need to be added.i am confused on this which will be the required Sconscripts and how to debug this. Kindly help on this.
For E.g.: env.AppendUnique(CPPPATH = [ '<uuid header path>'])
env.AppendUnique(LIBPATH = ['<uuid Library Path>'])
env.AppendUnique(LIBS = ['uuid'])
{{:arm_uuid_path.png?200|}} -----> This line itself is a syntax error to add anywhere.
Build Command
scons TARGET_OS=linux TARGET_ARCH=arm TARGET_TRANSPORT=IP SECURED=0 RELEASE=1 TC_PREFIX=arm-linux-gnueabi- TC_PATH=/usr/arm-linux-gnueabi/bin
ERROR
scons: Building targets ...
scons: building associated VariantDir targets: out/linux/arm/release Linking out/linux/arm/release/resource/csdk/connectivity/src/libconnectivity_abstraction.so
/usr/lib/gcc-cross/arm-linux-gnueabi/5/../../../../arm-linux-gnueabi/bin/ld: cannot find -luuid
collect2: error: ld returned 1 exit status
scons: *** [out/linux/arm/release/resource/csdk/connectivity/src/libconnectivity_abstraction.so] Error 1
scons: building terminated because of errors
Thanks for help..
From the error message, it looks like the path to the uuid library is not updated properly in the scons file.
Can you please share your changes in the scons file, specifically the below lines.
env.AppendUnique(CPPPATH = [ '<uuid header path>'])
env.AppendUnique(LIBPATH = ['<uuid Library Path>'])
env.AppendUnique(LIBS = ['uuid'])
I hope you have updated the ['< uuid Library path>'] with your absolute path, which may be /root/workspace/iotivity/extlibs/uuid
Agreed, {{:arm_uuid_path.png?200|}} is not a proper scons syntax. It looks like a webpage error to me, instead of the image file, just the path is included
I am faced with the exact same situation as the question raised by Gustavo in the following Link. Also, I have tried all the solutions posted in that link and other tags (such as changing library names from opus.a to libopus.a, change '\' to '/' and so on) but none of these have solved my problem. By opening the properties of the library file, these are the following things displayed:
Path: /demo/opusfile/libopusfile.a
Type: File (Static Library)
Location: U:\data\Jag\eclipse\wrksp\demo\opusfile\libopusfile.a
The error message displayed by Mingw is as follows:
15:56:57 **** Incremental Build of configuration Debug for project demo ****
Info: Internal Builder is used for build
gcc -o demo.exe "src\\demo.o" -lU:/data/Jag/eclipse/wrksp/demo/opusfile/libopusfile.a
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lU:/data/Jag/eclipse/wrksp/demo/opusfile/libopusfile.a
collect2.exe: error: ld returned 1 exit status
collect2.exe: error: ld returned 1 exit status
Could someone please let me know what am I missing ? I am not able to resolve this issue
I think I found the solution, thanks to the answer posted in this Link. So basically to summarize the solution, I had to remove the 'lib' prefix, the '.a' suffix and the library path when I specified the libraries (-l parameters). The library path has to be specified in the -L parameter . This resolved the above problem but led to another hurdle by Mingw:
libopusfile.dll.a: could not read symbols: Archive has no index; run ranlib to add one.
I executed the 'ranlib' command in the command prompt
cmd_path> ranlib libopusfile.dll.a
, as suggested by the compiler, and this solved all my issues!