I'm trying to make this project using Mingw32:
GitHub PNG2POS
For that, I'm doing the following command using git bash:
git clone --recursive https://github.com/petrkutalek/png2pos.git
It creates a folder called png2pos containing the project sources, and an important file called Makefile.
From there, I cd into the newly create folder, and try to execute the command
make
The expected result was the sources being built into an executable file, but I'm getting some errors that don't allow me to to that:
(...)/x86_64-pc-cygwin-bin/ld: unrecognized option '-z'
use the --help option for usage information
collect2: error: ld returned 1 exit status
Makefile:36: recipe for target 'png2pos' failed
mingw32-make: *** [png2pos] Error 1
What am I supposed to do for this to work and create my desired executable file?
Related
Hi I am getting the following error when I try to run a simple Hello World code in VS code
[Running] cd "c:\Users\nokni\FirstProgram\" && gcc HelloWorld.c -o HelloWorld && "c:\Users\nokni\FirstProgram\"HelloWorld
c:/users/nokni/new folder/library/mingw-w64/bin/../lib/gcc/x86_64-w64-mingw32/11.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find c:/users/nokni/new: No such file or directory
c:/users/nokni/new folder/library/mingw-w64/bin/../lib/gcc/x86_64-w64-mingw32/11.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find folder/library/mingw-w64/bin/../lib/gcc/x86_64-w64-mingw32/11.1.0/../../../../x86_64-w64-mingw32/lib/../lib/default-manifest.o: No such file or directory
collect2.exe: error: ld returned 1 exit status
Any idea why?
The error messages are clearly showing that they are expecting two locations:
c:/users/nokni/new
and
folder/library/mingw-w64/bin/../lib/gcc/x86_64-w64-mingw32/11.1.0/../../../../x86_64-w64-mingw32/lib/../lib/default-manifest.o
This should be very indicative that the folder "new folder" is not correctly recognised in the path. The directory name should have been properly escaped or embedded in quotes:
"c:\users\nokni\new folder\library\mingw-w64\..etc.."
or
c:\users\nokni\"new folder"\library\mingw-w64\..etc..
I am sending over a socket a Dockerfile and a .c file. I am trying to
build the image in a C programm using the following command:
system("docker build -t my_image .")
But when it starts to build the image, I get the following output:
Step 1/6 : FROM gcc:4.9
---> 1b3de68a7ff8
Step 2/6 : COPY . /home/server/src
---> 3ad55a5751dd
Step 3/6 : WORKDIR /home/server/src
---> Running in 8d768eda43ee
Removing intermediate container 8d768eda43ee
---> bf9a9ff0273b
Step 4/6 : EXPOSE 9000
---> Running in 75c48b8aa200
Removing intermediate container 75c48b8aa200
---> b38c514453e0
Step 5/6 : RUN gcc ./rand_gen_server.c -o server_side
---> Running in b4486ecd8451
/usr/lib/x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
The command '/bin/sh -c gcc ./rand_gen_server.c -o server_side' returned a non-zero code: 1
When building directly in the cmd, everything works. I am running the C
programm using sudo.
Any ideas?
The combination of #ForceBru and #Rudi help me. Since the Dockerfile was obtained from a socket, I had to replace the COPY and WORKDIR paths to the ones corresponding to the new host.
Also, I changed the step 5/6 to gcc -c /rand_gen_server.c -o server_side.
Let's see if the rest of the endeavor will work.
UPDATE
Turns out, during compilation, I cannot compile another .c file. In order to do this, I have to create a new process. Using the function fork() and the executing the system call for building the docker image did the job. Plus, I did not use the -c option during the compilation.
I am trying to use two github repositories as shown below:
https://github.com/markoneill/ssa-daemon
https://github.com/markoneill/ssa
When trying to execute "build-client-auth.sh" in the ssa-daemon directory I ran into this error. Also, in order to make it easy to troubleshoot I went into "build-client-auth.sh" and took the command on line 72 that was giving me an error, which is "make clientauth" as shown below.
[eli#localhost ssa-daemon]$ make clientauth
make -C ./qrdisplay
make[1]: Entering directory '/home/eli/csci400/ssa-daemon/qrdisplay'
make[1]: 'bin/qrPopUp' is up to date.
make[1]: Leaving directory '/home/eli/csci400/ssa-daemon/qrdisplay'
gcc hashmap.o netlink.o hashmap_str.o tls_wrapper.o config.o issue_cert.o
daemon.o main.o self_sign.o openssl_compat.o csr_daemon.o rfcomm_client.o nsd.o
log.o rfcomm_server.o queue.o notification.o tb_connector.o auth_daemon.o -o
tls_wrapper -Llibevent/lib -Lopenssl/lib -Wl,-rpath -Wl,libevent/lib -Wl,-rpath
-Wl,openssl/lib -lpthread pkg-config --libs libconfig libevent_openssl libnl-
genl-3.0 libnotify avahi-client openssl
/usr/bin/ld: rfcomm_client.o: in function main': /home/eli/csci400/ssa-
daemon/rfcomm_client.c:35: multiple definition of main';
main.o:/home/eli/csci400/ssa-daemon/main.c:61: first defined here
/usr/bin/ld: rfcomm_server.o: in function main': /home/eli/csci400/ssa-
daemon/rfcomm_server.c:15: multiple definition of main';
main.o:/home/eli/csci400/ssa-daemon/main.c:61: first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:65: clientauth] Error 1
Thanks to Kuchara, who said to remove both rfcomm_client.c and rfcomm_server.c, I was able to get passed the error above. However, I am getting a new error as follows:
Done
Building custom sslsplit
Cloning into 'sslsplit'...
remote: Enumerating objects: 155, done.
remote: Counting objects: 100% (155/155), done.
remote: Compressing objects: 100% (110/110), done.
remote: Total 4050 (delta 80), reused 106 (delta 43), pack-reused 3895
Receiving objects: 100% (4050/4050), 1.59 MiB | 4.92 MiB/s, done.
Resolving deltas: 100% (2885/2885), done.
0001-SSA-patch.patch:147: trailing whitespace.
error: patch failed: pxyconn.c:936
error: pxyconn.c: patch does not apply
===========================================================================
So, what I did was look at the build script for the section that was making the error and saw this:
echo "Building custom sslsplit"
git clone https://github.com/droe/sslsplit
cd sslsplit
cp ../extras/sslsplit/0001-SSA-patch.patch .
cp ../extras/sslsplit/ca.crt .
cp ../extras/sslsplit/ca.key .
cp ../extras/sslsplit/start.sh .
cp ../extras/sslsplit/firewallOn.sh .
git apply 0001-SSA-patch.patch
make
cd ..
echo "Done"
So, what I believe is the "git apply 0001-SSA-patch.patch" is giving the error, but how I would I fix it?
Try checking out this revision: 6955368275b4372ebd0b7a125de626808a7e5aef
According to the git log, problematic files seem to be some test codes, which were added recently:
https://github.com/markoneill/ssa-daemon/commit/d5a94cb4409dd27e4478b4bba2413dfae1c70169
BTW that failure you have is the reason why I usually discourage to use wildcards. :-)
the patch was not working so I applied the patch by hand and it works!
After I configured the cmake file for portmidi, and proceeded to use make to make the necessary files, I encountered this error during compilation:
- Build files have been written to: /home/mycomputername
/Desktop/portmedia/portmidi
[ 2%] Linking C shared library /Release/libpmjni.so
/usr/bin/x86_64-linux-gnu-ld: cannot open output file /Release/libpmjni.so: No such file or directory
collect2: error: ld returned 1 exit status
pm_common/CMakeFiles/pmjni.dir/build.make:251: recipe for target '/Release/libpmjni.so' failed
make[2]: *** [/Release/libpmjni.so] Error 1
CMakeFiles/Makefile2:87: recipe for target 'pm_common/CMakeFiles/pmjni.dir/all' failed
make[1]: *** [pm_common/CMakeFiles/pmjni.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
I'm quite confused. I've tried to insert the flags -fpic in the cxx-flags section of ccmake and change the default java install paths to no avail. Quite frankly, I think it has to do with the messing up of execution order, but I don't know where.
Any help will be greatly appreciated.
Apparently, there was some configuring to do in the directories that CMake points to in ccmake configuration. I just redownloaded the files and unzipped it into a newly made portmedia directory. Also, to make sure that you don't get any hiccups in making pm_defaults, refer to Nate's answer. To quote:
Apparently, one of the Makefiles generated by ccmake is broken. I was able to fix the issue by running
sed -i 's/pm_java\/pm_java/pm_java/' build.make
in the pm_java/CMakeFiles/pmdefaults_target.dir/ subdirectory of the
project after running ccmake . (on Ubuntu, though). (The sed
command replaces all occurrences of pm_java/pm_java by pm_java.)
Everything compiles, and I can even run pmdefaults from the
Release directory using
java -Djava.library.path=. -jar pmdefaults.jar
I'm trying to use a simple shared library that I made with a file that just contains a main method.
I first ran cmake . which worked fine and didn't return any errors.
Then I ran make but got this error:
$ make
Scanning dependencies of target myprog
[ 50%] Building C object CMakeFiles/myprog.dir/main.c.o
[100%] Linking C executable myprog.exe
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lhello-user
collect2: error: ld returned 1 exit status
clang-3.8: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/myprog.dir/build.make:95: myprog.exe] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/myprog.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
The CMakeLists.txt file
cmake_minimum_required(VERSION 2.8.8)
project(LIB_EXAMPLE)
set(CMAKE_C_COMPILER clang)
add_executable(myprog main.c)
target_link_libraries(myprog hello-user)
The library exists inside of /usr/local/lib/ as libhello-user.dll.a
Note: Im using Cygwin for cmake and make
Turning my comment into an answer
See CMake/Tutorials/Exporting and Importing Targets.
You either have:
to name a full path for the library
CMake is not searching for it automatically
you would have to add something like find_library(_lib_path NAMES hello-user)
or - better - put those into an IMPORTED target
cmake_minimum_required(VERSION 2.8.8)
project(LIB_EXAMPLE)
add_library(hello-user SHARED IMPORTED GLOBAL)
set_target_properties(
hello-user
PROPERTIES
IMPORTED_LOCATION /usr/local/lib/libhello-user.dll
IMPORTED_IMPLIB /usr/local/lib/libhello-user.dll.a
)
add_executable(myprog main.c)
target_link_libraries(myprog hello-user)